summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2024-06-09 15:30:30 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2024-06-09 15:30:30 +0200
commit3533f104bd32419bfc9031267cd73e9715119b83 (patch)
treea6c0d5ef9080b9fc6c8b33daa87f1d24f53afacd
parentFix emojis in avatars (diff)
downloadnheko-3533f104bd32419bfc9031267cd73e9715119b83.tar.xz
Properly restore room mentions state after edit
-rw-r--r--src/timeline/InputBar.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/timeline/InputBar.h b/src/timeline/InputBar.h
index c38de662..2b1c84e4 100644
--- a/src/timeline/InputBar.h
+++ b/src/timeline/InputBar.h
@@ -197,12 +197,14 @@ public slots:
         textBeforeEdit     = text();
         mentionsBefore     = mentions_;
         mentionTextsBefore = mentionTexts_;
+        containsAtRoomBefore = containsAtRoom_;
         emit mentionsChanged();
     }
     void restoreAfterEdit()
     {
         mentions_     = mentionsBefore;
         mentionTexts_ = mentionTextsBefore;
+        containsAtRoom_ = containsAtRoomBefore;
         mentionsBefore.clear();
         mentionTextsBefore.clear();
         setText(textBeforeEdit);
@@ -216,6 +218,9 @@ public slots:
 
         mentions_     = newMentions;
         mentionTexts_ = newMentionTexts;
+
+        this->containsAtRoom_ = newMentions.contains(u"@room");
+
         emit mentionsChanged();
     }
 
@@ -331,6 +336,7 @@ private:
     // store stuff during edits
     QStringList mentionsBefore, mentionTextsBefore;
     QString textBeforeEdit;
+    bool containsAtRoomBefore = false;
 
     using UploadHandle = std::unique_ptr<MediaUpload, DeleteLaterDeleter>;
     std::vector<UploadHandle> unconfirmedUploads;