mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-28 01:26:16 +01:00
fix: only show email confirmation warning toast on pages that it applies
This commit is contained in:
@@ -97,7 +97,6 @@ app.cacheBuster = null;
|
|||||||
});
|
});
|
||||||
|
|
||||||
createHeaderTooltips();
|
createHeaderTooltips();
|
||||||
app.showEmailConfirmWarning();
|
|
||||||
app.showCookieWarning();
|
app.showCookieWarning();
|
||||||
registerServiceWorker();
|
registerServiceWorker();
|
||||||
|
|
||||||
@@ -740,7 +739,24 @@ app.cacheBuster = null;
|
|||||||
app.showEmailConfirmWarning = async (err) => {
|
app.showEmailConfirmWarning = async (err) => {
|
||||||
const storage = await app.require('storage');
|
const storage = await app.require('storage');
|
||||||
|
|
||||||
if (!app.user.uid || parseInt(storage.getItem('email-confirm-dismiss'), 10) === 1) {
|
let showModal = false;
|
||||||
|
switch (ajaxify.data.template.name) {
|
||||||
|
case 'recent': {
|
||||||
|
showModal = !ajaxify.data.canPost;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'category': {
|
||||||
|
showModal = !ajaxify.data.privileges['topics:create'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'topic': {
|
||||||
|
showModal = !ajaxify.data.privileges['topics:reply'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!showModal || !app.user.uid || parseInt(storage.getItem('email-confirm-dismiss'), 10) === 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var msg = {
|
var msg = {
|
||||||
@@ -758,7 +774,6 @@ app.cacheBuster = null;
|
|||||||
app.removeAlert('email_confirm');
|
app.removeAlert('email_confirm');
|
||||||
ajaxify.go('user/' + app.user.userslug + '/edit/email');
|
ajaxify.go('user/' + app.user.userslug + '/edit/email');
|
||||||
};
|
};
|
||||||
app.alert(msg);
|
|
||||||
} else if (!app.user['email:confirmed'] && !app.user.isEmailConfirmSent) {
|
} else if (!app.user['email:confirmed'] && !app.user.isEmailConfirmSent) {
|
||||||
msg.message = err ? err.message : '[[error:email-not-confirmed]]';
|
msg.message = err ? err.message : '[[error:email-not-confirmed]]';
|
||||||
msg.clickfn = function () {
|
msg.clickfn = function () {
|
||||||
@@ -770,12 +785,11 @@ app.cacheBuster = null;
|
|||||||
app.alertSuccess('[[notifications:email-confirm-sent]]');
|
app.alertSuccess('[[notifications:email-confirm-sent]]');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
app.alert(msg);
|
|
||||||
} else if (!app.user['email:confirmed'] && app.user.isEmailConfirmSent) {
|
} else if (!app.user['email:confirmed'] && app.user.isEmailConfirmSent) {
|
||||||
msg.message = '[[error:email-not-confirmed-email-sent]]';
|
msg.message = '[[error:email-not-confirmed-email-sent]]';
|
||||||
app.alert(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.alert(msg);
|
||||||
};
|
};
|
||||||
|
|
||||||
app.parseAndTranslate = function (template, blockName, data, callback) {
|
app.parseAndTranslate = function (template, blockName, data, callback) {
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ define('forum/category', [
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.showEmailConfirmWarning();
|
||||||
|
|
||||||
hooks.fire('action:topics.loaded', { topics: ajaxify.data.topics });
|
hooks.fire('action:topics.loaded', { topics: ajaxify.data.topics });
|
||||||
hooks.fire('action:category.loaded', { cid: ajaxify.data.cid });
|
hooks.fire('action:category.loaded', { cid: ajaxify.data.cid });
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ define('forum/recent', ['topicList'], function (topicList) {
|
|||||||
app.enterRoom('recent_topics');
|
app.enterRoom('recent_topics');
|
||||||
|
|
||||||
topicList.init('recent');
|
topicList.init('recent');
|
||||||
|
app.showEmailConfirmWarning();
|
||||||
};
|
};
|
||||||
|
|
||||||
return Recent;
|
return Recent;
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ define('forum/topic', [
|
|||||||
$(window).on('scroll', updateTopicTitle);
|
$(window).on('scroll', updateTopicTitle);
|
||||||
|
|
||||||
handleTopicSearch();
|
handleTopicSearch();
|
||||||
|
app.showEmailConfirmWarning();
|
||||||
|
|
||||||
hooks.fire('action:topic.loaded', ajaxify.data);
|
hooks.fire('action:topic.loaded', ajaxify.data);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user