mirror of https://github.com/procxx/kepka.git
parent
9c66bd553a
commit
d8e55081b0
|
@ -46,7 +46,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
namespace Data {
|
||||
namespace {
|
||||
|
||||
Call ComputeCallData(const MTPDmessageActionPhoneCall &call) {
|
||||
constexpr auto kFastRevokeRestriction = 24 * 60 * TimeId(60);
|
||||
|
||||
[[nodiscard]] Call ComputeCallData(const MTPDmessageActionPhoneCall &call) {
|
||||
auto result = Call();
|
||||
result.finishReason = [&] {
|
||||
if (const auto reason = call.vreason()) {
|
||||
|
@ -68,7 +70,7 @@ Call ComputeCallData(const MTPDmessageActionPhoneCall &call) {
|
|||
return result;
|
||||
}
|
||||
|
||||
Invoice ComputeInvoiceData(
|
||||
[[nodiscard]] Invoice ComputeInvoiceData(
|
||||
not_null<HistoryItem*> item,
|
||||
const MTPDmessageMediaInvoice &data) {
|
||||
auto result = Invoice();
|
||||
|
@ -84,7 +86,7 @@ Invoice ComputeInvoiceData(
|
|||
return result;
|
||||
}
|
||||
|
||||
QString WithCaptionDialogsText(
|
||||
[[nodiscard]] QString WithCaptionDialogsText(
|
||||
const QString &attachType,
|
||||
const QString &caption) {
|
||||
if (caption.isEmpty()) {
|
||||
|
@ -102,7 +104,7 @@ QString WithCaptionDialogsText(
|
|||
TextUtilities::Clean(caption));
|
||||
}
|
||||
|
||||
QString WithCaptionNotificationText(
|
||||
[[nodiscard]] QString WithCaptionNotificationText(
|
||||
const QString &attachType,
|
||||
const QString &caption) {
|
||||
if (caption.isEmpty()) {
|
||||
|
@ -220,7 +222,7 @@ bool Media::allowsEditMedia() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Media::allowsRevoke() const {
|
||||
bool Media::allowsRevoke(TimeId now) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1344,6 +1346,14 @@ int MediaDice::value() const {
|
|||
return _value;
|
||||
}
|
||||
|
||||
bool MediaDice::allowsRevoke(TimeId now) const {
|
||||
const auto peer = parent()->history()->peer;
|
||||
if (peer->isSelf() || !peer->isUser()) {
|
||||
return true;
|
||||
}
|
||||
return (now >= parent()->date() + kFastRevokeRestriction);
|
||||
}
|
||||
|
||||
QString MediaDice::notificationText() const {
|
||||
return _emoji;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
virtual bool allowsEdit() const;
|
||||
virtual bool allowsEditCaption() const;
|
||||
virtual bool allowsEditMedia() const;
|
||||
virtual bool allowsRevoke() const;
|
||||
virtual bool allowsRevoke(TimeId now) const;
|
||||
virtual bool forwardedBecomesUnread() const;
|
||||
virtual QString errorTextForForward(not_null<PeerData*> peer) const;
|
||||
|
||||
|
@ -414,6 +414,7 @@ public:
|
|||
[[nodiscard]] QString emoji() const;
|
||||
[[nodiscard]] int value() const;
|
||||
|
||||
bool allowsRevoke(TimeId now) const override;
|
||||
QString notificationText() const override;
|
||||
QString pinnedTextSubstring() const override;
|
||||
TextForMimeData clipboardText() const override;
|
||||
|
|
|
@ -585,13 +585,11 @@ bool HistoryItem::canDeleteForEveryone(TimeId now) const {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (!peer->isUser()) {
|
||||
if (!toHistoryMessage()) {
|
||||
if (!peer->isUser() && !toHistoryMessage()) {
|
||||
return false;
|
||||
} else if (const auto media = this->media()) {
|
||||
if (!media->allowsRevoke(now)) {
|
||||
return false;
|
||||
} else if (const auto media = this->media()) {
|
||||
if (!media->allowsRevoke()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!out()) {
|
||||
|
|
Loading…
Reference in New Issue