mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-15 18:26:15 +01:00
closes #4975
This commit is contained in:
@@ -216,11 +216,7 @@ $(document).ready(function() {
|
||||
return url;
|
||||
};
|
||||
|
||||
ajaxify.refresh = function(e, callback) {
|
||||
if (e && e instanceof jQuery.Event) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
ajaxify.refresh = function(callback) {
|
||||
ajaxify.go(ajaxify.currentPage + window.location.search + window.location.hash, callback, true);
|
||||
};
|
||||
|
||||
|
||||
@@ -2,12 +2,10 @@
|
||||
|
||||
/* globals define, ajaxify, socket, app, config, templates, bootbox */
|
||||
|
||||
define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'], function(header, uploader, translator) {
|
||||
var AccountEdit = {},
|
||||
uploadedPicture = '';
|
||||
define('forum/account/edit', ['forum/account/header', 'uploader', 'translator', 'components'], function(header, uploader, translator, components) {
|
||||
var AccountEdit = {};
|
||||
|
||||
AccountEdit.init = function() {
|
||||
uploadedPicture = ajaxify.data.uploadedpicture;
|
||||
|
||||
header.init();
|
||||
|
||||
@@ -59,7 +57,6 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
||||
}
|
||||
|
||||
function updateHeader(picture) {
|
||||
require(['components'], function(components) {
|
||||
if (parseInt(ajaxify.data.theirid, 10) !== parseInt(ajaxify.data.yourid, 10)) {
|
||||
return;
|
||||
}
|
||||
@@ -69,7 +66,6 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
||||
if (picture) {
|
||||
components.get('header/userpicture').attr('src', picture);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handleImageChange() {
|
||||
@@ -137,8 +133,8 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
||||
}
|
||||
|
||||
function saveSelection() {
|
||||
var type = modal.find('.list-group-item.active').attr('data-type'),
|
||||
src = modal.find('.list-group-item.active img').attr('src');
|
||||
var type = modal.find('.list-group-item.active').attr('data-type');
|
||||
|
||||
changeUserPicture(type, function(err) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
@@ -192,15 +188,17 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
||||
|
||||
function handleImageUpload(modal) {
|
||||
function onUploadComplete(urlOnServer) {
|
||||
urlOnServer = urlOnServer + '?' + new Date().getTime();
|
||||
urlOnServer = urlOnServer + '?' + Date.now();
|
||||
|
||||
updateHeader(urlOnServer);
|
||||
|
||||
if (ajaxify.data.picture.length) {
|
||||
$('#user-current-picture, img.avatar').attr('src', urlOnServer);
|
||||
uploadedPicture = urlOnServer;
|
||||
ajaxify.data.uploadedpicture = urlOnServer;
|
||||
} else {
|
||||
ajaxify.refresh();
|
||||
ajaxify.refresh(function() {
|
||||
$('#user-current-picture, img.avatar').attr('src', urlOnServer);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user