mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	invite: Fix invitations removed from list too soon.
On invitations panel, invites were being removed when the user clicked on invitation's link. Now we only remove it when the user completes registration. Fixes: #12281
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							de00c3cd6a
						
					
				
				
					commit
					4680d504de
				
			@@ -43,7 +43,8 @@ def generate_key() -> str:
 | 
			
		||||
 | 
			
		||||
ConfirmationObjT = Union[MultiuseInvite, PreregistrationUser, EmailChangeStatus]
 | 
			
		||||
def get_object_from_key(confirmation_key: str,
 | 
			
		||||
                        confirmation_type: int) -> ConfirmationObjT:
 | 
			
		||||
                        confirmation_type: int,
 | 
			
		||||
                        activate_object: bool=True) -> ConfirmationObjT:
 | 
			
		||||
    # Confirmation keys used to be 40 characters
 | 
			
		||||
    if len(confirmation_key) not in (24, 40):
 | 
			
		||||
        raise ConfirmationKeyException(ConfirmationKeyException.WRONG_LENGTH)
 | 
			
		||||
@@ -58,7 +59,7 @@ def get_object_from_key(confirmation_key: str,
 | 
			
		||||
        raise ConfirmationKeyException(ConfirmationKeyException.EXPIRED)
 | 
			
		||||
 | 
			
		||||
    obj = confirmation.content_object
 | 
			
		||||
    if hasattr(obj, "status"):
 | 
			
		||||
    if activate_object and hasattr(obj, "status"):
 | 
			
		||||
        obj.status = getattr(settings, 'STATUS_ACTIVE', 1)
 | 
			
		||||
        obj.save(update_fields=['status'])
 | 
			
		||||
    return obj
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user