diff --git a/src/controllers/ConversationsController.ts b/src/controllers/ConversationsController.ts index 26bd9f7..5b71d66 100644 --- a/src/controllers/ConversationsController.ts +++ b/src/controllers/ConversationsController.ts @@ -41,6 +41,7 @@ export class ConversationsController { name: name == "false" ? "" : removeHTMLNodes(name), following: h.postBool("follow"), members: members, + canEveryoneAddMembers: h.postBool("canEveryoneAddMembers", true), } const convID = await ConversationsHelper.Create(conv); @@ -156,7 +157,8 @@ export class ConversationsController { ownerID: h.getUserId(), name: "", following: true, - members: new Set([h.getUserId(), otherUser]) + members: new Set([h.getUserId(), otherUser]), + canEveryoneAddMembers: true }); list.push(convID); diff --git a/src/entities/Conversation.ts b/src/entities/Conversation.ts index 287c4c1..d72e3a8 100644 --- a/src/entities/Conversation.ts +++ b/src/entities/Conversation.ts @@ -8,7 +8,8 @@ export interface BaseConversation { ownerID: number, name: string, following: boolean, - members: Set + members: Set, + canEveryoneAddMembers: boolean, } export interface Conversation extends BaseConversation { diff --git a/src/helpers/ConversationsHelper.ts b/src/helpers/ConversationsHelper.ts index 7fce7d5..634f96e 100644 --- a/src/helpers/ConversationsHelper.ts +++ b/src/helpers/ConversationsHelper.ts @@ -30,7 +30,8 @@ export class ConversationsHelper { "user_id": conv.ownerID, "name": conv.name, "last_active": time(), - "creation_time": time() + "creation_time": time(), + "can_everyone_add_members": conv.canEveryoneAddMembers ? 1 : 0 }); // Add the members to the conversation