mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	message_notification: Set title based on length of title.
Including content length in this calculation doesn't make sense.
This commit is contained in:
		@@ -85,7 +85,7 @@ function remove_sender_from_list_of_recipients(message) {
 | 
				
			|||||||
        .slice(", ".length, -", ".length);
 | 
					        .slice(", ".length, -", ".length);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function get_notification_title(message, content, msg_count) {
 | 
					function get_notification_title(message, msg_count) {
 | 
				
			||||||
    let title = message.sender_full_name;
 | 
					    let title = message.sender_full_name;
 | 
				
			||||||
    let other_recipients;
 | 
					    let other_recipients;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -100,8 +100,11 @@ function get_notification_title(message, content, msg_count) {
 | 
				
			|||||||
        case "private":
 | 
					        case "private":
 | 
				
			||||||
            other_recipients = remove_sender_from_list_of_recipients(message);
 | 
					            other_recipients = remove_sender_from_list_of_recipients(message);
 | 
				
			||||||
            if (message.display_recipient.length > 2) {
 | 
					            if (message.display_recipient.length > 2) {
 | 
				
			||||||
 | 
					                // Character limit taken from https://www.pushengage.com/push-notification-character-limits
 | 
				
			||||||
 | 
					                // We use a higher character limit so that the 3rd sender can at least be partially visible so that
 | 
				
			||||||
 | 
					                // the user can distinguish the group DM.
 | 
				
			||||||
                // If the message has too many recipients to list them all...
 | 
					                // If the message has too many recipients to list them all...
 | 
				
			||||||
                if (content.length + title.length + other_recipients.length > 230) {
 | 
					                if (title.length + other_recipients.length > 50) {
 | 
				
			||||||
                    // Then count how many people are in the conversation and summarize
 | 
					                    // Then count how many people are in the conversation and summarize
 | 
				
			||||||
                    // by saying the conversation is with "you and [number] other people"
 | 
					                    // by saying the conversation is with "you and [number] other people"
 | 
				
			||||||
                    other_recipients = message.display_recipient.length - 2 + " other people";
 | 
					                    other_recipients = message.display_recipient.length - 2 + " other people";
 | 
				
			||||||
@@ -137,7 +140,7 @@ export function process_notification(notification) {
 | 
				
			|||||||
        notification_object.close();
 | 
					        notification_object.close();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const title = get_notification_title(message, content, msg_count);
 | 
					    const title = get_notification_title(message, msg_count);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (notification.desktop_notify) {
 | 
					    if (notification.desktop_notify) {
 | 
				
			||||||
        const icon_url = people.small_avatar_url(message);
 | 
					        const icon_url = people.small_avatar_url(message);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user