Skip to content

Commit

Permalink
fix(blacklist): allow interchat mods to blacklist people from other hubs
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed Jun 8, 2024
1 parent e279d2e commit 6c1dc76
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
21 changes: 14 additions & 7 deletions src/commands/context-menu/blacklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ import { t } from '../../utils/Locale.js';
import { colors, emojis } from '../../utils/Constants.js';
import { CustomID } from '../../utils/CustomID.js';
import { RegisterInteractionHandler } from '../../decorators/Interaction.js';
import { simpleEmbed } from '../../utils/Utils.js';
import { checkIfStaff, simpleEmbed } from '../../utils/Utils.js';
import { stripIndents } from 'common-tags';
import { logBlacklist } from '../../utils/HubLogger/ModLogs.js';
import { deleteConnections } from '../../utils/ConnectedList.js';
import Logger from '../../utils/Logger.js';

export default class Blacklist extends BaseCommand {
readonly data: RESTPostAPIApplicationCommandsJSONBody = {
Expand All @@ -40,11 +41,13 @@ export default class Blacklist extends BaseCommand {
include: { originalMsg: { include: { hub: true } } },
});

if (
!messageInDb ||
(messageInDb.originalMsg?.hub?.ownerId !== interaction.user.id &&
!messageInDb.originalMsg?.hub?.moderators.find((mod) => mod.userId === interaction.user.id))
) {
const isHubMod =
messageInDb?.originalMsg?.hub?.ownerId === interaction.user.id ||
messageInDb?.originalMsg?.hub?.moderators.find((mod) => mod.userId === interaction.user.id);

const isStaffOrHubMod = checkIfStaff(interaction.user.id) || isHubMod;

if (!messageInDb || (!isStaffOrHubMod && !checkIfStaff(interaction.user.id))) {
await interaction.reply({
embeds: [
simpleEmbed(
Expand Down Expand Up @@ -91,7 +94,7 @@ export default class Blacklist extends BaseCommand {
.setEmoji('🏠'),
);

await interaction.reply({ embeds: [embed], components: [buttons] });
await interaction.reply({ embeds: [embed], components: [buttons], ephemeral: true });
}

@RegisterInteractionHandler('blacklist')
Expand Down Expand Up @@ -229,6 +232,10 @@ export default class Blacklist extends BaseCommand {
});
}

Logger.info(
`User ${user?.username} blacklisted by ${interaction.user.username} in ${originalMsg.hubId}`,
);

await interaction.editReply({ embeds: [successEmbed], components: [] });
}

Expand Down
6 changes: 4 additions & 2 deletions src/commands/slash/Information/about.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,17 @@ export default class About extends BaseCommand {
${creditsDivider}
✨ **Design:**
${emojis.dotBlue} @${usernames[4]} (Mascot)
${emojis.dotBlue} @${usernames[6]} (Mascot)
${badgeEmojis.Developer} **Developers:**
${emojis.dotBlue} @${usernames[0]}
${emojis.dotBlue} @${usernames[1]}
${emojis.dotBlue} @${usernames[2]}
${emojis.dotBlue} @${usernames[0]}
${badgeEmojis.Staff} **Staff: ([Recruiting!](https://forms.gle/8zu7cxx4XPbEmMXJ9))**
${emojis.dotBlue} @${usernames[3]}
${emojis.dotBlue} @${usernames[4]}
${emojis.dotBlue} @${usernames[5]}
${linksDivider}
[Guide](${LINKS.DOCS}) • [Invite](https://discord.com/application-directory/769921109209907241) • [Support Server](${LINKS.SUPPORT_INVITE}) • [Vote](https://top.gg/bot/769921109209907241/vote) • [Privacy](${LINKS.DOCS}/legal/privacy) • [Terms](${LINKS.DOCS}/legal/terms)
Expand Down

0 comments on commit 6c1dc76

Please sign in to comment.