mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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();
|
}).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() {
|
void ForumTopic::indexTitleParts() {
|
||||||
_titleWords.clear();
|
_titleWords.clear();
|
||||||
_titleFirstLetters.clear();
|
_titleFirstLetters.clear();
|
||||||
|
|
|
@ -91,6 +91,9 @@ public:
|
||||||
void setClosed(bool closed);
|
void setClosed(bool closed);
|
||||||
void setClosedAndSave(bool closed);
|
void setClosedAndSave(bool closed);
|
||||||
|
|
||||||
|
[[nodiscard]] bool hidden() const;
|
||||||
|
void setHidden(bool hidden);
|
||||||
|
|
||||||
[[nodiscard]] bool creating() const;
|
[[nodiscard]] bool creating() const;
|
||||||
void discard();
|
void discard();
|
||||||
|
|
||||||
|
@ -162,10 +165,11 @@ public:
|
||||||
private:
|
private:
|
||||||
enum class Flag : uchar {
|
enum class Flag : uchar {
|
||||||
Closed = (1 << 0),
|
Closed = (1 << 0),
|
||||||
My = (1 << 1),
|
Hidden = (1 << 1),
|
||||||
HasPinnedMessages = (1 << 2),
|
My = (1 << 2),
|
||||||
GeneralIconActive = (1 << 3),
|
HasPinnedMessages = (1 << 3),
|
||||||
GeneralIconSelected = (1 << 4),
|
GeneralIconActive = (1 << 4),
|
||||||
|
GeneralIconSelected = (1 << 5),
|
||||||
};
|
};
|
||||||
friend inline constexpr bool is_flag_type(Flag) { return true; }
|
friend inline constexpr bool is_flag_type(Flag) { return true; }
|
||||||
using Flags = base::flags<Flag>;
|
using Flags = base::flags<Flag>;
|
||||||
|
|
|
@ -1216,6 +1216,9 @@ void History::applyServiceChanges(
|
||||||
if (const auto closed = data.vclosed()) {
|
if (const auto closed = data.vclosed()) {
|
||||||
topic->setClosed(mtpIsTrue(*closed));
|
topic->setClosed(mtpIsTrue(*closed));
|
||||||
}
|
}
|
||||||
|
if (const auto hidden = data.vhidden()) {
|
||||||
|
topic->setHidden(mtpIsTrue(*hidden));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [](const auto &) {
|
}, [](const auto &) {
|
||||||
});
|
});
|
||||||
|
|
|
@ -1343,8 +1343,10 @@ MsgId HistoryService::topicRootId() const {
|
||||||
if (const auto data = GetDependentData()
|
if (const auto data = GetDependentData()
|
||||||
; data && data->topicPost && data->topId) {
|
; data && data->topicPost && data->topId) {
|
||||||
return data->topId;
|
return data->topId;
|
||||||
} else if (Has<HistoryServiceTopicInfo>()) {
|
} else if (const auto info = Get<HistoryServiceTopicInfo>()) {
|
||||||
return id;
|
if (info->created()) {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Data::ForumTopic::kGeneralId;
|
return Data::ForumTopic::kGeneralId;
|
||||||
}
|
}
|
||||||
|
@ -1514,6 +1516,10 @@ void HistoryService::createFromMtp(const MTPDmessageService &message) {
|
||||||
info->closed = mtpIsTrue(*closed);
|
info->closed = mtpIsTrue(*closed);
|
||||||
info->reopened = !info->closed;
|
info->reopened = !info->closed;
|
||||||
}
|
}
|
||||||
|
if (const auto hidden = data.vhidden()) {
|
||||||
|
info->hidden = mtpIsTrue(*hidden);
|
||||||
|
info->unhidden = !info->hidden;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const auto &data = action.c_messageActionTopicCreate();
|
const auto &data = action.c_messageActionTopicCreate();
|
||||||
info->title = qs(data.vtitle());
|
info->title = qs(data.vtitle());
|
||||||
|
|
|
@ -36,6 +36,17 @@ struct HistoryServiceTopicInfo
|
||||||
bool reopened = false;
|
bool reopened = false;
|
||||||
bool reiconed = false;
|
bool reiconed = false;
|
||||||
bool renamed = false;
|
bool renamed = false;
|
||||||
|
bool hidden = false;
|
||||||
|
bool unhidden = false;
|
||||||
|
|
||||||
|
[[nodiscard]] bool created() const {
|
||||||
|
return !closed
|
||||||
|
&& !reopened
|
||||||
|
&& !reiconed
|
||||||
|
&& !renamed
|
||||||
|
&& !hidden
|
||||||
|
&& !unhidden;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HistoryServiceGameScore
|
struct HistoryServiceGameScore
|
||||||
|
|
Loading…
Add table
Reference in a new issue