events: Only send bot_type for bots and thus remove the for_api param.

This commit is contained in:
Hemanth V. Alluri
2019-10-26 22:02:21 +05:30
committed by Tim Abbott
parent fa6bd42f4c
commit c1370547d5
4 changed files with 7 additions and 12 deletions

View File

@@ -75,8 +75,7 @@ def get_custom_profile_field_values(realm_id: int) -> Dict[int, Dict[str, Any]]:
return profiles_by_user_id
def get_raw_user_data(realm: Realm, user_profile: UserProfile,
client_gravatar: bool, for_api: bool=False,
def get_raw_user_data(realm: Realm, user_profile: UserProfile, client_gravatar: bool,
include_custom_profile_fields: bool=True) -> Dict[int, Dict[str, str]]:
user_dicts = get_realm_user_dicts(realm.id)
@@ -115,12 +114,8 @@ def get_raw_user_data(realm: Realm, user_profile: UserProfile,
user_profile.is_realm_admin):
result['delivery_email'] = row['delivery_email']
if for_api:
# The API currently has a quirk that it expects to include
# a bot_type field even for human users; this field is
# invalid so we plan to eventually remove this.
result['bot_type'] = row['bot_type']
if is_bot:
result["bot_type"] = row["bot_type"]
if row['email'] in settings.CROSS_REALM_BOT_EMAILS:
result['is_cross_realm_bot'] = True
elif row['bot_owner_id'] is not None: