Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Feedback from review
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnuxie committed Jul 5, 2022
1 parent 76847d3 commit a757a8d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/SlashCommands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -799,9 +799,9 @@ export const Commands = [
if (args) {
const cli = MatrixClientPeg.get();

const matches = args.match(/^(@[^:]+:\S+)$/);
if (matches) {
const userId = matches[1];
const userMatches = args.match(/^(@[^:]+:\S+)$/);
if (userMatches) {
const userId = userMatches[1];
const ignoredUsers = cli.getIgnoredUsers();
ignoredUsers.push(userId); // de-duped internally in the js-sdk
return success(
Expand All @@ -822,10 +822,16 @@ export const Commands = [
if (ignoredInvites.ignored_rooms === undefined) {
ignoredInvites.ignored_rooms = [];
}
ignoredInvites.ignored_rooms.push({
room_id: roomId,
ts: Date.now(), // TODO: Check this is the timestamp we want?
}); // TODO: figure out whether we're deduplicating or not https://github.com/matrix-org/matrix-js-sdk/pull/2483#discussion_r913013654
const isAlreadyIgnored = Boolean(ignoredInvites.ignored_rooms
.find(ignoredRoom => ignoredRoom.room_id === roomId));
// Doesn't feel right that we don't tell them it is already ignored
// but that's what the user ignore does too so *shrug*
if (!isAlreadyIgnored) {
ignoredInvites.ignored_rooms.push({
room_id: roomId,
ts: Date.now(), // TODO: Check this is the timestamp we want?
});
}
return success(
cli.setIgnoredInvites(ignoredInvites).then(() => {
Modal.createDialog(InfoDialog, {
Expand Down

0 comments on commit a757a8d

Please sign in to comment.