From 0db4d71ec2483c7ac5a7b536737fee8fc53a76d7 Mon Sep 17 00:00:00 2001
From: Nicolas Werner <nicolas.werner@hotmail.de>
Date: Wed, 10 Feb 2021 18:07:55 +0100
Subject: [PATCH] Prevent edits of unsent messages

---
 src/timeline/TimelineModel.cpp | 3 +++
 src/timeline/TimelineModel.h   | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index 493f755bf..b6ebeb844 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -1536,6 +1536,9 @@ TimelineModel::formatMemberEvent(QString id)
 void
 TimelineModel::setEdit(QString newEdit)
 {
+        if (edit_.startsWith('m'))
+                return;
+
         if (edit_ != newEdit) {
                 auto ev = events.get(newEdit.toStdString(), "");
                 if (ev && mtx::accessors::sender(*ev) == http::client()->user_id().to_string()) {
diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h
index 017b65895..83012cd8f 100644
--- a/src/timeline/TimelineModel.h
+++ b/src/timeline/TimelineModel.h
@@ -260,6 +260,9 @@ public slots:
         QString reply() const { return reply_; }
         void setReply(QString newReply)
         {
+                if (edit_.startsWith('m'))
+                        return;
+
                 if (reply_ != newReply) {
                         reply_ = newReply;
                         emit replyChanged(reply_);
-- 
GitLab