Support private channels
This commit is contained in:
parent
0249a58a36
commit
36b4e4d8d9
1 changed files with 12 additions and 1 deletions
|
@ -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]:
|
def resolve_channel(mm_api: mattermost.MMApi, team_id: str, query: str) -> Optional[Dict]:
|
||||||
return first(
|
public_channel_result = first(
|
||||||
filter(
|
filter(
|
||||||
predicate_for_query(query),
|
predicate_for_query(query),
|
||||||
mm_api.get_team_channels(team_id)
|
mm_api.get_team_channels(team_id)
|
||||||
),
|
),
|
||||||
None
|
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:
|
def resolve_team_channel(mm_api: mattermost.MMApi, query: str) -> Dict:
|
||||||
|
|
Loading…
Reference in a new issue