Support private channels

This commit is contained in:
Midgard 2023-10-27 13:59:30 +02:00
parent 0249a58a36
commit 36b4e4d8d9
Signed by: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -138,13 +138,24 @@ def resolve_team(mm_api: mattermost.MMApi, query: str) -> Optional[Dict]:
def resolve_channel(mm_api: mattermost.MMApi, team_id: str, query: str) -> Optional[Dict]:
return first(
public_channel_result = first(
filter(
predicate_for_query(query),
mm_api.get_team_channels(team_id)
),
None
)
if public_channel_result is not None:
return public_channel_result
joined_channel_result = first(
filter(
predicate_for_query(query),
mm_api.get_channels_for_user("me", team_id, params={"include_deleted":True})
),
None
)
return joined_channel_result
def resolve_team_channel(mm_api: mattermost.MMApi, query: str) -> Dict: