Add and use get_channel_show_message_sender.
This commit is contained in:
parent
b041bf0e97
commit
cc21a58abf
@ -7850,6 +7850,18 @@ bool ChatManager::get_channel_sign_messages(const Channel *c) {
|
||||
return c->sign_messages;
|
||||
}
|
||||
|
||||
bool ChatManager::get_channel_show_message_sender(ChannelId channel_id) const {
|
||||
auto c = get_channel(channel_id);
|
||||
if (c == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return get_channel_show_message_sender(c);
|
||||
}
|
||||
|
||||
bool ChatManager::get_channel_show_message_sender(const Channel *c) {
|
||||
return c->show_message_sender;
|
||||
}
|
||||
|
||||
bool ChatManager::get_channel_has_linked_channel(ChannelId channel_id) const {
|
||||
auto c = get_channel(channel_id);
|
||||
if (c == nullptr) {
|
||||
|
@ -351,6 +351,7 @@ class ChatManager final : public Actor {
|
||||
bool get_channel_is_fake(ChannelId channel_id) const;
|
||||
int32 get_channel_participant_count(ChannelId channel_id) const;
|
||||
bool get_channel_sign_messages(ChannelId channel_id) const;
|
||||
bool get_channel_show_message_sender(ChannelId channel_id) const;
|
||||
bool get_channel_has_linked_channel(ChannelId channel_id) const;
|
||||
bool get_channel_join_request(ChannelId channel_id) const;
|
||||
bool get_channel_can_be_deleted(ChannelId channel_id) const;
|
||||
@ -703,6 +704,7 @@ class ChatManager final : public Actor {
|
||||
static DialogParticipantStatus get_channel_status(const Channel *c);
|
||||
DialogParticipantStatus get_channel_permissions(ChannelId channel_id, const Channel *c) const;
|
||||
static bool get_channel_sign_messages(const Channel *c);
|
||||
static bool get_channel_show_message_sender(const Channel *c);
|
||||
static bool get_channel_has_linked_channel(const Channel *c);
|
||||
static bool get_channel_can_be_deleted(const Channel *c);
|
||||
static bool get_channel_join_to_send(const Channel *c);
|
||||
|
@ -23288,10 +23288,14 @@ unique_ptr<MessagesManager::Message> MessagesManager::create_message_to_send(
|
||||
bool is_channel_post = td_->dialog_manager_->is_broadcast_channel(dialog_id);
|
||||
if (is_channel_post) {
|
||||
// sender of the post can be hidden
|
||||
if (!is_scheduled && td_->chat_manager_->get_channel_sign_messages(dialog_id.get_channel_id())) {
|
||||
m->author_signature = td_->user_manager_->get_user_title(my_id);
|
||||
if (td_->chat_manager_->get_channel_show_message_sender(dialog_id.get_channel_id())) {
|
||||
m->sender_user_id = my_id;
|
||||
} else {
|
||||
if (!is_scheduled && td_->chat_manager_->get_channel_sign_messages(dialog_id.get_channel_id())) {
|
||||
m->author_signature = td_->user_manager_->get_user_title(my_id);
|
||||
}
|
||||
m->sender_dialog_id = dialog_id;
|
||||
}
|
||||
m->sender_dialog_id = dialog_id;
|
||||
} else {
|
||||
if (send_as_dialog_id.is_valid()) {
|
||||
if (send_as_dialog_id.get_type() == DialogType::User) {
|
||||
@ -27408,7 +27412,7 @@ Result<MessageId> MessagesManager::add_local_message(
|
||||
auto message = make_unique<Message>();
|
||||
auto *m = message.get();
|
||||
m->message_id = message_id;
|
||||
if (is_channel_post) {
|
||||
if (is_channel_post && !td_->chat_manager_->get_channel_show_message_sender(dialog_id.get_channel_id())) {
|
||||
// sender of the post can be hidden
|
||||
if (td_->chat_manager_->get_channel_sign_messages(dialog_id.get_channel_id())) {
|
||||
m->author_signature = td_->user_manager_->get_user_title(sender_user_id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user