-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unlogtext command #2645
Add unlogtext command #2645
Conversation
commands.js
Outdated
@@ -1891,7 +1891,28 @@ exports.commands = { | |||
if (userid !== toId(this.inputUsername)) this.add('|unlink|' + hidetype + toId(this.inputUsername)); | |||
}, | |||
hidetexthelp: ["/hidetext [username] - Removes a locked or banned user's messages from chat (includes users banned from the room). Requires: % (global only), @ * # & ~"], | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't remove this empty line
Did you test this command? Because it doesn't work... |
commands.js
Outdated
} | ||
if (!targetUser) return this.errorReply("User '" + name + "' not found."); | ||
if (!(targetUser.locked || (room.bannedUsers[toId(name)] && room.bannedIps[targetUser.latestIp]) || user.can('rangeban'))) return this.errorReply("User '" + name + "' is not banned from this room or locked."); | ||
let roomlog = room.log.split(","); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CRASH: TypeError: room.log.split is not a function
If this command gets added, it definitely shouldn't be given to global drivers... Also, it doesn't modlog that someone cleared someone's messages, which is a huge security risk. |
commands.js
Outdated
}, | ||
unlogtexthelp: ["/unlogtext [username] - Removes a locked or banned user's messages from chat and clears them from the room's log. Requires: % (global only), @ * # & ~"], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's trailing whitespace here
I added a modlog thing...what users should have access to it then? |
I would say leaders and administrators probably |
Also, you can probably squash these commits |
Squashed |
commands.js
Outdated
this.splitTarget(target); | ||
let targetUser = this.targetUser; | ||
let name = this.targetUserName; | ||
if (!user.can("rangeban")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not overload permissions. Add a new separate one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I based the permissions checking and other setup checks on the hidetext command, which uses user.can("roomban"). If I need to make a new permission I can but I think the two actions are related closely enough that sharing the permission should suffice.
I tested it and it worked... |
|
The way I think I originally thought of this feature was as a side effect of roomban and lock. The text is still visible in the log files, but wouldn't appear to users joining the room in the future. One of the consequences is that it would be harder for trolls/spammers to really know if their attacks successfully went through. Maybe an |
I'm actually fairly certain it won't delete the text from the log files, just the log that future users see. So basically, exactly your idea. |
Might want to double check how and when the logs are written (I don't know either) |
Oh, I know your implementation doesn't. |
commands.js
Outdated
let message = room.log[i]; | ||
let split = message.split("|"); | ||
if (Users.get(split[3]) === this.targetUser || Users.get(split[3]).getAltUsers().indexOf(this.targetUser) >= 0) { | ||
room.log.splice(i, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You still end up skipping a log entry for each one you remove. Think carefully how room.log
changes in respect to i
when you splice(i, 1)
it, and what happens in the next loop iteration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yeah i see what you're talking about. I'll fix that
You still haven't properly addressed my other three comments |
commands.js
Outdated
if (!targetUser) return this.errorReply("User '" + name + "' not found."); | ||
if (!(targetUser.locked || (room.bannedUsers[toId(name)] && room.bannedIps[targetUser.latestIp]) || user.can('rangeban'))) return this.errorReply("User '" + name + "' is not banned from this room or locked."); | ||
let i = 0; | ||
while(i < room.log.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Travis is complaining about the missing space between while
and the paren
tbh my main issue is that I don't know exactly how this should be implemented, and there doesn't seem to be much consensus, either. |
Sorry for not responding, I've been away. I'll get back to this soon... |
This is in tandem with smogon/pokemon-showdown#2645, and makes regular users unable to unhide text from banned users. Staff (moderator and up) retain this ability.
The unlogtext command clears a banned user's messages from the chat logs, which is useful if they leaked something sensitive/private. This was partially suggested in the issues file under "Fixes to text hiding."
let targetUser = this.targetUser; | ||
let name = this.targetUserName; | ||
let userid = targetUser.getLastId(); | ||
if (!user.can("rangeban")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not !this.can("rangeban")
?
This PR seems to be abandoned, and I think I know how I would go about this if it'd be okay if I were to take over:
Also, what permission should this actually bet set to? I know I had said driver was probably a bad idea, but maybe just handle it like hidetext and allow drivers to if the user has been locked or roombanned. Thoughts on this proposal? |
This is blocked by a database refactor; I'd suggest waiting until then. |
Okay then |
I'm just going to close this. I appreciate the effort here, but what I was looking for in Ideas for New Developers was an unlogging function to supplement existing |
The unlogtext command clears a banned user's messages from the room such that regular users can no longer see them (staff still can), which is useful if they leaked something sensitive/private. This was partially suggested in the issues file under "Fixes to text hiding." #2444