Skip to content

Commit

Permalink
feat: Delete group as admin
Browse files Browse the repository at this point in the history
  • Loading branch information
przemvs committed Oct 29, 2024
1 parent ab9ac3c commit c943144
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,7 @@ const getConversationActions = ({
},
},
{
condition:
!isSingleUser &&
isTeam &&
roleRepository.canDeleteGroup(conversationEntity) &&
conversationEntity.isCreatedBySelf(),
condition: !isSingleUser && isTeam && roleRepository.canDeleteGroup(conversationEntity),
item: {
click: async () => actionsViewModel.deleteConversation(conversationEntity),
Icon: Icon.DeleteIcon,
Expand Down
26 changes: 11 additions & 15 deletions src/script/view_model/ActionsViewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,22 +303,18 @@ export class ActionsViewModel {
};

readonly deleteConversation = (conversationEntity: Conversation): Promise<void> => {
if (conversationEntity && conversationEntity.isCreatedBySelf()) {
return new Promise(() => {
PrimaryModal.show(PrimaryModal.type.CONFIRM, {
primaryAction: {
action: () => this.conversationRepository.deleteConversation(conversationEntity),
text: t('modalConversationDeleteGroupAction'),
},
text: {
message: t('modalConversationDeleteGroupMessage'),
title: t('modalConversationDeleteGroupHeadline', conversationEntity.display_name()),
},
});
return new Promise(() => {
PrimaryModal.show(PrimaryModal.type.CONFIRM, {
primaryAction: {
action: () => this.conversationRepository.deleteConversation(conversationEntity),
text: t('modalConversationDeleteGroupAction'),
},
text: {
message: t('modalConversationDeleteGroupMessage'),
title: t('modalConversationDeleteGroupHeadline', conversationEntity.display_name()),
},
});
}

return Promise.reject();
});
};

getConversationById = async (conversation: QualifiedId): Promise<Conversation> => {
Expand Down

0 comments on commit c943144

Please sign in to comment.