mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: #12452, fix admin/mod image change
so it doesn't update the image in the header
This commit is contained in:
@@ -94,7 +94,10 @@ define('accounts/picture', [
|
|||||||
const iconBgColor = document.querySelector('.modal.picture-switcher input[type="radio"]:checked').value || 'transparent';
|
const iconBgColor = document.querySelector('.modal.picture-switcher input[type="radio"]:checked').value || 'transparent';
|
||||||
|
|
||||||
changeUserPicture(type, iconBgColor).then(() => {
|
changeUserPicture(type, iconBgColor).then(() => {
|
||||||
Picture.updateHeader(type === 'default' ? '' : modal.find('.list-group-item.active img').attr('src'), iconBgColor);
|
Picture.updateHeader(
|
||||||
|
type === 'default' ? '' : modal.find('.list-group-item.active img').attr('src'),
|
||||||
|
iconBgColor
|
||||||
|
);
|
||||||
ajaxify.refresh();
|
ajaxify.refresh();
|
||||||
}).catch(alerts.error);
|
}).catch(alerts.error);
|
||||||
}
|
}
|
||||||
@@ -139,16 +142,17 @@ define('accounts/picture', [
|
|||||||
|
|
||||||
function handleImageUpload(modal) {
|
function handleImageUpload(modal) {
|
||||||
function onUploadComplete(urlOnServer) {
|
function onUploadComplete(urlOnServer) {
|
||||||
urlOnServer = (!urlOnServer.startsWith('http') ? config.relative_path : '') + urlOnServer + '?' + Date.now();
|
urlOnServer = (!urlOnServer.startsWith('http') ? config.relative_path : '') + urlOnServer;
|
||||||
|
const cacheBustedUrl = urlOnServer + '?' + Date.now();
|
||||||
Picture.updateHeader(urlOnServer);
|
Picture.updateHeader(cacheBustedUrl);
|
||||||
|
|
||||||
if (ajaxify.data.picture && ajaxify.data.picture.length) {
|
if (ajaxify.data.picture && ajaxify.data.picture.length) {
|
||||||
$('#user-current-picture, img.avatar').attr('src', urlOnServer);
|
$(`#user-current-picture, img[data-uid="${ajaxify.data.theirid}"].avatar`).attr('src', cacheBustedUrl);
|
||||||
ajaxify.data.uploadedpicture = urlOnServer;
|
ajaxify.data.uploadedpicture = urlOnServer;
|
||||||
|
ajaxify.data.picture = urlOnServer;
|
||||||
} else {
|
} else {
|
||||||
ajaxify.refresh(function () {
|
ajaxify.refresh(function () {
|
||||||
$('#user-current-picture, img.avatar').attr('src', urlOnServer);
|
$(`#user-current-picture, img[data-uid="${ajaxify.data.theirid}"].avatar`).attr('src', cacheBustedUrl);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user