recent senders: Use message ids instead of timestamps for sorting.

This matches the convention that we use everywhere else in Zulip.

Fixes: #5956.
This commit is contained in:
Shubham Dhama
2018-02-09 01:38:24 +05:30
committed by Tim Abbott
parent ebe16e064e
commit 9cd7f59c9b
3 changed files with 35 additions and 35 deletions

View File

@@ -16,13 +16,13 @@ var rs = zrequire('recent_senders');
// New stream
var message1 = {
stream_id: stream1,
timestamp: _.uniqueId(),
id: _.uniqueId(),
subject: topic1,
sender_id: sender1,
};
var message2 = {
stream_id: stream2,
timestamp: _.uniqueId(),
id: _.uniqueId(),
subject: topic1,
sender_id: sender2,
};
@@ -45,7 +45,7 @@ var rs = zrequire('recent_senders');
// New topic
var message3 = {
stream_id: stream1,
timestamp: _.uniqueId(),
id: _.uniqueId(),
subject: topic2,
sender_id: sender3,
};
@@ -57,7 +57,7 @@ var rs = zrequire('recent_senders');
// New sender
var message4 = {
stream_id: stream1,
timestamp: _.uniqueId(),
id: _.uniqueId(),
subject: topic1,
sender_id: sender2,
};
@@ -69,7 +69,7 @@ var rs = zrequire('recent_senders');
// More recent message
var message5 = {
stream_id: stream1,
timestamp: _.uniqueId(),
id: _.uniqueId(),
subject: topic1,
sender_id: sender1,
};
@@ -81,19 +81,19 @@ var rs = zrequire('recent_senders');
// Same stream, but different topics
var message6 = {
stream_id: stream3,
timestamp: _.uniqueId(),
id: _.uniqueId(),
subject: topic1,
sender_id: sender1,
};
var message7 = {
stream_id: stream3,
timestamp: _.uniqueId(),
id: _.uniqueId(),
subject: topic2,
sender_id: sender2,
};
var message8 = {
stream_id: stream3,
timestamp: _.uniqueId(),
id: _.uniqueId(),
subject: topic3,
sender_id: sender3,
};

View File

@@ -180,19 +180,19 @@ _.each(matches, function (person) {
sender_id : 7,
stream_id : 1,
subject : "Dev Topic",
timestamp : _.uniqueId(),
id : _.uniqueId(),
});
global.recent_senders.process_message_for_senders({
sender_id : 5,
stream_id : 1,
subject : "Dev Topic",
timestamp : _.uniqueId(),
id : _.uniqueId(),
});
global.recent_senders.process_message_for_senders({
sender_id : 6,
stream_id : 1,
subject : "Dev Topic",
timestamp : _.uniqueId(),
id : _.uniqueId(),
});
// Typeahead for stream message [query, stream-name, topic-name]
@@ -210,13 +210,13 @@ _.each(matches, function (person) {
sender_id : 5,
stream_id : 2,
subject : "Linux Topic",
timestamp : _.uniqueId(),
id : _.uniqueId(),
});
global.recent_senders.process_message_for_senders({
sender_id : 7,
stream_id : 2,
subject : "Linux Topic",
timestamp : _.uniqueId(),
id : _.uniqueId(),
});
// No match