From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: alina sireneva <alina@tei.su>
Date: Fri, 17 Jul 2026 21:56:07 +0400
Subject: optimistically handle hidden forwards + properly update bubble on miss

---
 .../org/telegram/messenger/SendMessagesHelper.java   | 12 +++++++++++-
 .../src/main/java/org/telegram/ui/ChatActivity.java  |  5 +++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java
index 0000000..0000000 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java
@@ -2261,7 +2261,17 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
                         }
                         newMsg.fwd_from.channel_post = msgObj.getId();
                         newMsg.fwd_from.flags |= 4;
-                        if (msgObj.isFromUser()) {
+                        String inu_privateForwardName = null;
+                        if (msgObj.isFromUser() && msgObj.messageOwner.from_id.user_id != 0) {
+                            TLRPC.UserFull inu_userFull = getMessagesController().getUserFull(msgObj.messageOwner.from_id.user_id);
+                            if (inu_userFull != null && !TextUtils.isEmpty(inu_userFull.private_forward_name)) {
+                                inu_privateForwardName = inu_userFull.private_forward_name;
+                            }
+                        }
+                        if (inu_privateForwardName != null) {
+                            newMsg.fwd_from.from_name = inu_privateForwardName;
+                            newMsg.fwd_from.flags |= 32;
+                        } else if (msgObj.isFromUser()) {
                             newMsg.fwd_from.from_id = msgObj.messageOwner.from_id;
                             newMsg.fwd_from.flags |= 1;
                         } else {
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
@@ -22489,6 +22489,7 @@ public class ChatActivity extends BaseFragment implements
                 }
                 boolean mediaUpdated = false;
                 boolean updatedForward = false;
+                boolean inu_fwdBecameHidden = false;
                 if (newMsgObj != null) {
                     try {
                         updatedForward = obj.isForwarded() && (obj.messageOwner.reply_markup == null && newMsgObj.reply_markup != null || !obj.messageOwner.message.equals(newMsgObj.message));
@@ -22509,8 +22510,8 @@ public class ChatActivity extends BaseFragment implements
                     TLRPC.MessageFwdHeader fwdHeader = obj.messageOwner.fwd_from;
                     obj.messageOwner = newMsgObj;
                     if (fwdHeader != null && newMsgObj.fwd_from != null && !TextUtils.isEmpty(newMsgObj.fwd_from.from_name)) {
-                        obj.messageOwner.fwd_from = fwdHeader;
                         obj.isOutOwnerCached = null;
+                        inu_fwdBecameHidden = fwdHeader.from_id != null;
                     }
                     obj.generateThumbs(true);
                     obj.setType();
@@ -22526,7 +22527,7 @@ public class ChatActivity extends BaseFragment implements
                 messagesDict[0].put(newMsgId, obj);
                 obj.messageOwner.id = newMsgId;
                 obj.messageOwner.send_state = MessageObject.MESSAGE_SEND_STATE_SENT;
-                obj.forceUpdate = mediaUpdated;
+                obj.forceUpdate = mediaUpdated || inu_fwdBecameHidden;
                 addReplyMessageOwner(obj, msgId);
                 if (args.length >= 6) {
                     obj.applyMediaExistanceFlags((Integer) args[5]);
