Move is_hidden to ForumTopicInfo.
This commit is contained in:
parent
20ba802e48
commit
f6e8e85547
@ -1321,13 +1321,13 @@ forumTopicIcon color:int32 custom_emoji_id:int64 = ForumTopicIcon;
|
||||
//@creator_id Identifier of the creator of the topic
|
||||
//@is_outgoing True, if the topic was created by the current user
|
||||
//@is_closed True, if the topic is closed
|
||||
forumTopicInfo message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_outgoing:Bool is_closed:Bool = ForumTopicInfo;
|
||||
//@is_hidden True, if the topic is hidden above the topic list and closed; for General topic only
|
||||
forumTopicInfo message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo;
|
||||
|
||||
//@description Describes a forum topic
|
||||
//@info Basic information about the topic
|
||||
//@last_message Last message in the topic; may be null
|
||||
//@is_pinned True, if the topic is pinned in the topic list
|
||||
//@is_hidden True, if the topic is hidden above the topic list and closed; for General topic only
|
||||
//@unread_count Number of unread messages in the topic
|
||||
//@last_read_inbox_message_id Identifier of the last read incoming message
|
||||
//@last_read_outbox_message_id Identifier of the last read outgoing message
|
||||
@ -1335,7 +1335,7 @@ forumTopicInfo message_thread_id:int53 name:string icon:forumTopicIcon creation_
|
||||
//@unread_reaction_count Number of messages with unread reactions in the topic
|
||||
//@notification_settings Notification settings for the topic
|
||||
//@draft_message A draft of a message in the topic; may be null
|
||||
forumTopic info:forumTopicInfo last_message:message is_pinned:Bool is_hidden:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings draft_message:draftMessage = ForumTopic;
|
||||
forumTopic info:forumTopicInfo last_message:message is_pinned:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings draft_message:draftMessage = ForumTopic;
|
||||
|
||||
|
||||
//@class RichText @description Describes a text object inside an instant-view web page
|
||||
|
@ -25,7 +25,6 @@ ForumTopic::ForumTopic(Td *td, tl_object_ptr<telegram_api::ForumTopic> &&forum_t
|
||||
auto *forum_topic = static_cast<telegram_api::forumTopic *>(forum_topic_ptr.get());
|
||||
is_short_ = forum_topic->short_;
|
||||
is_pinned_ = forum_topic->pinned_;
|
||||
is_hidden_ = forum_topic->hidden_;
|
||||
notification_settings_ =
|
||||
get_dialog_notification_settings(std::move(forum_topic->notify_settings_), false, false, false, false);
|
||||
draft_message_ = get_draft_message(td->contacts_manager_.get(), std::move(forum_topic->draft_));
|
||||
@ -51,9 +50,9 @@ td_api::object_ptr<td_api::forumTopic> ForumTopic::get_forum_topic_object(Td *td
|
||||
// TODO last_message
|
||||
auto draft_message = get_draft_message_object(draft_message_);
|
||||
return td_api::make_object<td_api::forumTopic>(
|
||||
info.get_forum_topic_info_object(td), nullptr, is_pinned_, is_hidden_, unread_count_,
|
||||
last_read_inbox_message_id_.get(), last_read_outbox_message_id_.get(), unread_mention_count_,
|
||||
unread_reaction_count_, get_chat_notification_settings_object(¬ification_settings_), std::move(draft_message));
|
||||
info.get_forum_topic_info_object(td), nullptr, is_pinned_, unread_count_, last_read_inbox_message_id_.get(),
|
||||
last_read_outbox_message_id_.get(), unread_mention_count_, unread_reaction_count_,
|
||||
get_chat_notification_settings_object(¬ification_settings_), std::move(draft_message));
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -22,7 +22,6 @@ class Td;
|
||||
class ForumTopic {
|
||||
bool is_short_ = false;
|
||||
bool is_pinned_ = false;
|
||||
bool is_hidden_ = false;
|
||||
int32 unread_count_ = 0;
|
||||
MessageId last_message_id_;
|
||||
MessageId last_read_inbox_message_id_;
|
||||
|
@ -28,6 +28,7 @@ ForumTopicInfo::ForumTopicInfo(const tl_object_ptr<telegram_api::ForumTopic> &fo
|
||||
creator_dialog_id_ = DialogId(forum_topic->from_id_);
|
||||
is_outgoing_ = forum_topic->my_;
|
||||
is_closed_ = forum_topic->closed_;
|
||||
is_hidden_ = forum_topic->hidden_;
|
||||
|
||||
if (creation_date_ <= 0 || !top_thread_message_id_.is_valid() || !creator_dialog_id_.is_valid()) {
|
||||
LOG(ERROR) << "Receive " << to_string(forum_topic_ptr);
|
||||
@ -48,6 +49,10 @@ bool ForumTopicInfo::apply_edited_data(const ForumTopicEditedData &edited_data)
|
||||
is_closed_ = edited_data.is_closed_;
|
||||
is_changed = true;
|
||||
}
|
||||
if (edited_data.edit_is_hidden_ && edited_data.is_hidden_ != is_hidden_) {
|
||||
is_hidden_ = edited_data.is_hidden_;
|
||||
is_changed = true;
|
||||
}
|
||||
return is_changed;
|
||||
}
|
||||
|
||||
@ -59,14 +64,14 @@ td_api::object_ptr<td_api::forumTopicInfo> ForumTopicInfo::get_forum_topic_info_
|
||||
auto creator_id = get_message_sender_object_const(td, creator_dialog_id_, "get_forum_topic_info_object");
|
||||
return td_api::make_object<td_api::forumTopicInfo>(top_thread_message_id_.get(), title_,
|
||||
icon_.get_forum_topic_icon_object(), creation_date_,
|
||||
std::move(creator_id), is_outgoing_, is_closed_);
|
||||
std::move(creator_id), is_outgoing_, is_closed_, is_hidden_);
|
||||
}
|
||||
|
||||
bool operator==(const ForumTopicInfo &lhs, const ForumTopicInfo &rhs) {
|
||||
return lhs.top_thread_message_id_ == rhs.top_thread_message_id_ && lhs.title_ == rhs.title_ &&
|
||||
lhs.icon_ == rhs.icon_ && lhs.creation_date_ == rhs.creation_date_ &&
|
||||
lhs.creator_dialog_id_ == rhs.creator_dialog_id_ && lhs.is_outgoing_ == rhs.is_outgoing_ &&
|
||||
lhs.is_closed_ == rhs.is_closed_;
|
||||
lhs.is_closed_ == rhs.is_closed_ && lhs.is_hidden_ == rhs.is_hidden_;
|
||||
}
|
||||
|
||||
bool operator!=(const ForumTopicInfo &lhs, const ForumTopicInfo &rhs) {
|
||||
|
@ -28,6 +28,7 @@ class ForumTopicInfo {
|
||||
DialogId creator_dialog_id_;
|
||||
bool is_outgoing_ = false;
|
||||
bool is_closed_ = false;
|
||||
bool is_hidden_ = false;
|
||||
|
||||
friend bool operator==(const ForumTopicInfo &lhs, const ForumTopicInfo &rhs);
|
||||
friend bool operator!=(const ForumTopicInfo &lhs, const ForumTopicInfo &rhs);
|
||||
@ -40,14 +41,15 @@ class ForumTopicInfo {
|
||||
explicit ForumTopicInfo(const tl_object_ptr<telegram_api::ForumTopic> &forum_topic_ptr);
|
||||
|
||||
ForumTopicInfo(MessageId top_thread_message_id, string title, ForumTopicIcon icon, int32 creation_date,
|
||||
DialogId creator_dialog_id, bool is_outgoing, bool is_closed)
|
||||
DialogId creator_dialog_id, bool is_outgoing, bool is_closed, bool is_hidden)
|
||||
: top_thread_message_id_(top_thread_message_id)
|
||||
, title_(std::move(title))
|
||||
, icon_(std::move(icon))
|
||||
, creation_date_(creation_date)
|
||||
, creator_dialog_id_(creator_dialog_id)
|
||||
, is_outgoing_(is_outgoing)
|
||||
, is_closed_(is_closed) {
|
||||
, is_closed_(is_closed)
|
||||
, is_hidden_(is_hidden) {
|
||||
}
|
||||
|
||||
bool is_empty() const {
|
||||
@ -70,6 +72,10 @@ class ForumTopicInfo {
|
||||
return is_closed_;
|
||||
}
|
||||
|
||||
bool is_hidden() const {
|
||||
return is_hidden_;
|
||||
}
|
||||
|
||||
bool apply_edited_data(const ForumTopicEditedData &edited_data);
|
||||
|
||||
td_api::object_ptr<td_api::forumTopicInfo> get_forum_topic_info_object(Td *td) const;
|
||||
|
@ -20,6 +20,7 @@ void ForumTopicInfo::store(StorerT &storer) const {
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(is_outgoing_);
|
||||
STORE_FLAG(is_closed_);
|
||||
STORE_FLAG(is_hidden_);
|
||||
END_STORE_FLAGS();
|
||||
td::store(top_thread_message_id_, storer);
|
||||
td::store(title_, storer);
|
||||
@ -33,6 +34,7 @@ void ForumTopicInfo::parse(ParserT &parser) {
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(is_outgoing_);
|
||||
PARSE_FLAG(is_closed_);
|
||||
PARSE_FLAG(is_hidden_);
|
||||
END_PARSE_FLAGS();
|
||||
td::parse(top_thread_message_id_, parser);
|
||||
td::parse(title_, parser);
|
||||
|
@ -96,7 +96,7 @@ class CreateForumTopicQuery final : public Td::ResultHandler {
|
||||
auto forum_topic_info =
|
||||
td::make_unique<ForumTopicInfo>(MessageId(ServerMessageId(service_message->id_)), action->title_,
|
||||
ForumTopicIcon(action->icon_color_, action->icon_emoji_id_),
|
||||
service_message->date_, creator_dialog_id_, true, false);
|
||||
service_message->date_, creator_dialog_id_, true, false, false);
|
||||
td_->updates_manager_->on_get_updates(
|
||||
std::move(ptr),
|
||||
PromiseCreator::lambda([dialog_id = DialogId(channel_id_), forum_topic_info = std::move(forum_topic_info),
|
||||
|
Loading…
Reference in New Issue
Block a user