mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
Make newly subscribed streams appear active.
When you subscribe to a stream, we now set a newly_subscribed flag on the object, and we return true during the is_active() call. This solves the problem that immediately after you subscribe, you don't have any messages in the stream, so it would appear active by our old criteria. This is still something of a workaround, as once you reload, the stream will become inactive again, unless other messages come in. A more permanent solution here would be to have the backend indicate newly subscribed streams to us (apart from the initial event), but we may not really need that in practice.
This commit is contained in:
@@ -298,6 +298,35 @@ var people = global.people;
|
||||
]);
|
||||
}());
|
||||
|
||||
(function test_is_active() {
|
||||
stream_data.clear_subscriptions();
|
||||
|
||||
var sub = {name: 'pets', subscribed: false, stream_id: 1};
|
||||
stream_data.add_sub('pets', sub);
|
||||
|
||||
assert(!stream_data.is_active(sub));
|
||||
|
||||
stream_data.subscribe_myself(sub);
|
||||
assert(stream_data.is_active(sub));
|
||||
|
||||
stream_data.unsubscribe_myself(sub);
|
||||
assert(!stream_data.is_active(sub));
|
||||
|
||||
sub = {name: 'lunch', subscribed: false, stream_id: 1};
|
||||
stream_data.add_sub('lunch', sub);
|
||||
|
||||
assert(!stream_data.is_active(sub));
|
||||
|
||||
var message = {
|
||||
stream: 'lunch',
|
||||
timestamp: 108,
|
||||
subject: 'topic2',
|
||||
};
|
||||
stream_data.process_message_for_recent_topics(message);
|
||||
|
||||
assert(stream_data.is_active(sub));
|
||||
}());
|
||||
|
||||
(function test_admin_options() {
|
||||
function make_sub() {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user