mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-20 08:07:09 +02:00
Merge a8dd11ff43
into b3552d8c2c
This commit is contained in:
commit
f800f3dcdf
8 changed files with 31 additions and 1 deletions
|
@ -3420,6 +3420,10 @@ void ApiWrap::forwardMessages(
|
|||
}
|
||||
|
||||
auto forwardFrom = draft.items.front()->history()->peer;
|
||||
if (!forwardFrom->allowsAyuForwarding()) {
|
||||
// should copy content and send as a message
|
||||
return;
|
||||
}
|
||||
auto ids = QVector<MTPint>();
|
||||
auto randomIds = QVector<MTPlong>();
|
||||
auto localIds = std::shared_ptr<base::flat_map<uint64, FullMsgId>>();
|
||||
|
|
|
@ -621,6 +621,10 @@ bool ChannelData::allowsForwarding() const {
|
|||
return !(flags() & Flag::NoForwards);
|
||||
}
|
||||
|
||||
bool ChannelData::allowsAyuForwarding() const {
|
||||
return !(flags() & Flag::AyuNoForwards);
|
||||
}
|
||||
|
||||
bool ChannelData::canViewMembers() const {
|
||||
return (flags() & Flag::CanViewParticipants)
|
||||
&& (!(flags() & Flag::ParticipantsHidden)
|
||||
|
|
|
@ -73,6 +73,7 @@ enum class ChannelDataFlag : uint64 {
|
|||
SignatureProfiles = (1ULL << 35),
|
||||
StargiftsAvailable = (1ULL << 36),
|
||||
PaidMessagesAvailable = (1ULL << 37),
|
||||
AyuNoForwards = (1ULL << 38),
|
||||
};
|
||||
inline constexpr bool is_flag_type(ChannelDataFlag) { return true; };
|
||||
using ChannelDataFlags = base::flags<ChannelDataFlag>;
|
||||
|
@ -361,6 +362,7 @@ public:
|
|||
|
||||
// Like in ChatData.
|
||||
[[nodiscard]] bool allowsForwarding() const;
|
||||
[[nodiscard]] bool allowsAyuForwarding() const;
|
||||
[[nodiscard]] bool canEditInformation() const;
|
||||
[[nodiscard]] bool canEditPermissions() const;
|
||||
[[nodiscard]] bool canEditUsername() const;
|
||||
|
|
|
@ -68,6 +68,10 @@ bool ChatData::allowsForwarding() const {
|
|||
return !(flags() & Flag::NoForwards);
|
||||
}
|
||||
|
||||
bool ChatData::allowsAyuForwarding() const {
|
||||
return !(flags() & Flag::AyuNoForwards);
|
||||
}
|
||||
|
||||
bool ChatData::canEditInformation() const {
|
||||
return amIn() && !amRestricted(ChatRestriction::ChangeInfo);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ enum class ChatDataFlag {
|
|||
CallNotEmpty = (1 << 6),
|
||||
CanSetUsername = (1 << 7),
|
||||
NoForwards = (1 << 8),
|
||||
AyuNoForwards = (1 << 9),
|
||||
};
|
||||
inline constexpr bool is_flag_type(ChatDataFlag) { return true; };
|
||||
using ChatDataFlags = base::flags<ChatDataFlag>;
|
||||
|
@ -99,6 +100,7 @@ public:
|
|||
|
||||
// Like in ChannelData.
|
||||
[[nodiscard]] bool allowsForwarding() const;
|
||||
[[nodiscard]] bool allowsAyuForwarding() const;
|
||||
[[nodiscard]] bool canEditInformation() const;
|
||||
[[nodiscard]] bool canEditPermissions() const;
|
||||
[[nodiscard]] bool canEditUsername() const;
|
||||
|
|
|
@ -1386,6 +1386,17 @@ bool PeerData::allowsForwarding() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PeerData::allowsAyuForwarding() const {
|
||||
if (const auto user = asUser()) {
|
||||
return true;
|
||||
} else if (const auto channel = asChannel()) {
|
||||
return channel->allowsAyuForwarding();
|
||||
} else if (const auto chat = asChat()) {
|
||||
return chat->allowsAyuForwarding();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Data::RestrictionCheckResult PeerData::amRestricted(
|
||||
ChatRestriction right) const {
|
||||
using Result = Data::RestrictionCheckResult;
|
||||
|
|
|
@ -264,6 +264,7 @@ public:
|
|||
}
|
||||
|
||||
[[nodiscard]] bool allowsForwarding() const;
|
||||
[[nodiscard]] bool allowsAyuForwarding() const;
|
||||
[[nodiscard]] Data::RestrictionCheckResult amRestricted(
|
||||
ChatRestriction right) const;
|
||||
[[nodiscard]] bool amAnonymous() const;
|
||||
|
|
|
@ -860,7 +860,8 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
|
|||
&& chat->groupCall()->fullCount() > 0))
|
||||
? Flag::CallNotEmpty
|
||||
: Flag())
|
||||
| (data.is_noforwards() ? Flag::NoForwards : Flag());
|
||||
| (data.is_noforwards() ? Flag::NoForwards : Flag())
|
||||
| (data.is_ayuNoforwards() ? Flag::AyuNoForwards : Flag());
|
||||
chat->setFlags((chat->flags() & ~flagsMask) | flagsSet);
|
||||
chat->count = data.vparticipants_count().v;
|
||||
|
||||
|
@ -1006,6 +1007,7 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
|
|||
| (data.is_creator() ? Flag::Creator : Flag())
|
||||
: Flag())
|
||||
| (data.is_noforwards() ? Flag::NoForwards : Flag())
|
||||
| (data.is_ayuNoforwards() ? Flag::AyuNoForwards : Flag())
|
||||
| (data.is_join_to_send() ? Flag::JoinToWrite : Flag())
|
||||
| (data.is_join_request() ? Flag::RequestToJoin : Flag())
|
||||
| ((data.is_forum() && data.is_megagroup())
|
||||
|
|
Loading…
Add table
Reference in a new issue