From c34181ef3e7a8234db90d1afc322a2c6f766c7f0 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 31 Jul 2016 10:29:15 +0100 Subject: [PATCH] Edit messages to yourself for any amount of time. Active inline keyboard button rendering rounding radius fixed. --- Telegram/SourceFiles/app.cpp | 2 +- Telegram/SourceFiles/history.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 7b67ab797..f3d177592 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -2109,7 +2109,7 @@ namespace { ::cornersMaskSmall[i] = new QImage(mask[i].convertToFormat(QImage::Format_ARGB32_Premultiplied)); ::cornersMaskSmall[i]->setDevicePixelRatio(cRetinaFactor()); } - prepareCorners(WhiteCorners, st::buttonRadius, st::white); + prepareCorners(WhiteCorners, st::dateRadius, st::white); prepareCorners(StickerCorners, st::dateRadius, st::msgServiceBg); prepareCorners(StickerSelectedCorners, st::dateRadius, st::msgServiceSelectBg); prepareCorners(SelectedOverlaySmallCorners, st::buttonRadius, st::msgSelectOverlay); diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index d94e11200..8bf762fea 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -2833,7 +2833,9 @@ void HistoryItem::setId(MsgId newId) { } bool HistoryItem::canEdit(const QDateTime &cur) const { - if (id < 0 || date.secsTo(cur) >= Global::EditTimeLimit()) return false; + auto messageToMyself = (peerToUser(_history->peer->id) == MTP::authedId()); + auto messageTooOld = messageToMyself ? false : (date.secsTo(cur) >= Global::EditTimeLimit()); + if (id < 0 || messageTooOld) return false; if (auto msg = toHistoryMessage()) { if (msg->Has() || msg->Has()) return false; @@ -2854,7 +2856,7 @@ bool HistoryItem::canEdit(const QDateTime &cur) const { auto channel = _history->peer->asChannel(); return (channel->amCreator() || (channel->amEditor() && out())); } - return out() || (peerToUser(_history->peer->id) == MTP::authedId()); + return out() || messageToMyself; } return false; }