From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: alina sireneva <alina@tei.su>
Date: Mon, 25 May 2026 23:26:56 +0400
Subject: keep spoiler reveal for new replies and message edits

---
 .../main/java/org/telegram/messenger/MediaDataController.java    | 1 +
 .../src/main/java/org/telegram/messenger/MessageObject.java      | 1 +
 .../src/main/java/org/telegram/messenger/MessagesController.java | 1 +
 TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java    | 1 +
 4 files changed, 4 insertions(+)

diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java
@@ -6850,6 +6850,7 @@ public class MediaDataController extends BaseController {
                 if (arrayList != null) {
                     for (int b = 0; b < arrayList.size(); b++) {
                         MessageObject m = arrayList.get(b);
+                        if (m.replyMessageObject != null && m.replyMessageObject.isSpoilersRevealed) messageObject.isSpoilersRevealed = true;
                         m.replyMessageObject = messageObject;
                         m.applyTimestampsHighlightForReplyMsg();
                         if (m.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage) {
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java
@@ -780,6 +780,7 @@ public class MessageObject {
             }
         }
         isSpoilersRevealed = old.isSpoilersRevealed;
+        isMediaSpoilersRevealed = old.isMediaSpoilersRevealed;
         messageOwner.replyStory = old.messageOwner.replyStory;
         if (messageOwner.media != null && old.messageOwner.media != null) {
             messageOwner.media.storyItem = old.messageOwner.media.storyItem;
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
@@ -20828,6 +20828,7 @@ public class MessagesController extends BaseController implements NotificationCe
                                     updateDialogs = true;
                                     break;
                                 } else if (oldObject.getDialogId() == newMessage.getDialogId() && oldObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage && oldObject.replyMessageObject != null && oldObject.replyMessageObject.getId() == newMessage.getId()) {
+                                    if (oldObject.replyMessageObject.isSpoilersRevealed) newMessage.isSpoilersRevealed = true;
                                     oldObject.replyMessageObject = newMessage;
                                     oldObject.generatePinMessageText(null, null);
                                     updateDialogs = true;
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
@@ -25342,6 +25342,7 @@ public class ChatActivity extends BaseFragment implements
                 if (update == null) {
                     object.replyMessageObject = emptyMessage;
                 } else {
+                    if (object.replyMessageObject != null && object.replyMessageObject.isSpoilersRevealed) update.isSpoilersRevealed = true;
                     object.replyMessageObject = update;
                 }
                 if (chatAdapter != null) {
