mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
Remove unused message_tour.js.
(imported from commit e25a9315377ad11d47ad78a5d466df40e306f713)
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
var message_tour = (function () {
|
||||
// A "message tour" starts with the first narrow from the home view,
|
||||
// continues when a user visits several narrows in a row, and ends
|
||||
// when they return to the home view. This module helps us track
|
||||
// where a user has visited during the tour.
|
||||
|
||||
// For a message tour, we keep track of messages that get visited
|
||||
// below our original starting message id. This helps us with
|
||||
// pointer positioning, knowing where the user has visited.
|
||||
// Call start_tour to start the tour.
|
||||
// Call get_tour to get a list of visited nodes.
|
||||
// Only after calling get_tour, call finish_tour to finish the tour.
|
||||
|
||||
var exports = {};
|
||||
|
||||
var ids_visited = [];
|
||||
var in_tour = false;
|
||||
var start_msg_id;
|
||||
|
||||
exports.visit = function (msg_id) {
|
||||
if (!in_tour) {
|
||||
return;
|
||||
}
|
||||
if (msg_id < start_msg_id) {
|
||||
return;
|
||||
}
|
||||
ids_visited.push(msg_id);
|
||||
};
|
||||
|
||||
exports.start_tour = function (msg_id) {
|
||||
ids_visited = [];
|
||||
start_msg_id = msg_id;
|
||||
in_tour = true;
|
||||
};
|
||||
|
||||
exports.finish_tour = function () {
|
||||
ids_visited = [];
|
||||
in_tour = false;
|
||||
};
|
||||
|
||||
exports.get_tour = function () {
|
||||
return ids_visited.slice(0);
|
||||
};
|
||||
|
||||
return exports;
|
||||
}());
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = message_tour;
|
||||
}
|
||||
@@ -25,7 +25,7 @@ var globals =
|
||||
+ ' compose compose_fade rows hotkeys narrow reload notifications_bar search subs'
|
||||
+ ' composebox_typeahead typeahead_helper notifications hashchange'
|
||||
+ ' invite ui util activity timerender MessageList MessageListView blueslip unread stream_list'
|
||||
+ ' message_edit tab_bar emoji popovers navigate message_tour settings'
|
||||
+ ' message_edit tab_bar emoji popovers navigate settings'
|
||||
+ ' avatar feature_flags search_suggestion referral stream_color Dict'
|
||||
+ ' Filter summary admin stream_data muting WinChan muting_ui Socket'
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// This is a framework-free unit test for the message_tour.js
|
||||
// module. There's a long comment there explaining the module's
|
||||
// purpose, but, briefly, it provides an API to keep track of
|
||||
// messages that you visit on a "tour."
|
||||
|
||||
var message_tour = require('js/message_tour.js');
|
||||
var assert = require('assert');
|
||||
|
||||
(function test_basic_tour() {
|
||||
message_tour.start_tour(5);
|
||||
message_tour.visit(3); // too small
|
||||
message_tour.visit(7);
|
||||
message_tour.visit(6);
|
||||
message_tour.visit(4); // too small
|
||||
assert.deepEqual(message_tour.get_tour(), [7,6]);
|
||||
message_tour.finish_tour();
|
||||
assert.deepEqual(message_tour.get_tour(), []);
|
||||
message_tour.visit(7); // should be ignored
|
||||
message_tour.start_tour(5);
|
||||
message_tour.visit(13);
|
||||
assert.deepEqual(message_tour.get_tour(), [13]);
|
||||
}());
|
||||
|
||||
@@ -496,7 +496,6 @@ JS_SPECS = {
|
||||
'js/viewport.js',
|
||||
'js/rows.js',
|
||||
'js/unread.js',
|
||||
'js/message_tour.js',
|
||||
'js/stream_list.js',
|
||||
'js/filter.js',
|
||||
'js/narrow.js',
|
||||
|
||||
Reference in New Issue
Block a user