Allow edit messages older than 2 days in sgroups

This feature is cherry-picked from
75d8d01b17 (diff-c0b32cc8ed01e3b1cdbfd5427184a41dL874)
This commit is contained in:
leha-bot 2018-10-17 21:22:34 +03:00 committed by Alex
parent 9c4a0ee2dc
commit 04882ed746
1 changed files with 9 additions and 1 deletions

View File

@ -856,7 +856,15 @@ bool HistoryItem::canForward() const {
bool HistoryItem::canEdit(const QDateTime &cur) const {
auto messageToMyself = _history->peer->isSelf();
auto messageTooOld = messageToMyself ? false : (date.secsTo(cur) >= Global::EditTimeLimit());
auto canPinInMegagroup = [&] {
if (auto megagroup = _history->peer->asMegagroup()) {
return megagroup->canPinMessages();
}
return false;
}();
auto messageTooOld = (messageToMyself || canPinInMegagroup) ? false : (date.secsTo(cur) >= Global::EditTimeLimit());
if (id < 0 || messageTooOld) {
return false;
}