Added creator flag to PollData.

This commit is contained in:
23rd
2026-03-23 12:33:06 +03:00
parent 58a2c0f834
commit 27e04f3e0c
2 changed files with 16 additions and 9 deletions
+6 -1
View File
@@ -104,7 +104,8 @@ bool PollData::applyChanges(const MTPDpoll &poll) {
| (poll.is_open_answers() ? Flag::OpenAnswers : Flag(0))
| (poll.is_hide_results_until_close()
? Flag::HideResultsUntilClose
: Flag(0));
: Flag(0))
| (poll.is_creator() ? Flag::Creator : Flag(0));
const auto newCloseDate = poll.vclose_date().value_or_empty();
const auto newClosePeriod = poll.vclose_period().value_or_empty();
auto newAnswers = ranges::views::all(
@@ -350,6 +351,10 @@ bool PollData::hideResultsUntilClose() const {
return (_flags & Flag::HideResultsUntilClose);
}
bool PollData::creator() const {
return (_flags & Flag::Creator);
}
MTPInputMedia PollMediaToMTP(const PollMedia &media) {
if (media.photo) {
return MTP_inputMediaPhoto(
+10 -8
View File
@@ -60,14 +60,15 @@ struct PollData {
[[nodiscard]] Main::Session &session() const;
enum class Flag {
Closed = 0x01,
PublicVotes = 0x02,
MultiChoice = 0x04,
Quiz = 0x08,
ShuffleAnswers = 0x10,
RevotingDisabled = 0x20,
OpenAnswers = 0x40,
HideResultsUntilClose = 0x80,
Closed = 0x001,
PublicVotes = 0x002,
MultiChoice = 0x004,
Quiz = 0x008,
ShuffleAnswers = 0x010,
RevotingDisabled = 0x020,
OpenAnswers = 0x040,
HideResultsUntilClose = 0x080,
Creator = 0x100,
};
friend inline constexpr bool is_flag_type(Flag) { return true; };
using Flags = base::flags<Flag>;
@@ -92,6 +93,7 @@ struct PollData {
[[nodiscard]] bool revotingDisabled() const;
[[nodiscard]] bool openAnswers() const;
[[nodiscard]] bool hideResultsUntilClose() const;
[[nodiscard]] bool creator() const;
PollId id = 0;
TextWithEntities question;