mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 10:26:28 +00:00
Have "n" key skip muted topics.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
add_dependencies({
|
add_dependencies({
|
||||||
|
muting: 'js/muting',
|
||||||
stream_data: 'js/stream_data',
|
stream_data: 'js/stream_data',
|
||||||
stream_sort: 'js/stream_sort',
|
stream_sort: 'js/stream_sort',
|
||||||
unread: 'js/unread',
|
unread: 'js/unread',
|
||||||
@@ -163,7 +164,7 @@ function is_odd(i) { return i % 2 === 1; }
|
|||||||
global.stream_data.get_recent_topics = function (stream) {
|
global.stream_data.get_recent_topics = function (stream) {
|
||||||
if (stream === 'devel') {
|
if (stream === 'devel') {
|
||||||
return [
|
return [
|
||||||
{subject: 'javascript'},
|
{subject: 'muted'},
|
||||||
{subject: 'python'},
|
{subject: 'python'},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -179,8 +180,12 @@ function is_odd(i) { return i % 2 === 1; }
|
|||||||
return 999;
|
return 999;
|
||||||
};
|
};
|
||||||
|
|
||||||
global.unread.topic_has_any_unread = function (stream_id, topic) {
|
global.unread.topic_has_any_unread = function (stream_id) {
|
||||||
return (stream_id === devel_stream_id && topic === 'python');
|
return (stream_id === devel_stream_id);
|
||||||
|
};
|
||||||
|
|
||||||
|
global.muting.is_topic_muted = function (stream_name, topic) {
|
||||||
|
return (topic === 'muted');
|
||||||
};
|
};
|
||||||
|
|
||||||
var next_item = tg.get_next_topic(curr_stream, curr_topic);
|
var next_item = tg.get_next_topic(curr_stream, curr_topic);
|
||||||
|
|||||||
@@ -158,9 +158,13 @@ exports.next_topic = function (streams, get_topics, has_unread_messages, curr_st
|
|||||||
exports.get_next_topic = function (curr_stream, curr_topic) {
|
exports.get_next_topic = function (curr_stream, curr_topic) {
|
||||||
var my_streams = stream_sort.get_streams();
|
var my_streams = stream_sort.get_streams();
|
||||||
|
|
||||||
function get_topics(stream) {
|
function get_unmuted_topics(stream_name) {
|
||||||
var topics = stream_data.get_recent_topics(stream) || [];
|
var topic_objs = stream_data.get_recent_topics(stream_name) || [];
|
||||||
return _.map(topics, function (obj) { return obj.subject; });
|
var topics = _.map(topic_objs, function (obj) { return obj.subject; });
|
||||||
|
topics = _.reject(topics, function (topic) {
|
||||||
|
return muting.is_topic_muted(stream_name, topic);
|
||||||
|
});
|
||||||
|
return topics;
|
||||||
}
|
}
|
||||||
|
|
||||||
function has_unread_messages(stream_name, topic) {
|
function has_unread_messages(stream_name, topic) {
|
||||||
@@ -170,7 +174,7 @@ exports.get_next_topic = function (curr_stream, curr_topic) {
|
|||||||
|
|
||||||
return exports.next_topic(
|
return exports.next_topic(
|
||||||
my_streams,
|
my_streams,
|
||||||
get_topics,
|
get_unmuted_topics,
|
||||||
has_unread_messages,
|
has_unread_messages,
|
||||||
curr_stream,
|
curr_stream,
|
||||||
curr_topic
|
curr_topic
|
||||||
|
|||||||
Reference in New Issue
Block a user