-
-
Notifications
You must be signed in to change notification settings - Fork 431
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 option to delete a user's messages #4362
Conversation
This is ready for TESTING, please TEST this feature before merging it |
#include <QTextEdit> | ||
|
||
const QColor DEFAULT_MENTION_COLOR = QColor(194, 31, 47); | ||
|
||
UserMessagePosition::UserMessagePosition(QTextCursor &cursor) | ||
{ |
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.
What does this function do? I'm confused
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.
it's the constructor for the message position, it saves the block and the position in the block it references
UserLevelFlags userLevel, | ||
QString UserPrivLevel, | ||
bool playerBold) | ||
{ | ||
bool atBottom = verticalScrollBar()->value() >= verticalScrollBar()->maximum(); | ||
bool sameSender = (sender == lastSender) && !lastSender.isEmpty(); | ||
// messageType should be Event_RoomSay::UserMessage though we don't actually check | ||
bool isUserMessage = !(userName.toLower() == "servatrice" || userName.isEmpty()); |
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.
double hardcoded name, make into a const
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 don't like this name to begin with, I wanted to leave this check as similar as possible, when is "servatrice" talking anyway? only when the user talks or will it actually set it to servatrice otherwise?
|
||
// timestamp | ||
if (showTimestamps && (!sameSender || sender.toLower() == "servatrice") && !sender.isEmpty()) { | ||
if (showTimestamps && ((!sameSender && isUserMessage) || userName.toLower() == "servatrice")) { |
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.
better comments, i don't understand this
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.
it's better than the previous check
bool removedLastMessage = false; | ||
QTextCursor cursor(document()); | ||
for (; !messagePositions.isEmpty() && amount != 0; --amount) { | ||
auto position = messagePositions.takeLast(); // go backwards from last message |
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.
This is very complicated
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.
and? qt's cursor for document editing is trash?
add optional parameter remove_messages to the ban and warn commands add event for clients to redact messages implement server side command and message handling implement server history removal todo: client side implementation add option to remove messages to moderator action dialogs add storage of message beginnings to chatview add redactMessage command handle Event_RemoveMessages on rooms this approach is favored over parsing the chatroom after the fact but will use additional memory to store the block indexes this also leaves a problem in that user messages from the chat backlog are not removed in the same way because they don't have a user associated with them add workaround for old qt versions add action for users to remove messages from users in chats add chat history to userMessagePositions with regex proper const usage for userName allow removing the messages of unregistered users add menus to usernames in chat history this allows you to remove user messages on chat history as well this also allows moderators to take actions on users in chat history Apply suggestions from code review
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.
Tested and works as expected
Related Ticket(s)
Short roundup of the initial problem
users say mean things sometimes and we'd like to forget that
What will change with this Pull Request?