Philipp Hörist pushed to branch master at gajim / gajim

Commits:

1 changed file:

Changes:

  • gajim/gtk/chat_list_stack.py
    ... ... @@ -251,31 +251,38 @@ def remove_chat(self, workspace_id: str, account: str, jid: JID) -> None:
    251 251
             chat_list = self._chat_lists[workspace_id]
    
    252 252
             type_ = chat_list.get_chat_type(account, jid)
    
    253 253
     
    
    254
    -        def _leave(is_checked: bool) -> None:
    
    255
    -            if is_checked:
    
    254
    +        def _leave(not_ask_again: bool) -> None:
    
    255
    +            if not_ask_again:
    
    256 256
                     app.settings.set('confirm_close_muc', False)
    
    257
    +            _remove()
    
    257 258
     
    
    259
    +        def _remove() -> None:
    
    258 260
                 chat_list.remove_chat(account, jid, emit_unread=False)
    
    259 261
                 self.store_open_chats(workspace_id)
    
    260 262
                 self.emit('chat-removed', account, jid, type_)
    
    261 263
     
    
    262
    -        if type_ == 'groupchat' and app.settings.get('confirm_close_muc'):
    
    263
    -            client = app.get_client(account)
    
    264
    -            contact = client.get_module('Contacts').get_group_chat_contact(jid)
    
    265
    -            ConfirmationCheckDialog(
    
    266
    -                _('Leave Group Chat'),
    
    267
    -                _('Are you sure you want to leave this group chat?'),
    
    268
    -                _('If you close this chat, you will leave '
    
    269
    -                  '"%s".') % contact.name,
    
    270
    -                _('_Do not ask me again'),
    
    271
    -                [DialogButton.make('Cancel'),
    
    272
    -                 DialogButton.make('Accept',
    
    273
    -                                   text=_('_Leave'),
    
    274
    -                                   callback=_leave)],
    
    275
    -                transient_for=app.window).show()
    
    264
    +        if type_ != 'groupchat' or not app.settings.get('confirm_close_muc'):
    
    265
    +            _remove()
    
    276 266
                 return
    
    277 267
     
    
    278
    -        _leave(True)
    
    268
    +        client = app.get_client(account)
    
    269
    +        contact = client.get_module('Contacts').get_group_chat_contact(jid)
    
    270
    +
    
    271
    +        if contact.is_not_joined:
    
    272
    +            _remove()
    
    273
    +            return
    
    274
    +
    
    275
    +        ConfirmationCheckDialog(
    
    276
    +            _('Leave Group Chat'),
    
    277
    +            _('Are you sure you want to leave this group chat?'),
    
    278
    +            _('If you close this chat, you will leave '
    
    279
    +              '"%s".') % contact.name,
    
    280
    +            _('_Do not ask me again'),
    
    281
    +            [DialogButton.make('Cancel'),
    
    282
    +             DialogButton.make('Accept',
    
    283
    +                               text=_('_Leave'),
    
    284
    +                               callback=_leave)],
    
    285
    +            transient_for=app.window).show()
    
    279 286
     
    
    280 287
         def remove_chats_for_account(self, account: str) -> None:
    
    281 288
             for workspace_id, chat_list in self._chat_lists.items():