Add moderation buttons in search popup (#2803)

This commit is contained in:
Tal Neoran 2021-05-23 16:51:53 +03:00 committed by GitHub
parent f123a11c1c
commit b42f70e6d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 3 deletions

View file

@ -2,6 +2,7 @@
## Unversioned
- Minor: Added moderation buttons to search popup when searching in a split with moderation mode enabled. (#2148, #2803)
- Minor: Made "#channel" in `/mentions` tab show in usercards and in the search popup. (#2802)
- Minor: Added settings to disable custom FrankerFaceZ VIP/mod badges. (#2693, #2759)
- Bugfix: Fixed FFZ emote links for global emotes (#2807, #2808)

View file

@ -46,6 +46,7 @@
#include "widgets/dialogs/SettingsDialog.hpp"
#include "widgets/dialogs/UserInfoPopup.hpp"
#include "widgets/helper/EffectLabel.hpp"
#include "widgets/helper/SearchPopup.hpp"
#include "widgets/splits/Split.hpp"
#define DRAW_WIDTH (this->width())
@ -999,6 +1000,16 @@ MessageElementFlags ChannelView::getFlags() const
Split *split = dynamic_cast<Split *>(this->parentWidget());
if (split == nullptr)
{
SearchPopup *searchPopup =
dynamic_cast<SearchPopup *>(this->parentWidget());
if (searchPopup != nullptr)
{
split = dynamic_cast<Split *>(searchPopup->parentWidget());
}
}
if (split != nullptr)
{
if (split->getModerationMode())
@ -2059,14 +2070,26 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
case Link::UserAction: {
QString value = link.value;
ChannelPtr channel = this->underlyingChannel_;
SearchPopup *searchPopup =
dynamic_cast<SearchPopup *>(this->parentWidget());
if (searchPopup != nullptr)
{
Split *split =
dynamic_cast<Split *>(searchPopup->parentWidget());
if (split != nullptr)
{
channel = split->getChannel();
}
}
value.replace("{user}", layout->getMessage()->loginName)
.replace("{channel}", this->channel_->getName())
.replace("{msg-id}", layout->getMessage()->id)
.replace("{message}", layout->getMessage()->messageText);
value = getApp()->commands->execCommand(
value, this->underlyingChannel_, false);
this->underlyingChannel_->sendMessage(value);
value = getApp()->commands->execCommand(value, channel, false);
channel->sendMessage(value);
}
break;