mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 03:43:42 -08:00
API: basic handling for clicking on a ! link to a unknown community
This commit is contained in:
parent
6281f3b80a
commit
7e45e4e939
1 changed files with 11 additions and 2 deletions
|
@ -80,8 +80,17 @@ def get_community(auth, data):
|
||||||
|
|
||||||
user_id = authorise_api_user(auth) if auth else None
|
user_id = authorise_api_user(auth) if auth else None
|
||||||
|
|
||||||
community_json = community_view(community=community, variant=3, stub=False, user_id=user_id)
|
try:
|
||||||
return community_json
|
community_json = community_view(community=community, variant=3, stub=False, user_id=user_id)
|
||||||
|
return community_json
|
||||||
|
except:
|
||||||
|
if 'name' in data:
|
||||||
|
query = data['name']
|
||||||
|
if user_id and '@' in query and '.' in query:
|
||||||
|
if not query.startswith('!'):
|
||||||
|
query = '!' + query
|
||||||
|
search_for_community(query)
|
||||||
|
raise Exception('error - unknown community. Please wait a sec and try again.')
|
||||||
|
|
||||||
|
|
||||||
# would be in app/constants.py
|
# would be in app/constants.py
|
||||||
|
|
Loading…
Add table
Reference in a new issue