mirror of
				https://gitlab.com/comunic/comunicapiv3
				synced 2025-11-04 01:24:04 +00:00 
			
		
		
		
	Can check if a user is a moderator of a conversation or not
This commit is contained in:
		@@ -107,6 +107,14 @@ pub fn does_user_belongs_to(user_id: UserID, conv_id: u64) -> ResultBoxError<boo
 | 
			
		||||
        .exec_count()? > 0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Check out wheter a user is the moderator of a conversation or not
 | 
			
		||||
pub fn is_user_moderator(user_id: UserID, conv_id: u64) -> ResultBoxError<bool> {
 | 
			
		||||
    Ok(database::QueryInfo::new(CONV_LIST_TABLE)
 | 
			
		||||
        .cond_u64("id", conv_id)
 | 
			
		||||
        .cond_user_id("user_id", user_id)
 | 
			
		||||
        .exec_count()? > 0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Turn a database entry into a ConversationInfo object
 | 
			
		||||
fn db_to_conversation_info(row: &database::RowResult) -> ResultBoxError<Conversation> {
 | 
			
		||||
    let conv_id = row.get_u64("id")?;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user