mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 13:29:22 +00:00
Can check whether a user is the moderator of a conversation or not
This commit is contained in:
parent
4e1ef8b5f1
commit
e3dec0ccaf
@ -166,6 +166,22 @@ export class ConversationsHelper {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check out whether a user is the moderator of a conversation or not
|
||||
*
|
||||
* @param userID User to check
|
||||
* @param convID Target conversation
|
||||
*/
|
||||
public static async IsUserModerator(userID : number, convID : number) : Promise<boolean> {
|
||||
return await DatabaseHelper.Count({
|
||||
table: USERS_TABLE,
|
||||
where: {
|
||||
id: convID,
|
||||
user_id: userID
|
||||
}
|
||||
}) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of members of a conversation
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user