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

Commits:

1 changed file:

Changes:

  • gajim/common/helpers.py
    ... ... @@ -1175,9 +1175,11 @@ def get_groupchat_name(client: types.Client, jid: Union[str, JID]) -> str:
    1175 1175
     
    
    1176 1176
     def is_affiliation_change_allowed(self_contact: types.GroupchatParticipant,
    
    1177 1177
                                       contact: types.GroupchatParticipant,
    
    1178
    -                                  target_aff: Affiliation) -> bool:
    
    1178
    +                                  target_aff: Union[str, Affiliation]) -> bool:
    
    1179
    +    if isinstance(target_aff, str):
    
    1180
    +        target_aff = Affiliation(target_aff)
    
    1179 1181
     
    
    1180
    -    if contact.affiliation.value == target_aff:
    
    1182
    +    if contact.affiliation == target_aff:
    
    1181 1183
             # Contact has already the target affiliation
    
    1182 1184
             return False
    
    1183 1185
     
    
    ... ... @@ -1187,9 +1189,10 @@ def is_affiliation_change_allowed(self_contact: types.GroupchatParticipant,
    1187 1189
         if not self_contact.affiliation.is_admin:
    
    1188 1190
             return False
    
    1189 1191
     
    
    1190
    -    if target_aff in ('admin', 'owner'):
    
    1192
    +    if target_aff in (Affiliation.OWNER, Affiliation.ADMIN):
    
    1191 1193
             # Admin can’t edit admin/owner list
    
    1192 1194
             return False
    
    1195
    +
    
    1193 1196
         return self_contact.affiliation > contact.affiliation
    
    1194 1197
     
    
    1195 1198