diff --git a/CHANGELOG.md b/CHANGELOG.md index e017aaf4..089d343b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - Bugfix: Fixed Lua errors from handlers of HTTP requests not being logged. (#6452) - Bugfix: Fixed restore button not showing on Windows. (#6565) - Bugfix: Fixed popups and the overlay not being draggable on Wayland. (#6573) +- Bugfix: Fixed middle-clicking usernames in a local channel opening an invalid viewercard. (#6577) - Dev: Update release documentation. (#6498) - Dev: Make code sanitizers opt in with the `CHATTERINO_SANITIZER_SUPPORT` CMake option. After that's enabled, use the `SANITIZE_*` flag to enable individual sanitizers. (#6493) - Dev: Remove unused QTextCodec includes. (#6487) diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 6b624d7b..85e6b591 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -2359,8 +2359,26 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event) if (hoverLayoutElement->getFlags().has( MessageElementFlag::Username)) { - openTwitchUsercard(this->channel_->getName(), - hoverLayoutElement->getLink().value); + const auto userName = hoverLayoutElement->getLink().value; + const auto type = this->hasSourceChannel() + ? this->sourceChannel_->getType() + : this->channel_->getType(); + switch (type) + { + case Channel::Type::TwitchWhispers: + case Channel::Type::TwitchLive: + QDesktopServices::openUrl( + QUrl(u"https://www.twitch.tv/" % userName)); + break; + case Channel::Type::TwitchMentions: + openTwitchUsercard(layout->getMessage()->channelName, + userName); + break; + default: + openTwitchUsercard(this->channel_->getName(), userName); + break; + } + return; } if (hoverLayoutElement->getLink().isUrl() == false)