Fixed removing users always logging out

This commit is contained in:
rr- 2015-08-03 18:59:49 +02:00
parent b3def7fc21
commit ebd25cd9a9

View file

@ -58,7 +58,9 @@ App.Presenters.UserAccountRemovalPresenter = function(
} }
promise.wait(api.delete('/users/' + user.name)) promise.wait(api.delete('/users/' + user.name))
.then(function() { .then(function() {
if (user.name === auth.getCurrentUser().name) {
auth.logout(); auth.logout();
}
var $messageDiv = messagePresenter.showInfo($messages, 'Account deleted. <a href="">Back to main page</a>'); var $messageDiv = messagePresenter.showInfo($messages, 'Account deleted. <a href="">Back to main page</a>');
$messageDiv.find('a').click(mainPageLinkClicked); $messageDiv.find('a').click(mainPageLinkClicked);
}).fail(function(response) { }).fail(function(response) {