mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
made links in system messages clickable
needed to make sub ticket in sub only chat accessible.
This commit is contained in:
parent
30430b0fb3
commit
7ad6db550d
1 changed files with 17 additions and 2 deletions
|
@ -95,8 +95,23 @@ MessageBuilder::MessageBuilder(SystemMessageTag, const QString &text)
|
||||||
: MessageBuilder()
|
: MessageBuilder()
|
||||||
{
|
{
|
||||||
this->emplace<TimestampElement>();
|
this->emplace<TimestampElement>();
|
||||||
this->emplace<TextElement>(text, MessageElementFlag::Text,
|
|
||||||
MessageColor::System);
|
// check system message for links
|
||||||
|
// (e.g. needed for sub ticket message in sub only mode)
|
||||||
|
QStringList textFragments = text.split(QRegularExpression("\\s"));
|
||||||
|
for (const auto &word : textFragments)
|
||||||
|
{
|
||||||
|
auto linkString = this->matchLink(word);
|
||||||
|
if (linkString.isEmpty())
|
||||||
|
{
|
||||||
|
this->emplace<TextElement>(word, MessageElementFlag::Text,
|
||||||
|
MessageColor::System);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->addLink(word, linkString);
|
||||||
|
}
|
||||||
|
}
|
||||||
this->message().flags.set(MessageFlag::System);
|
this->message().flags.set(MessageFlag::System);
|
||||||
this->message().flags.set(MessageFlag::DoNotTriggerNotification);
|
this->message().flags.set(MessageFlag::DoNotTriggerNotification);
|
||||||
this->message().messageText = text;
|
this->message().messageText = text;
|
||||||
|
|
Loading…
Reference in a new issue