mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: closes #10601, ability to prevent alerts on topic list
This commit is contained in:
@@ -101,15 +101,18 @@ define('topicList', [
|
|||||||
const category = d.template.category &&
|
const category = d.template.category &&
|
||||||
parseInt(d.cid, 10) !== parseInt(data.cid, 10);
|
parseInt(d.cid, 10) !== parseInt(data.cid, 10);
|
||||||
|
|
||||||
if (categories || filterWatched || category || scheduledTopics.includes(data.tid)) {
|
const preventAlert = !!(categories || filterWatched || category || scheduledTopics.includes(data.tid));
|
||||||
return;
|
hooks.fire('filter:topicList.onNewTopic', { topic: data, preventAlert }).then((result) => {
|
||||||
}
|
if (result.preventAlert) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.scheduled && data.tid) {
|
if (data.scheduled && data.tid) {
|
||||||
scheduledTopics.push(data.tid);
|
scheduledTopics.push(data.tid);
|
||||||
}
|
}
|
||||||
newTopicCount += 1;
|
newTopicCount += 1;
|
||||||
updateAlertText();
|
updateAlertText();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onNewPost(data) {
|
function onNewPost(data) {
|
||||||
@@ -132,12 +135,15 @@ define('topicList', [
|
|||||||
const category = d.template.category &&
|
const category = d.template.category &&
|
||||||
parseInt(d.cid, 10) !== parseInt(post.topic.cid, 10);
|
parseInt(d.cid, 10) !== parseInt(post.topic.cid, 10);
|
||||||
|
|
||||||
if (isMain || categories || filterNew || filterWatched || category) {
|
const preventAlert = !!(isMain || categories || filterNew || filterWatched || category);
|
||||||
return;
|
hooks.fire('filter:topicList.onNewPost', { post, preventAlert }).then((result) => {
|
||||||
}
|
if (result.preventAlert) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
newPostCount += 1;
|
newPostCount += 1;
|
||||||
updateAlertText();
|
updateAlertText();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateAlertText() {
|
function updateAlertText() {
|
||||||
|
|||||||
Reference in New Issue
Block a user