keyboard_shortcut: Add feedback for N/P shortcut after no more message.

Earlier navigating to the next unread topic or DM with N / P and reaching
last unread topic or dm, nothing happened when shortcut was pressed again.

This commit changes the behaviour when shortcut reaches the last topic or
dm and pressed again. Now it notifies the user that there are no more
unread messages.

Fixes zulip#27862.
This commit is contained in:
Pratik Chanda 2023-11-25 03:57:05 +05:30 committed by Tim Abbott
parent 72d46c71fb
commit d6a2bbc2ef
1 changed files with 12 additions and 0 deletions

View File

@ -815,6 +815,12 @@ export function narrow_to_next_topic(opts = {}) {
}
if (!next_narrow) {
feedback_widget.show({
populate($container) {
$container.text($t({defaultMessage: "You have no more unread topics."}));
},
title_text: $t({defaultMessage: "You're done!"}),
});
return;
}
@ -832,6 +838,12 @@ export function narrow_to_next_pm_string(opts = {}) {
const next_direct_message = topic_generator.get_next_unread_pm_string(current_direct_message);
if (!next_direct_message) {
feedback_widget.show({
populate($container) {
$container.text($t({defaultMessage: "You have no more unread direct messages."}));
},
title_text: $t({defaultMessage: "You're done!"}),
});
return;
}