we have to remove group from contact instances before removing them from roster so that gajim.groups in cleaned up. Fixes #1778
This commit is contained in:
		
							parent
							
								
									4849c2f815
								
							
						
					
					
						commit
						e3fb6c2607
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -2503,17 +2503,19 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
 | 
				
			||||||
		elif type == 'group':
 | 
							elif type == 'group':
 | 
				
			||||||
			# in C_JID column, we hold the group name (which is not escaped)
 | 
								# in C_JID column, we hold the group name (which is not escaped)
 | 
				
			||||||
			old_name = model[iter][C_JID].decode('utf-8')
 | 
								old_name = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
			# Groups may not change name from or to 'Not in Roster'
 | 
								# Groups may not change name from or to 'Not in Roster' nor Transports
 | 
				
			||||||
			if _('Not in Roster') in (new_text, old_name):
 | 
								if _('Not in Roster') in (new_text, old_name):
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
 | 
								if _('Transports') in (new_text, old_name):
 | 
				
			||||||
 | 
									return
 | 
				
			||||||
			# get all contacts in that group
 | 
								# get all contacts in that group
 | 
				
			||||||
			for jid in gajim.contacts.get_jid_list(account):
 | 
								for jid in gajim.contacts.get_jid_list(account):
 | 
				
			||||||
				contact = gajim.contacts.get_contact_with_highest_priority(account,
 | 
									contact = gajim.contacts.get_contact_with_highest_priority(account,
 | 
				
			||||||
					jid)
 | 
										jid)
 | 
				
			||||||
				if old_name in contact.groups:
 | 
									if old_name in contact.groups:
 | 
				
			||||||
					# set them in the new one and remove it from the old
 | 
										# set them in the new one and remove it from the old
 | 
				
			||||||
					self.remove_contact(contact, account)
 | 
					 | 
				
			||||||
					contact.groups.remove(old_name)
 | 
										contact.groups.remove(old_name)
 | 
				
			||||||
 | 
										self.remove_contact(contact, account)
 | 
				
			||||||
					contact.groups.append(new_text)
 | 
										contact.groups.append(new_text)
 | 
				
			||||||
					self.add_contact_to_roster(contact.jid, account)
 | 
										self.add_contact_to_roster(contact.jid, account)
 | 
				
			||||||
					gajim.connections[account].update_contact(contact.jid,
 | 
										gajim.connections[account].update_contact(contact.jid,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue