Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/backend/chat/moderation/chat-moderation-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,12 @@ async function moderateMessage(chatMessage) {
}

const userExemptForUrlModeration = rolesManager.userIsInRole(chatMessage.userId, chatMessage.roles, chatModerationSettings.urlModeration.exemptRoles);
if (chatModerationSettings.urlModeration.enabled && !userExemptForUrlModeration && !permitCommand.hasTemporaryPermission(chatMessage.username)) {
if (
chatModerationSettings.urlModeration.enabled &&
!userExemptForUrlModeration &&
!permitCommand.hasTemporaryPermission(chatMessage.username) &&
!permitCommand.hasTemporaryPermission(chatMessage.userDisplayName.toLowerCase())
) {
let shouldDeleteMessage = false;
const message = chatMessage.rawText;
const regex = utils.getUrlRegex();
Expand Down
5 changes: 3 additions & 2 deletions src/backend/chat/moderation/url-permit-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ class PermitManager {
}

const target = args[0].replace("@", "");
const normalizedTarget = target.toLowerCase();
if (!target) {
await twitchChat.sendChatMessage("Please specify a user to permit.");
return;
}

this._tempPermittedUsers.push(target);
this._tempPermittedUsers.push(normalizedTarget);
logger.debug(`URL moderation: ${target} has been temporary permitted to post a URL.`);

const message = commandOptions.permitDisplayTemplate.replace("{target}", target).replace("{duration}", commandOptions.permitDuration.toString());
Expand All @@ -81,7 +82,7 @@ class PermitManager {
}

setTimeout(() => {
this._tempPermittedUsers = this._tempPermittedUsers.filter(user => user !== target);
this._tempPermittedUsers = this._tempPermittedUsers.filter(user => user !== normalizedTarget);
logger.debug(`URL moderation: Temporary URL permission for ${target} expired.`);
}, commandOptions.permitDuration * 1000);
}
Expand Down