mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
popovers.js: Add version to user avatar request.
When a user changes its avatar image, the user's avatar in popovers wasn't being correctly updated, because of browser caching of the avatar image. We added a version on the request to get the image in the same format we use elsewhere, so the browser knows when to use the cached image or to make a new request to the server. Edited by Tim to preserve/fix sort orders in some tests, and update zulip_feature_level. Fixes: #14290
This commit is contained in:
committed by
Tim Abbott
parent
9137726e38
commit
7e9024a39c
@@ -50,6 +50,7 @@ const alice = {
|
||||
email: 'alice@example.com',
|
||||
full_name: 'Alice Smith',
|
||||
user_id: 42,
|
||||
avatar_version: 5,
|
||||
is_guest: false,
|
||||
is_admin: false,
|
||||
};
|
||||
@@ -184,13 +185,16 @@ run_test('sender_hover', () => {
|
||||
});
|
||||
|
||||
$('.user_popover_email').each = noop;
|
||||
|
||||
const image_stubber = make_image_stubber();
|
||||
|
||||
window.location = {
|
||||
href: 'http://chat.zulip.org/',
|
||||
};
|
||||
const base_url = window.location.href;
|
||||
handler.call(target, e);
|
||||
|
||||
const avatar_img = image_stubber.get(0);
|
||||
assert.equal(avatar_img.src, 'avatar/42/medium');
|
||||
const expected_url = new URL('avatar/42/medium?v=' + alice.avatar_version, base_url);
|
||||
assert.equal(avatar_img.src.toString(), expected_url.toString());
|
||||
|
||||
// todo: load image
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user