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; return false;
} }
bool HistoryItem::canStopPoll() const { bool HistoryItem::canBeEdited() const {
if (!isRegular() if ((!isRegular() && !isScheduled())
|| Has<HistoryMessageVia>() || Has<HistoryMessageVia>()
|| Has<HistoryMessageForwarded>()) { || Has<HistoryMessageForwarded>()) {
return false; return false;
@ -641,6 +641,10 @@ bool HistoryItem::canStopPoll() const {
return out(); return out();
} }
bool HistoryItem::canStopPoll() const {
return canBeEdited() && isRegular();
}
bool HistoryItem::canDelete() const { bool HistoryItem::canDelete() const {
if (isSponsored()) { if (isSponsored()) {
return false; return false;

View File

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

View File

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