notifications: Collapse blockquotes and "user said" paragraphs.

Since notifications have limited space for the contents of a message,
a quote from a previous message, or elsewhere, can take up most of the
notification, leaving little room for the actual message, and reducing
the usefulness of the notification.

To fix this, we collapse blockquotes and "user said" paragraphs to make
space for the actual message.
This commit is contained in:
N-Shar-ma
2024-01-23 00:33:18 +05:30
committed by Tim Abbott
parent 727774a0e5
commit adddb3d54f
6 changed files with 174 additions and 0 deletions

View File

@@ -34,6 +34,18 @@ export function get_current_hash_section(): string {
return get_hash_section(window.location.hash);
}
export function is_same_server_message_link(url: string): boolean {
// A same server message link always has category `narrow`,
// section `stream` or `dm`, and ends with `/near/<message_id>`,
// where <message_id> is a sequence of digits.
return (
get_hash_category(url) === "narrow" &&
(get_hash_section(url) === "stream" || get_hash_section(url) === "dm") &&
get_nth_hash_section(url, -2) === "near" &&
/^\d+$/.test(get_nth_hash_section(url, -1))
);
}
export function is_overlay_hash(hash: string): boolean {
// Hash changes within this list are overlays and should not unnarrow (etc.)
const overlay_list = [