mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
Merge branch 'master' into develop
This commit is contained in:
@@ -401,15 +401,18 @@ async function assertRelation(post) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function assignCategory(post) {
|
async function assignCategory(post) {
|
||||||
|
activitypub.helpers.log('[activitypub] Checking auto-categorization rules.');
|
||||||
let cid = undefined;
|
let cid = undefined;
|
||||||
const rules = await activitypub.rules.list();
|
const rules = await activitypub.rules.list();
|
||||||
const tags = await Notes._normalizeTags(post._activitypub.tag || []);
|
let tags = await Notes._normalizeTags(post._activitypub.tag || []);
|
||||||
|
tags = tags.map(tag => tag.toLowerCase());
|
||||||
|
|
||||||
cid = rules.reduce((cid, { type, value, cid: target }) => {
|
cid = rules.reduce((cid, { type, value, cid: target }) => {
|
||||||
if (!cid) {
|
if (!cid) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'hashtag': {
|
case 'hashtag': {
|
||||||
if (tags.includes(value)) {
|
if (tags.includes(value.toLowerCase())) {
|
||||||
|
activitypub.helpers.log(`[activitypub] - Rule match: #${value}; cid: ${target}`);
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user