Automatically switch to threading when replying

This commit is contained in:
Nicolas Werner 2022-09-30 03:43:42 +02:00
parent 88cbac1695
commit c34c9f9035
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
2 changed files with 14 additions and 10 deletions

View file

@ -2684,6 +2684,19 @@ TimelineModel::resetThread()
emit threadChanged(thread_); emit threadChanged(thread_);
} }
} }
void
TimelineModel::setReply(const QString &newReply)
{
if (reply_ != newReply) {
reply_ = newReply;
if (auto ev = events.get(reply_.toStdString(), "", false, true))
setThread(QString::fromStdString(
mtx::accessors::relations(*ev).thread().value_or(thread_.toStdString())));
emit replyChanged(reply_);
}
}
void void
TimelineModel::setEdit(const QString &newEdit) TimelineModel::setEdit(const QString &newEdit)

View file

@ -363,16 +363,7 @@ public slots:
std::vector<QString> typingUsers() const { return typingUsers_; } std::vector<QString> typingUsers() const { return typingUsers_; }
bool paginationInProgress() const { return m_paginationInProgress; } bool paginationInProgress() const { return m_paginationInProgress; }
QString reply() const { return reply_; } QString reply() const { return reply_; }
void setReply(const QString &newReply) void setReply(const QString &newReply);
{
if (edit_.startsWith('m'))
return;
if (reply_ != newReply) {
reply_ = newReply;
emit replyChanged(reply_);
}
}
void resetReply() void resetReply()
{ {
if (!reply_.isEmpty()) { if (!reply_.isEmpty()) {