mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-09 21:23:43 +00:00
Restricted replying to own ephemeral messages.
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user