mirror of
https://github.com/wassname/talk.git
synced 2026-07-15 11:26:58 +08:00
fix: addressed link detection issue (#2660)
This commit is contained in:
committed by
Kim Gardner
parent
13853ef87e
commit
c9381c6367
@@ -1,8 +0,0 @@
|
||||
import LinkifyIt from 'linkify-it';
|
||||
import tlds from 'tlds';
|
||||
|
||||
export function createLinkify() {
|
||||
const linkify = new LinkifyIt();
|
||||
linkify.tlds(tlds);
|
||||
return linkify;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
const linkify = require('linkify-it')().tlds(require('tlds'));
|
||||
const linkify = require('linkifyjs');
|
||||
|
||||
// This phase checks the comment if it has any links in it if the check is
|
||||
// enabled.
|
||||
@@ -11,7 +11,12 @@ module.exports = (
|
||||
},
|
||||
}
|
||||
) => {
|
||||
if (premodLinksEnable && linkify.test(comment.body.replace(/\xAD/g, ''))) {
|
||||
if (premodLinksEnable) {
|
||||
const links = linkify.find(comment.body.replace(/\xAD/g, ''));
|
||||
if (!links || links.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the flag related to Trust to the comment.
|
||||
return {
|
||||
status: 'SYSTEM_WITHHELD',
|
||||
|
||||
Reference in New Issue
Block a user