mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 06:37:24 +02:00
Correctly track General editing service messages.
This commit is contained in:
parent
5e20c15c20
commit
3c799a5cc1
5 changed files with 42 additions and 6 deletions
|
@ -435,6 +435,18 @@ void ForumTopic::setClosedAndSave(bool closed) {
|
|||
}).send();
|
||||
}
|
||||
|
||||
bool ForumTopic::hidden() const {
|
||||
return (_flags & Flag::Hidden);
|
||||
}
|
||||
|
||||
void ForumTopic::setHidden(bool hidden) {
|
||||
if (hidden) {
|
||||
_flags |= Flag::Hidden;
|
||||
} else {
|
||||
_flags &= ~Flag::Hidden;
|
||||
}
|
||||
}
|
||||
|
||||
void ForumTopic::indexTitleParts() {
|
||||
_titleWords.clear();
|
||||
_titleFirstLetters.clear();
|
||||
|
|
|
@ -91,6 +91,9 @@ public:
|
|||
void setClosed(bool closed);
|
||||
void setClosedAndSave(bool closed);
|
||||
|
||||
[[nodiscard]] bool hidden() const;
|
||||
void setHidden(bool hidden);
|
||||
|
||||
[[nodiscard]] bool creating() const;
|
||||
void discard();
|
||||
|
||||
|
@ -162,10 +165,11 @@ public:
|
|||
private:
|
||||
enum class Flag : uchar {
|
||||
Closed = (1 << 0),
|
||||
My = (1 << 1),
|
||||
HasPinnedMessages = (1 << 2),
|
||||
GeneralIconActive = (1 << 3),
|
||||
GeneralIconSelected = (1 << 4),
|
||||
Hidden = (1 << 1),
|
||||
My = (1 << 2),
|
||||
HasPinnedMessages = (1 << 3),
|
||||
GeneralIconActive = (1 << 4),
|
||||
GeneralIconSelected = (1 << 5),
|
||||
};
|
||||
friend inline constexpr bool is_flag_type(Flag) { return true; }
|
||||
using Flags = base::flags<Flag>;
|
||||
|
|
|
@ -1216,6 +1216,9 @@ void History::applyServiceChanges(
|
|||
if (const auto closed = data.vclosed()) {
|
||||
topic->setClosed(mtpIsTrue(*closed));
|
||||
}
|
||||
if (const auto hidden = data.vhidden()) {
|
||||
topic->setHidden(mtpIsTrue(*hidden));
|
||||
}
|
||||
}
|
||||
}, [](const auto &) {
|
||||
});
|
||||
|
|
|
@ -1343,8 +1343,10 @@ MsgId HistoryService::topicRootId() const {
|
|||
if (const auto data = GetDependentData()
|
||||
; data && data->topicPost && data->topId) {
|
||||
return data->topId;
|
||||
} else if (Has<HistoryServiceTopicInfo>()) {
|
||||
return id;
|
||||
} else if (const auto info = Get<HistoryServiceTopicInfo>()) {
|
||||
if (info->created()) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
return Data::ForumTopic::kGeneralId;
|
||||
}
|
||||
|
@ -1514,6 +1516,10 @@ void HistoryService::createFromMtp(const MTPDmessageService &message) {
|
|||
info->closed = mtpIsTrue(*closed);
|
||||
info->reopened = !info->closed;
|
||||
}
|
||||
if (const auto hidden = data.vhidden()) {
|
||||
info->hidden = mtpIsTrue(*hidden);
|
||||
info->unhidden = !info->hidden;
|
||||
}
|
||||
} else {
|
||||
const auto &data = action.c_messageActionTopicCreate();
|
||||
info->title = qs(data.vtitle());
|
||||
|
|
|
@ -36,6 +36,17 @@ struct HistoryServiceTopicInfo
|
|||
bool reopened = false;
|
||||
bool reiconed = false;
|
||||
bool renamed = false;
|
||||
bool hidden = false;
|
||||
bool unhidden = false;
|
||||
|
||||
[[nodiscard]] bool created() const {
|
||||
return !closed
|
||||
&& !reopened
|
||||
&& !reiconed
|
||||
&& !renamed
|
||||
&& !hidden
|
||||
&& !unhidden;
|
||||
}
|
||||
};
|
||||
|
||||
struct HistoryServiceGameScore
|
||||
|
|
Loading…
Add table
Reference in a new issue