Fixed an editing of unsupported messages.

This commit is contained in:
23rd 2018-12-26 09:18:53 +03:00 committed by John Preston
parent b00ca217b3
commit be0b0c1984
4 changed files with 8 additions and 3 deletions

View file

@ -63,6 +63,7 @@ not_null<HistoryItem*> CreateUnsupportedMessage(
text.entities.push_front( text.entities.push_front(
EntityInText(EntityInTextItalic, 0, text.text.size())); EntityInText(EntityInTextItalic, 0, text.text.size()));
flags &= ~MTPDmessage::Flag::f_post_author; flags &= ~MTPDmessage::Flag::f_post_author;
flags |= MTPDmessage_ClientFlag::f_is_unsupported;
return new HistoryMessage( return new HistoryMessage(
history, history,
msgId, msgId,

View file

@ -603,7 +603,8 @@ bool HistoryMessage::isTooOldForEdit(TimeId now) const {
bool HistoryMessage::allowsEdit(TimeId now) const { bool HistoryMessage::allowsEdit(TimeId now) const {
return canStopPoll() return canStopPoll()
&& !isTooOldForEdit(now) && !isTooOldForEdit(now)
&& (!_media || _media->allowsEdit()); && (!_media || _media->allowsEdit())
&& !isUnsupportedMessage();
} }
bool HistoryMessage::uploading() const { bool HistoryMessage::uploading() const {

View file

@ -149,6 +149,9 @@ private:
return _flags & MTPDmessage_ClientFlag::f_has_admin_badge; return _flags & MTPDmessage_ClientFlag::f_has_admin_badge;
} }
bool isTooOldForEdit(TimeId now) const; bool isTooOldForEdit(TimeId now) const;
bool isUnsupportedMessage() const {
return _flags & MTPDmessage_ClientFlag::f_is_unsupported;
}
// For an invoice button we replace the button text with a "Receipt" key. // For an invoice button we replace the button text with a "Receipt" key.
// It should show the receipt for the payed invoice. Still let mobile apps do that. // It should show the receipt for the payed invoice. Still let mobile apps do that.

View file

@ -68,8 +68,8 @@ enum class MTPDmessage_ClientFlag : uint32 {
// message has an admin badge in supergroup // message has an admin badge in supergroup
f_has_admin_badge = (1U << 20), f_has_admin_badge = (1U << 20),
//// message is not displayed because it is part of a group // message is unsupported by a current version of client
//f_hidden_by_group = (1U << 19), f_is_unsupported = (1U << 19),
// update this when adding new client side flags // update this when adding new client side flags
MIN_FIELD = (1U << 19), MIN_FIELD = (1U << 19),