mirror of
				https://gitlab.com/comunic/comunicapiv2
				synced 2025-11-04 11:34:04 +00:00 
			
		
		
		
	Can update "can_everyone_add_members" conversation setting
This commit is contained in:
		@@ -95,7 +95,7 @@ export class ConversationsController {
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
		// Change moderator settings
 | 
			
		||||
		if(h.hasPostParameter("members") || h.hasPostParameter("name")) {
 | 
			
		||||
		if(h.hasPostParameter("members") || h.hasPostParameter("name") || h.hasPostParameter("canEveryoneAddMembers")) {
 | 
			
		||||
			
 | 
			
		||||
			// Check if user is the moderator of the conversation
 | 
			
		||||
			if(!await ConversationsHelper.IsUserModerator(h.getUserId(), convID))
 | 
			
		||||
@@ -119,6 +119,11 @@ export class ConversationsController {
 | 
			
		||||
				await ConversationsHelper.SetMembers(convID, members);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// Update "canEveryoneAddMembers" parameter
 | 
			
		||||
			if(h.hasPostParameter("canEveryoneAddMembers")) {
 | 
			
		||||
				await ConversationsHelper.SetCanEveryoneAddMembers(convID, h.postBool("canEveryoneAddMembers"));
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		h.success("Conversation information successfully updated!");
 | 
			
		||||
@@ -160,6 +165,8 @@ export class ConversationsController {
 | 
			
		||||
	 * Refresh current user conversations
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param h Request handler
 | 
			
		||||
	 * @deprecated Only ComunicWeb was using this method until
 | 
			
		||||
	 * the introduction of WebSockets...
 | 
			
		||||
	 */
 | 
			
		||||
	public static async RefreshList(h: RequestHandler) {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -208,6 +208,27 @@ export class ConversationsHelper {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Specify whether any member of this conversation can invite other users
 | 
			
		||||
	 * to join it
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param convID Target conversation ID
 | 
			
		||||
	 * @param allow If set to true, all the members of the conversation
 | 
			
		||||
	 * will be allowed to add members to this conversation (this parameters
 | 
			
		||||
	 * is not related with the deletion of members)
 | 
			
		||||
	 */
 | 
			
		||||
	public static async SetCanEveryoneAddMembers(convID: number, allow: boolean) {
 | 
			
		||||
		await DatabaseHelper.UpdateRows({
 | 
			
		||||
			table: LIST_TABLE,
 | 
			
		||||
			where: {
 | 
			
		||||
				"id": convID
 | 
			
		||||
			},
 | 
			
		||||
			set: {
 | 
			
		||||
				"can_everyone_add_members": allow ? 1 : 0
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Update following state of the conversation
 | 
			
		||||
	 * 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user