mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	logging: Switch various logging code paths to use user IDs.
This fixes EMAIL_ADDRESS_VISIBILITY_ADMINS support as well as being more reliable/stable over time.
This commit is contained in:
		@@ -213,8 +213,8 @@ def send_to_missed_message_address(address: str, message: message.Message) -> No
 | 
				
			|||||||
    else:
 | 
					    else:
 | 
				
			||||||
        raise AssertionError("Invalid recipient type!")
 | 
					        raise AssertionError("Invalid recipient type!")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    logger.info("Successfully processed email from %s to %s" % (
 | 
					    logger.info("Successfully processed email from user %s to %s" % (
 | 
				
			||||||
        user_profile.email, recipient_str))
 | 
					        user_profile.id, recipient_str))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Sending the Zulip ##
 | 
					## Sending the Zulip ##
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -235,7 +235,7 @@ def fix_pre_pointer(cursor: CursorObj, user_profile: UserProfile) -> None:
 | 
				
			|||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def fix(user_profile: UserProfile) -> None:
 | 
					def fix(user_profile: UserProfile) -> None:
 | 
				
			||||||
    logger.info('\n---\nFixing %s:' % (user_profile.email,))
 | 
					    logger.info('\n---\nFixing %s:' % (user_profile.id,))
 | 
				
			||||||
    with connection.cursor() as cursor:
 | 
					    with connection.cursor() as cursor:
 | 
				
			||||||
        fix_unsubscribed(cursor, user_profile)
 | 
					        fix_unsubscribed(cursor, user_profile)
 | 
				
			||||||
        fix_pre_pointer(cursor, user_profile)
 | 
					        fix_pre_pointer(cursor, user_profile)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,5 +51,5 @@ def delete_all_deactivated_user_sessions() -> None:
 | 
				
			|||||||
            continue
 | 
					            continue
 | 
				
			||||||
        user_profile = get_user_profile_by_id(user_profile_id)
 | 
					        user_profile = get_user_profile_by_id(user_profile_id)
 | 
				
			||||||
        if not user_profile.is_active or user_profile.realm.deactivated:
 | 
					        if not user_profile.is_active or user_profile.realm.deactivated:
 | 
				
			||||||
            logging.info("Deactivating session for deactivated user %s" % (user_profile.email,))
 | 
					            logging.info("Deactivating session for deactivated user %s" % (user_profile.id,))
 | 
				
			||||||
            delete_session(session)
 | 
					            delete_session(session)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,7 @@ def transfer_avatars_to_s3(processes: int) -> None:
 | 
				
			|||||||
        try:
 | 
					        try:
 | 
				
			||||||
            with open(file_path, 'rb') as f:
 | 
					            with open(file_path, 'rb') as f:
 | 
				
			||||||
                s3backend.upload_avatar_image(f, user, user)
 | 
					                s3backend.upload_avatar_image(f, user, user)
 | 
				
			||||||
                logging.info("Uploaded avatar for {} in realm {}".format(user.email, user.realm.name))
 | 
					                logging.info("Uploaded avatar for {} in realm {}".format(user.id, user.realm.name))
 | 
				
			||||||
        except FileNotFoundError:
 | 
					        except FileNotFoundError:
 | 
				
			||||||
            pass
 | 
					            pass
 | 
				
			||||||
        return 0
 | 
					        return 0
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user