mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	message_store: Add an each helper.
				
					
				
			This new helper allows us to do the same operation on every message in our message_store. We will use this in a future commit to clear the `is_tall` flags on all messages, after a resize. We should be somewhat cautious about using this, but simple operations should be really fast, even if you have lots of messages in the store.
This commit is contained in:
		@@ -184,6 +184,12 @@ run_test('update_booleans', () => {
 | 
				
			|||||||
    assert.equal(message.unread, true);
 | 
					    assert.equal(message.unread, true);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					run_test('each', () => {
 | 
				
			||||||
 | 
					    message_store.each((message) => {
 | 
				
			||||||
 | 
					        assert(message.alerted !== undefined);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
run_test('message_id_change', () => {
 | 
					run_test('message_id_change', () => {
 | 
				
			||||||
    var message = {
 | 
					    var message = {
 | 
				
			||||||
        sender_email: 'me@example.com',
 | 
					        sender_email: 'me@example.com',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,6 +7,12 @@ exports.get = function get(message_id) {
 | 
				
			|||||||
    return stored_messages[message_id];
 | 
					    return stored_messages[message_id];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					exports.each = function (f) {
 | 
				
			||||||
 | 
					    _.each(stored_messages, function (message) {
 | 
				
			||||||
 | 
					        f(message);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.get_pm_emails = function (message) {
 | 
					exports.get_pm_emails = function (message) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function email(user_id) {
 | 
					    function email(user_id) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user