refactor: use alerts.error/success

This commit is contained in:
Barış Soner Uşaklı
2021-12-06 14:31:35 -05:00
parent 4f4236101b
commit cba78aee16
84 changed files with 406 additions and 382 deletions

View File

@@ -61,7 +61,7 @@ define('forum/topic/threadTools', [
.then(function () {
eventEl.remove();
})
.catch(app.alertError);
.catch(alerts.error);
}
});
});
@@ -70,7 +70,7 @@ define('forum/topic/threadTools', [
topicContainer.on('click', '[component="topic/mark-unread"]', function () {
socket.emit('topics.markUnread', tid, function (err) {
if (err) {
return app.alertError(err);
return alerts.error(err);
}
if (app.previousUrl && !app.previousUrl.match('^/topic')) {
@@ -81,7 +81,7 @@ define('forum/topic/threadTools', [
ajaxify.go('category/' + ajaxify.data.category.slug, handleBack.onBackClicked);
}
app.alertSuccess('[[topic:mark_unread.success]]');
alerts.success('[[topic:mark_unread.success]]');
});
return false;
});
@@ -90,9 +90,9 @@ define('forum/topic/threadTools', [
const btn = $(this);
socket.emit('topics.markAsUnreadForAll', [tid], function (err) {
if (err) {
return app.alertError(err.message);
return alerts.error(err);
}
app.alertSuccess('[[topic:markAsUnreadForAll.success]]');
alerts.success('[[topic:markAsUnreadForAll.success]]');
btn.parents('.thread-tools.open').find('.dropdown-toggle').trigger('click');
});
return false;
@@ -182,7 +182,7 @@ define('forum/topic/threadTools', [
socket.emit('topics.loadTopicTools', { tid: ajaxify.data.tid, cid: ajaxify.data.cid }, function (err, data) {
if (err) {
return app.alertError(err);
return alerts.error(err);
}
app.parseAndTranslate('partials/topic/topic-menu-list', data, function (html) {
dropdownMenu.html(html);
@@ -204,7 +204,7 @@ define('forum/topic/threadTools', [
if (ok) {
api[method](`/topics/${tid}${path}`, body)
.then(onComplete)
.catch(app.alertError);
.catch(alerts.error);
}
};
@@ -256,7 +256,7 @@ define('forum/topic/threadTools', [
body.expiry = expiry.getTime();
onSuccess();
} else {
app.alertError('[[error:invalid-date]]');
alerts.error('[[error:invalid-date]]');
}
},
},