mirror of https://github.com/zulip/zulip.git
Extract code to summary.js.
(imported from commit 51d958b27e53555f5f77d6e6b661eade57190e23)
This commit is contained in:
parent
02dba3da11
commit
d27feeed62
|
@ -0,0 +1,27 @@
|
|||
var summary = (function () {
|
||||
|
||||
// This module has helper functions for the August 2013 message
|
||||
// summarizing experiment.
|
||||
|
||||
var exports = {};
|
||||
|
||||
exports.maybe_mark_summarized = function (message) {
|
||||
if (feature_flags.summarize_read_while_narrowed) {
|
||||
if (narrow.narrowed_by_reply()) {
|
||||
// Narrowed to a topic or PM recipient
|
||||
send_summarize_in_stream(message);
|
||||
}
|
||||
|
||||
if (narrow.active() && !narrow.narrowed_to_search()) {
|
||||
// Narrowed to anything except a search
|
||||
send_summarize_in_home(message);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return exports;
|
||||
}());
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = summary;
|
||||
}
|
|
@ -340,20 +340,6 @@ function process_loaded_for_unread(messages) {
|
|||
update_unread_counts();
|
||||
}
|
||||
|
||||
function maybe_mark_summarized(message) {
|
||||
if (feature_flags.summarize_read_while_narrowed) {
|
||||
if (narrow.narrowed_by_reply()) {
|
||||
// Narrowed to a topic or PM recipient
|
||||
send_summarize_in_stream(message);
|
||||
}
|
||||
|
||||
if (narrow.active() && !narrow.narrowed_to_search()) {
|
||||
// Narrowed to anything except a search
|
||||
send_summarize_in_home(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Takes a list of messages and marks them as read
|
||||
function mark_messages_as_read(messages, options) {
|
||||
options = options || {};
|
||||
|
@ -366,7 +352,7 @@ function mark_messages_as_read(messages, options) {
|
|||
}
|
||||
|
||||
send_read(message);
|
||||
maybe_mark_summarized(message);
|
||||
summary.maybe_mark_summarized(message);
|
||||
|
||||
message.unread = false;
|
||||
unread.process_read_message(message, options);
|
||||
|
@ -877,7 +863,7 @@ function get_updates_success(data) {
|
|||
if (feature_flags.summarize_read_while_narrowed) {
|
||||
_.each(messages, function (message) {
|
||||
if (message.sent_by_me) {
|
||||
maybe_mark_summarized(message);
|
||||
summary.maybe_mark_summarized(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ var globals =
|
|||
+ ' invite ui util activity timerender MessageList blueslip unread stream_list'
|
||||
+ ' onboarding message_edit tab_bar emoji popovers navigate message_tour'
|
||||
+ ' avatar feature_flags search_suggestion referral stream_color Dict'
|
||||
+ ' Filter'
|
||||
+ ' Filter summary'
|
||||
|
||||
// colorspace.js
|
||||
+ ' colorspace'
|
||||
|
@ -55,6 +55,8 @@ var globals =
|
|||
+ ' add_message_metadata'
|
||||
+ ' respond_to_cursor'
|
||||
+ ' mark_message_as_read'
|
||||
+ ' send_summarize_in_home'
|
||||
+ ' send_summarize_in_stream'
|
||||
;
|
||||
|
||||
|
||||
|
|
|
@ -362,6 +362,7 @@ JS_SPECS = {
|
|||
else 'third/handlebars/handlebars.js'),
|
||||
|
||||
'js/feature_flags.js',
|
||||
'js/summary.js',
|
||||
'js/util.js',
|
||||
'js/dict.js',
|
||||
'js/setup.js',
|
||||
|
|
Loading…
Reference in New Issue