Skip to content

Commit

Permalink
fix(ingest/slack): pull real names (datahub-project#10565)
Browse files Browse the repository at this point in the history
Co-authored-by: Shirshanka Das <[email protected]>
  • Loading branch information
hsheth2 and shirshanka authored May 23, 2024
1 parent 82ef467 commit 1544a60
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions metadata-ingestion/src/datahub/ingestion/source/slack/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class CorpUser:
title: Optional[str] = None
image_url: Optional[str] = None
phone: Optional[str] = None
real_name: Optional[str] = None
slack_display_name: Optional[str] = None


class SlackSourceConfig(ConfigModel):
Expand Down Expand Up @@ -144,6 +146,12 @@ def get_user_info(self) -> Iterable[MetadataWorkUnit]:
corpuser_editable_info.pictureLink = user_obj.image_url
if user_obj.phone:
corpuser_editable_info.phone = user_obj.phone
if (
not corpuser_editable_info.displayName
or corpuser_editable_info.displayName == corpuser_editable_info.email
):
# let's fill out a real name
corpuser_editable_info.displayName = user_obj.real_name
yield MetadataWorkUnit(
id=f"{user_obj.urn}",
mcp=MetadataChangeProposalWrapper(
Expand Down Expand Up @@ -259,6 +267,9 @@ def populate_user_profile(self, user_obj: CorpUser) -> None:
user_obj.title = user_profile.get("title")
user_obj.image_url = user_profile.get("image_192")
user_obj.phone = user_profile.get("phone")
user_obj.real_name = user_profile.get("real_name")
user_obj.slack_display_name = user_profile.get("display_name")

except Exception as e:
if "missing_scope" in str(e):
if self._use_users_info:
Expand Down

0 comments on commit 1544a60

Please sign in to comment.