mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 12:03:46 +00:00 
			
		
		
		
	activity: Rename function to redraw_user().
The name `insert_user_into_list` is sort of misleading, since we are often just redrawing the user's existing item in the buddy list. I chose `redraw_user` over `update_user` to emphasize that we're just going to redraw it with whatever data has been updated by the callers.
This commit is contained in:
		| @@ -537,8 +537,8 @@ run_test('first/prev/next', () => { | ||||
|  | ||||
|     buddy_list.container.append = () => {}; | ||||
|  | ||||
|     activity.insert_user_into_list(alice.user_id); | ||||
|     activity.insert_user_into_list(fred.user_id); | ||||
|     activity.redraw_user(alice.user_id); | ||||
|     activity.redraw_user(fred.user_id); | ||||
|  | ||||
|     assert.equal(buddy_list.first_key(), alice.user_id); | ||||
|     assert.equal(buddy_list.prev_key(alice.user_id), undefined); | ||||
| @@ -604,7 +604,7 @@ run_test('insert_one_user_into_empty_list', () => { | ||||
|     }; | ||||
|  | ||||
|     clear_buddy_list(); | ||||
|     activity.insert_user_into_list(alice.user_id); | ||||
|     activity.redraw_user(alice.user_id); | ||||
|     assert(appended_html.indexOf('data-user-id="1"') > 0); | ||||
|     assert(appended_html.indexOf('user_active') > 0); | ||||
| }); | ||||
| @@ -619,11 +619,11 @@ run_test('insert_alice_then_fred', () => { | ||||
|         appended_html = html; | ||||
|     }; | ||||
|  | ||||
|     activity.insert_user_into_list(alice.user_id); | ||||
|     activity.redraw_user(alice.user_id); | ||||
|     assert(appended_html.indexOf('data-user-id="1"') > 0); | ||||
|     assert(appended_html.indexOf('user_active') > 0); | ||||
|  | ||||
|     activity.insert_user_into_list(fred.user_id); | ||||
|     activity.redraw_user(fred.user_id); | ||||
|     assert(appended_html.indexOf('data-user-id="2"') > 0); | ||||
|     assert(appended_html.indexOf('user_active') > 0); | ||||
| }); | ||||
| @@ -638,7 +638,7 @@ run_test('insert_fred_then_alice_then_rename', () => { | ||||
|         appended_html = html; | ||||
|     }; | ||||
|  | ||||
|     activity.insert_user_into_list(fred.user_id); | ||||
|     activity.redraw_user(fred.user_id); | ||||
|     assert(appended_html.indexOf('data-user-id="2"') > 0); | ||||
|     assert(appended_html.indexOf('user_active') > 0); | ||||
|  | ||||
| @@ -650,7 +650,7 @@ run_test('insert_fred_then_alice_then_rename', () => { | ||||
|         inserted_html = html; | ||||
|     }; | ||||
|  | ||||
|     activity.insert_user_into_list(alice.user_id); | ||||
|     activity.redraw_user(alice.user_id); | ||||
|     assert(inserted_html.indexOf('data-user-id="1"') > 0); | ||||
|     assert(inserted_html.indexOf('user_active') > 0); | ||||
|  | ||||
| @@ -669,7 +669,7 @@ run_test('insert_fred_then_alice_then_rename', () => { | ||||
|         inserted_html = html; | ||||
|     }; | ||||
|  | ||||
|     activity.insert_user_into_list(fred_with_new_name.user_id); | ||||
|     activity.redraw_user(fred_with_new_name.user_id); | ||||
|     assert(appended_html.indexOf('data-user-id="2"') > 0); | ||||
|  | ||||
|     // restore old Fred data | ||||
| @@ -685,14 +685,14 @@ run_test('insert_unfiltered_user_with_filter', () => { | ||||
|     // match the search filter. | ||||
|     const user_filter = $('.user-list-filter'); | ||||
|     user_filter.val('do-not-match-filter'); | ||||
|     activity.insert_user_into_list(fred.user_id); | ||||
|     activity.redraw_user(fred.user_id); | ||||
| }); | ||||
|  | ||||
| run_test('realm_presence_disabled', () => { | ||||
|     page_params.realm_presence_disabled = true; | ||||
|     unread.suppress_unread_counts = false; | ||||
|  | ||||
|     activity.insert_user_into_list(); | ||||
|     activity.redraw_user(); | ||||
|     activity.build_user_sidebar(); | ||||
|  | ||||
|     real_update_huddles(); | ||||
|   | ||||
| @@ -202,7 +202,7 @@ function focus_lost() { | ||||
|     exports.has_focus = false; | ||||
| } | ||||
|  | ||||
| exports.insert_user_into_list = function (user_id) { | ||||
| exports.redraw_user = function (user_id) { | ||||
|     if (page_params.realm_presence_disabled) { | ||||
|         return; | ||||
|     } | ||||
| @@ -388,18 +388,18 @@ exports.update_presence_info = function (email, info, server_time) { | ||||
|     } | ||||
|  | ||||
|     presence.set_info_for_user(user_id, info, server_time); | ||||
|     exports.insert_user_into_list(user_id); | ||||
|     exports.redraw_user(user_id); | ||||
|     exports.update_huddles(); | ||||
| }; | ||||
|  | ||||
| exports.on_set_away = function (user_id) { | ||||
|     user_status.set_away(user_id); | ||||
|     exports.insert_user_into_list(user_id); | ||||
|     exports.redraw_user(user_id); | ||||
| }; | ||||
|  | ||||
| exports.on_revoke_away = function (user_id) { | ||||
|     user_status.revoke_away(user_id); | ||||
|     exports.insert_user_into_list(user_id); | ||||
|     exports.redraw_user(user_id); | ||||
| }; | ||||
|  | ||||
| exports.redraw = function () { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user