1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-12-28 14:38:52 +00:00

Can check whether a user is the moderator of a conversation or not

This commit is contained in:
Pierre HUBERT 2019-11-30 14:19:50 +01:00
parent 4e1ef8b5f1
commit e3dec0ccaf

View File

@ -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
*