init
This commit is contained in:
commit
6dcb020bb5
16 files changed
+488
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import logging
|
||||
|
||||
import database
|
||||
|
||||
def user_in_thread(user_id: int, thread_id: int) -> bool:
|
||||
forums = database.get_user_forums(user_id)
|
||||
|
||||
if not forums:
|
||||
return False
|
||||
|
||||
for forum in forums:
|
||||
if not forum.id:
|
||||
logging.error(f'Forum {forum.name} has no id but user is in it?')
|
||||
continue
|
||||
|
||||
threads = database.get_forum_threads(forum.id)
|
||||
|
||||
for thread in threads:
|
||||
if not thread.id:
|
||||
logging.error(f'Thread {thread.name} has no id?')
|
||||
continue
|
||||
|
||||
if thread.id == thread_id:
|
||||
return True
|
||||
|
||||
return False
|
||||
Reference in new issue
Block a user