Restricted replying to own ephemeral messages.

This commit is contained in:
23rd
2026-06-13 11:47:10 +03:00
committed by John Preston
parent bd957a3f02
commit 7bcd14a2b9
4 changed files with 13 additions and 3 deletions
@@ -316,6 +316,9 @@ bool EphemeralMessages::trySend(const Api::MessageToSend &message) {
const auto replyToId = message.action.replyTo.messageId;
if (const auto replyTo = _session->data().message(replyToId)) {
if (replyTo->isEphemeral()) {
if (replyTo->out()) {
return true;
}
const auto entry = findByItem(replyTo);
const auto bot = entry ? botForSending(*entry) : nullptr;
if (bot) {
@@ -3204,7 +3204,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
};
const auto addReplyAction = [&](HistoryItem *item) {
if (!item || (!item->isRegular() && !item->isEphemeral())) {
if (!item
|| (!item->isRegular()
&& (!item->isEphemeral() || item->out()))) {
return;
}
const auto canSendReply = CanSendReply(item);
@@ -6190,6 +6192,9 @@ auto HistoryInner::DelegateMixin()
}
bool CanSendReply(not_null<const HistoryItem*> item) {
if (item->isEphemeral() && item->out()) {
return false;
}
const auto peer = item->history()->peer;
if (const auto topic = item->topic()) {
return Data::CanSendAnything(topic);
@@ -9889,7 +9889,8 @@ void HistoryWidget::processReply() {
return processCancel();
#endif
} else if (!_processingReplyItem->isRegular()
&& !_processingReplyItem->isEphemeral()) {
&& (!_processingReplyItem->isEphemeral()
|| _processingReplyItem->out())) {
return processCancel();
} else if (const auto forum = _peer->forum()
; forum && _processingReplyItem->history() == _history) {
@@ -631,7 +631,8 @@ bool AddReplyToMessageAction(
const auto topic = item ? item->topic() : nullptr;
const auto peer = item ? item->history()->peer.get() : nullptr;
if (!item
|| (!item->isRegular() && !item->isEphemeral())
|| (!item->isRegular()
&& (!item->isEphemeral() || item->out()))
|| (context != Context::History
&& context != Context::Replies
&& context != Context::Monoforum)) {