mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-21 18:50:47 +03:00
Fix disabling a room ping
This commit is contained in:
parent
db2fcdfce8
commit
b39ffc2f1a
1 changed files with 7 additions and 8 deletions
|
@ -187,9 +187,6 @@ InputBar::addMention(QString mention, QString text)
|
||||||
mentionTexts_.push_back(text);
|
mentionTexts_.push_back(text);
|
||||||
|
|
||||||
emit mentionsChanged();
|
emit mentionsChanged();
|
||||||
if (mention == u"@room") {
|
|
||||||
this->containsAtRoom_ = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,9 +197,6 @@ InputBar::removeMention(QString mention)
|
||||||
mentions_.removeAt(idx);
|
mentions_.removeAt(idx);
|
||||||
mentionTexts_.removeAt(idx);
|
mentionTexts_.removeAt(idx);
|
||||||
emit mentionsChanged();
|
emit mentionsChanged();
|
||||||
if (mention == u"@room") {
|
|
||||||
this->containsAtRoom_ = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,6 +238,7 @@ InputBar::updateTextContentProperties(const QString &t, bool charDeleted)
|
||||||
auto roomMention = containsRoomMention(t) && this->room->permissions()->canPingRoom();
|
auto roomMention = containsRoomMention(t) && this->room->permissions()->canPingRoom();
|
||||||
|
|
||||||
if (roomMention != this->containsAtRoom_) {
|
if (roomMention != this->containsAtRoom_) {
|
||||||
|
this->containsAtRoom_ = roomMention;
|
||||||
if (roomMention)
|
if (roomMention)
|
||||||
addMention(QStringLiteral(u"@room"), QStringLiteral(u"@room"));
|
addMention(QStringLiteral(u"@room"), QStringLiteral(u"@room"));
|
||||||
else
|
else
|
||||||
|
@ -500,8 +495,11 @@ mtx::common::Mentions
|
||||||
InputBar::generateMentions()
|
InputBar::generateMentions()
|
||||||
{
|
{
|
||||||
std::vector<std::string> userMentions;
|
std::vector<std::string> userMentions;
|
||||||
|
bool atRoom = false;
|
||||||
for (const auto &m : mentions_)
|
for (const auto &m : mentions_)
|
||||||
if (m != u"@room")
|
if (m == u"@room")
|
||||||
|
atRoom = true;
|
||||||
|
else
|
||||||
userMentions.push_back(m.toStdString());
|
userMentions.push_back(m.toStdString());
|
||||||
|
|
||||||
if (!room->reply().isEmpty()) {
|
if (!room->reply().isEmpty()) {
|
||||||
|
@ -515,7 +513,8 @@ InputBar::generateMentions()
|
||||||
|
|
||||||
auto mention = mtx::common::Mentions{
|
auto mention = mtx::common::Mentions{
|
||||||
.user_ids = userMentions,
|
.user_ids = userMentions,
|
||||||
.room = containsAtRoom_,
|
// We use the atRoom from the mentions list to allow suppressing a room mention
|
||||||
|
.room = atRoom,
|
||||||
};
|
};
|
||||||
|
|
||||||
// this->containsAtRoom_ = false;
|
// this->containsAtRoom_ = false;
|
||||||
|
|
Loading…
Reference in a new issue