mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 04:04:20 +00:00 
			
		
		
		
	Can delete a group conversation
This commit is contained in:
		@@ -134,6 +134,17 @@ const GroupsInterface = {
 | 
			
		||||
		}, true)
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Delete a group conversation
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param {Number} convID The ID of the conversation to delete
 | 
			
		||||
	 */
 | 
			
		||||
	deleteGroupConversation: async function(convID) {
 | 
			
		||||
		await api("groups/delete_conversation", {
 | 
			
		||||
			conv_id: convID,
 | 
			
		||||
		}, true)
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Check the availability of a virtual directory for a group
 | 
			
		||||
	 * 
 | 
			
		||||
 
 | 
			
		||||
@@ -350,12 +350,17 @@ const GroupSettingsPage = {
 | 
			
		||||
		Vue.createApp({
 | 
			
		||||
			data: () => {
 | 
			
		||||
				return {
 | 
			
		||||
					conversations: settings.conversations,
 | 
			
		||||
					newConvName: "",
 | 
			
		||||
					newConvVisibility: "member"
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
 | 
			
		||||
			methods: {
 | 
			
		||||
 | 
			
		||||
				/**
 | 
			
		||||
				 * Create a new conversation
 | 
			
		||||
				 */
 | 
			
		||||
				createNewConv: async function() {
 | 
			
		||||
					try {
 | 
			
		||||
						const convName = this.newConvName;
 | 
			
		||||
@@ -374,6 +379,27 @@ const GroupSettingsPage = {
 | 
			
		||||
						console.error(e)
 | 
			
		||||
						notify(tr("Failed to create group conversation!"), "danger")
 | 
			
		||||
					}
 | 
			
		||||
				},
 | 
			
		||||
 | 
			
		||||
				/**
 | 
			
		||||
				 * Delete a conversation
 | 
			
		||||
				 */
 | 
			
		||||
				deleteConv: async function(convID) {
 | 
			
		||||
					try {
 | 
			
		||||
						if (!await showConfirmDialog("Do you really want to delete this conversation ?"))
 | 
			
		||||
							return;
 | 
			
		||||
 | 
			
		||||
						await GroupsInterface.deleteGroupConversation(convID)
 | 
			
		||||
						
 | 
			
		||||
						notify("The conversation was successfully deleted!", "success")
 | 
			
		||||
 | 
			
		||||
						Page.refresh_current_page();
 | 
			
		||||
					}
 | 
			
		||||
					
 | 
			
		||||
					catch(e) {
 | 
			
		||||
						console.error(e)
 | 
			
		||||
						notify(tr("Failed to delete group conversation!"), "danger")
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}).mount(conversationsSettingsTarget);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								assets/js/typings/Conversations.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								assets/js/typings/Conversations.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -27,6 +27,7 @@ declare interface Conversation {
 | 
			
		||||
	color?: string,
 | 
			
		||||
	logo?: string,
 | 
			
		||||
	group_id?: number,
 | 
			
		||||
	group_min_membership_level ?: "member"|"moderator"|"administrator",
 | 
			
		||||
	members: ConversationMember[],
 | 
			
		||||
	can_everyone_add_members: boolean,
 | 
			
		||||
	can_have_call: boolean,
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								assets/js/typings/Group.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								assets/js/typings/Group.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -10,7 +10,8 @@ declare interface AdvancedGroupInfo extends Group {
 | 
			
		||||
    description: String,
 | 
			
		||||
    url: String,
 | 
			
		||||
    number_likes: Number,
 | 
			
		||||
    is_liking: Boolean
 | 
			
		||||
    is_liking: Boolean,
 | 
			
		||||
    conversations: Conversation[],
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
declare interface GroupSettings extends AdvancedGroupInfo {}
 | 
			
		||||
@@ -5,6 +5,22 @@
 | 
			
		||||
    </div>
 | 
			
		||||
    
 | 
			
		||||
    <!-- /.box-body -->
 | 
			
		||||
    <div class="box-body no-padding">
 | 
			
		||||
        <table class="table">
 | 
			
		||||
            <tbody><tr>
 | 
			
		||||
                <th>Name</th>
 | 
			
		||||
                <th>Visibility</th>
 | 
			
		||||
                <th></th>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr v-for="conv in conversations">
 | 
			
		||||
                <td>{{ conv.name }}</td>
 | 
			
		||||
                <td>{{ conv.group_min_membership_level }}</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <a style="color: white;" @click="deleteConv(conv.id)"><i class="fa fa-trash"></i></a>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </tbody></table>
 | 
			
		||||
    </div>
 | 
			
		||||
    
 | 
			
		||||
    <!-- Create a new conversation-->
 | 
			
		||||
    <div class="box-footer">
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user