Skip to content

Commit

Permalink
Revert "Updates Dispatch Conversation URLs to reflect complete worksp…
Browse files Browse the repository at this point in the history
…ace URL (#3449)" (#3522)

This reverts commit f4c720f.

Co-authored-by: Marc Vilanova <[email protected]>
  • Loading branch information
metroid-samus and mvilanova authored Jun 22, 2023
1 parent 7a92c4c commit 8eee40a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
2 changes: 0 additions & 2 deletions src/dispatch/plugins/dispatch_slack/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@


class SlackAPIGetEndpoints(DispatchEnum):
chat_permalink = "chat.getPermalink"
conversations_history = "conversations.history"
conversations_info = "conversations.info"
team_info = "team.info"
users_conversations = "users.conversations"
users_info = "users.info"
users_lookup_by_email = "users.lookupByEmail"
Expand Down
21 changes: 3 additions & 18 deletions src/dispatch/plugins/dispatch_slack/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ def list_conversation_messages(client: WebClient, conversation_id: str, **kwargs
)


@functools.lru_cache()
def get_domain(client: WebClient) -> str:
"""Gets the team's Slack domain."""
return make_call(client, SlackAPIGetEndpoints.team_info)["team"]["domain"]


@functools.lru_cache()
def get_user_info_by_id(client: WebClient, user_id: str) -> dict:
"""Gets profile information about a user by id."""
Expand Down Expand Up @@ -194,7 +188,7 @@ def create_conversation(client: WebClient, name: str, is_private: bool = False)
return {
"id": response["id"],
"name": response["name"],
"weblink": f"https://{get_domain(client)}.slack.com/app_redirect?channel={response['id']}",
"weblink": f"https://slack.com/app_redirect?channel={response['id']}",
}


Expand Down Expand Up @@ -269,15 +263,6 @@ def add_users_to_conversation(
pass


def get_message_permalink(client: WebClient, conversation_id: str, ts: str) -> str:
return make_call(
client,
SlackAPIGetEndpoints.chat_permalink,
channel=conversation_id,
message_ts=ts,
)


def send_message(
client: WebClient,
conversation_id: str,
Expand All @@ -302,7 +287,7 @@ def send_message(
return {
"id": response["channel"],
"timestamp": response["ts"],
"weblink": get_message_permalink(client, response["channel"], response["ts"]),
"weblink": f"https://slack.com/app_redirect?channel={response['id']}", # TODO should we fetch the permalink?
}


Expand All @@ -326,7 +311,7 @@ def update_message(
return {
"id": response["channel"],
"timestamp": response["ts"],
"weblink": get_message_permalink(client, response["channel"], response["ts"]),
"weblink": f"https://slack.com/app_redirect?channel={response['id']}", # TODO should we fetch the permalink?
}


Expand Down

0 comments on commit 8eee40a

Please sign in to comment.