Merge pull request #1045 from TranRed/patch-3

Added {message} parameter for moderation buttons
This commit is contained in:
pajlada 2019-05-01 22:35:07 +02:00 committed by GitHub
commit 8aa2d42ca9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 1 deletions

View file

@ -48,6 +48,7 @@ struct Message : boost::noncopyable {
QTime parseTime;
QString id;
QString searchText;
QString messageText;
QString loginName;
QString displayName;
QString localizedName;

View file

@ -97,6 +97,7 @@ MessageBuilder::MessageBuilder(const QString &text)
this->emplace<TimestampElement>();
this->emplace<TextElement>(text, MessageElementFlag::Text,
MessageColor::System);
this->message().messageText = text;
this->message().searchText = text;
}
@ -108,6 +109,7 @@ MessageBuilder::MessageBuilder(SystemMessageTag, const QString &text)
MessageColor::System);
this->message().flags.set(MessageFlag::System);
this->message().flags.set(MessageFlag::DoNotTriggerNotification);
this->message().messageText = text;
this->message().searchText = text;
}
@ -158,6 +160,7 @@ MessageBuilder::MessageBuilder(TimeoutMessageTag, const QString &username,
this->emplace<TimestampElement>();
this->emplace<TextElement>(text, MessageElementFlag::Text,
MessageColor::System);
this->message().messageText = text;
this->message().searchText = text;
}
@ -214,6 +217,7 @@ MessageBuilder::MessageBuilder(const BanAction &action, uint32_t count)
this->emplace<TextElement>(text, MessageElementFlag::Text,
MessageColor::System);
this->message().messageText = text;
this->message().searchText = text;
}
@ -243,6 +247,7 @@ MessageBuilder::MessageBuilder(const UnbanAction &action)
this->emplace<TextElement>(text, MessageElementFlag::Text,
MessageColor::System);
this->message().messageText = text;
this->message().searchText = text;
}

View file

@ -438,6 +438,7 @@ MessagePtr TwitchMessageBuilder::build()
this->addWords(splits, twitchEmotes);
this->message().messageText = this->originalMessage_;
this->message().searchText = this->userName + ": " + this->originalMessage_;
return this->release();

View file

@ -1667,9 +1667,12 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
case Link::UserAction:
{
QString value = link.value;
value.replace("{user}", layout->getMessage()->loginName)
.replace("{channel}", this->channel_->getName())
.replace("{msg-id}", layout->getMessage()->id);
.replace("{msg-id}", layout->getMessage()->id)
.replace("{message}", layout->getMessage()->messageText);
this->channel_->sendMessage(value);
}
break;