@@ -64,6 +64,8 @@ fun PerformForwardFromMyName(
6464 currentAccount : Int ,
6565 parentFragment : BaseFragment ? ,
6666 notify : Boolean ) {
67+ val isMonoForum = MessagesController .getInstance(currentAccount).isMonoForum(key)
68+ val monoForumPeerId = if (keyTopic != null && isMonoForum) DialogObject .getPeerDialogId(keyTopic.from_id) else 0L
6769
6870 val queue = ArrayList < () -> Unit > ();
6971 val saveOriginalCaptions = (text == null )
@@ -101,6 +103,7 @@ fun PerformForwardFromMyName(
101103 parentFragment,
102104 copyText,
103105 notify,
106+ monoForumPeerId,
104107 deque)
105108 }
106109 }
@@ -122,7 +125,7 @@ fun PerformForwardFromMyName(
122125 val copyText = currentReplaceText();
123126 queue.add {
124127 val instance = SendMessagesHelper .getInstance(currentAccount);
125- instance.processForwardFromMyName(copyMsg, key, 0 , topicId , null , copyText, notify, topicId)
128+ instance.processForwardFromMyName(copyMsg, key, 0 , 0 , null , copyText, notify, topicId, monoForumPeerId )
126129 deque();
127130 }
128131 }
@@ -140,7 +143,8 @@ fun GroupItemsIntoAlbum(
140143 sendingMessageObjects : ArrayList <MessageObject >,
141144 currentAccount : Int ,
142145 parentFragment : BaseFragment ? ,
143- notify : Boolean ) {
146+ notify : Boolean ,
147+ monoForumPeerId : Long = 0L) {
144148 if (sendingMessageObjects.isEmpty()) {
145149 return ;
146150 }
@@ -153,7 +157,7 @@ fun GroupItemsIntoAlbum(
153157 val objectsToDelay = sub(objectsToSend.size, sendingMessageObjects.size);
154158
155159 val finish = {
156- GroupItemsIntoAlbum (key, reply, text, objectsToDelay, currentAccount, parentFragment, notify)
160+ GroupItemsIntoAlbum (key, reply, text, objectsToDelay, currentAccount, parentFragment, notify, monoForumPeerId )
157161 };
158162
159163 SendItemsAsAlbum (
@@ -164,6 +168,7 @@ fun GroupItemsIntoAlbum(
164168 parentFragment,
165169 text,
166170 notify,
171+ monoForumPeerId,
167172 finish)
168173}
169174
@@ -211,12 +216,13 @@ fun SendItemsAsAlbum(
211216 fragment : BaseFragment ? ,
212217 replaceText : String? ,
213218 notify : Boolean ,
219+ monoForumPeerId : Long = 0L,
214220 finish : () -> Unit ) {
215221 if (peer == 0L || messages.size > 10 || messages.isEmpty()) {
216222 return
217223 }
218224 val accountInstance = AccountInstance .getInstance(currentAccount)
219- val lower_id = peer
225+ val lower_id = if (monoForumPeerId != 0L ) monoForumPeerId else peer
220226 val sendToPeer: InputPeer =
221227 (if (lower_id != 0L ) accountInstance.messagesController.getInputPeer(lower_id)
222228 else null )
@@ -306,7 +312,7 @@ fun SendItemsAsAlbum(
306312 showToast(" Sorry, something went wrong." );
307313 return @handleMessages
308314 }
309- SendItemsAsAlbum (currentAccount, messages, peer, reply, fragment, replaceText, notify, finish)
315+ SendItemsAsAlbum (currentAccount, messages, peer, reply, fragment, replaceText, notify, monoForumPeerId, finish)
310316 }
311317
312318 ForkApi .TLRPCMessages (currentAccount, messages, handleMessages);
0 commit comments