Skip to content
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

Usernames in historic bans / timeouts aren't clickable. #3030

Closed
Mm2PL opened this issue Jul 17, 2021 · 1 comment · Fixed by #4760
Closed

Usernames in historic bans / timeouts aren't clickable. #3030

Mm2PL opened this issue Jul 17, 2021 · 1 comment · Fixed by #4760
Labels
bug Something isn't working as intended, or works in a confusing/unintuitive way for the user

Comments

@Mm2PL
Copy link
Collaborator

Mm2PL commented Jul 17, 2021

Describe your issue

Bans / timeouts loaded from recent-messages aren't processed the same way as from chat so they don't have usercard links added.

Expected behavior

You can click usernames from bans in historic messages.

Actual behavior

You can't

OS and Chatterino Version

Chatterino + Dankerino patches 2.3.3 4cc402a upstream faafbda

@Mm2PL Mm2PL added the bug Something isn't working as intended, or works in a confusing/unintuitive way for the user label Jul 17, 2021
@zneix
Copy link
Collaborator

zneix commented Jul 17, 2021

CLEARCHAT messages retrieved from recent-messages are actually converted to a NOTICE messages, so we'd need to change that logic first if we want to implement this.

See:

auto convertClearchatToNotice(Communi::IrcMessage *message)
{
auto channelName = message->parameter(0);
QString noticeMessage{};
if (message->tags().contains("target-user-id"))
{
auto target = message->parameter(1);
if (message->tags().contains("ban-duration"))
{
// User was timed out
noticeMessage =
QString("%1 has been timed out for %2.")
.arg(target)
.arg(formatTime(
message->tag("ban-duration").toString()));
}
else
{
// User was permanently banned
noticeMessage =
QString("%1 has been permanently banned.").arg(target);
}
}
else
{
// Chat was cleared
noticeMessage = "Chat has been cleared by a moderator.";
}
// rebuild the raw irc message so we can convert it back to an ircmessage again!
// this could probably be done in a smarter way
auto s = QString(":tmi.twitch.tv NOTICE %1 :%2")
.arg(channelName)
.arg(noticeMessage);
auto newMessage = Communi::IrcMessage::fromData(s.toUtf8(), nullptr);
newMessage->setTags(message->tags());
return newMessage;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended, or works in a confusing/unintuitive way for the user
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants