Fixed edit of scheduled messages.

This commit is contained in:
John Preston 2021-11-10 10:10:35 +04:00
parent 936d4004ff
commit 2f48fe920e
3 changed files with 8 additions and 3 deletions

View File

@ -619,8 +619,8 @@ bool HistoryItem::allowsEdit(TimeId now) const {
return false;
}
bool HistoryItem::canStopPoll() const {
if (!isRegular()
bool HistoryItem::canBeEdited() const {
if ((!isRegular() && !isScheduled())
|| Has<HistoryMessageVia>()
|| Has<HistoryMessageForwarded>()) {
return false;
@ -641,6 +641,10 @@ bool HistoryItem::canStopPoll() const {
return out();
}
bool HistoryItem::canStopPoll() const {
return canBeEdited() && isRegular();
}
bool HistoryItem::canDelete() const {
if (isSponsored()) {
return false;

View File

@ -373,6 +373,7 @@ public:
}
[[nodiscard]] bool canPin() const;
[[nodiscard]] bool canBeEdited() const;
[[nodiscard]] bool canStopPoll() const;
[[nodiscard]] virtual bool allowsSendNow() const;
[[nodiscard]] virtual bool allowsForward() const;

View File

@ -1048,7 +1048,7 @@ bool HistoryMessage::isTooOldForEdit(TimeId now) const {
}
bool HistoryMessage::allowsEdit(TimeId now) const {
return canStopPoll()
return canBeEdited()
&& !isTooOldForEdit(now)
&& (!_media || _media->allowsEdit())
&& !isLegacyMessage()