Add messageProperties.can_be_shared_in_story.
This commit is contained in:
parent
2782bf1095
commit
db62de6d3e
@ -3838,6 +3838,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop
|
|||||||
//@can_be_replied_in_another_chat True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage
|
//@can_be_replied_in_another_chat True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage
|
||||||
//@can_be_reported True, if the message can be reported using reportSupergroupSpam or reportChat
|
//@can_be_reported True, if the message can be reported using reportSupergroupSpam or reportChat
|
||||||
//@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options
|
//@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options
|
||||||
|
//@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage
|
||||||
//@can_get_added_reactions True, if the list of added reactions is available using getMessageAddedReactions
|
//@can_get_added_reactions True, if the list of added reactions is available using getMessageAddedReactions
|
||||||
//@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or link preview description using getMessageLink
|
//@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or link preview description using getMessageLink
|
||||||
//@can_get_message_thread True, if information about the message thread is available through getMessageThread and getMessageThreadHistory
|
//@can_get_message_thread True, if information about the message thread is available through getMessageThread and getMessageThreadHistory
|
||||||
@ -3845,7 +3846,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop
|
|||||||
//@can_get_statistics True, if the message statistics are available through getMessageStatistics
|
//@can_get_statistics True, if the message statistics are available through getMessageStatistics
|
||||||
//@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers
|
//@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers
|
||||||
//@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions
|
//@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions
|
||||||
messageProperties can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_reported:Bool can_be_saved:Bool can_get_added_reactions:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_report_reactions:Bool = MessageProperties;
|
messageProperties can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_reported:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_get_added_reactions:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_report_reactions:Bool = MessageProperties;
|
||||||
|
|
||||||
|
|
||||||
//@class SearchMessagesFilter @description Represents a filter for message search results
|
//@class SearchMessagesFilter @description Represents a filter for message search results
|
||||||
|
@ -189,9 +189,7 @@ MediaArea::MediaArea(Td *td, td_api::object_ptr<td_api::inputStoryArea> &&input_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!is_old_message_) {
|
if (!is_old_message_) {
|
||||||
if (dialog_id.get_type() != DialogType::Channel ||
|
if (!td->messages_manager_->can_share_message_in_story(message_full_id)) {
|
||||||
!td->messages_manager_->have_message_force(message_full_id, "inputStoryAreaTypeMessage") ||
|
|
||||||
!message_id.is_valid() || !message_id.is_server()) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
message_full_id_ = message_full_id;
|
message_full_id_ = message_full_id;
|
||||||
|
@ -9789,6 +9789,16 @@ bool MessagesManager::can_save_message(DialogId dialog_id, const Message *m) con
|
|||||||
return !td_->dialog_manager_->get_dialog_has_protected_content(dialog_id);
|
return !td_->dialog_manager_->get_dialog_has_protected_content(dialog_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MessagesManager::can_share_message_in_story(MessageFullId message_full_id) {
|
||||||
|
return can_share_message_in_story(message_full_id.get_dialog_id(),
|
||||||
|
get_message_force(message_full_id, "can_share_message_in_story"));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MessagesManager::can_share_message_in_story(DialogId dialog_id, const Message *m) const {
|
||||||
|
return dialog_id.get_type() == DialogType::Channel && m != nullptr && m->message_id.is_valid() &&
|
||||||
|
m->message_id.is_server();
|
||||||
|
}
|
||||||
|
|
||||||
bool MessagesManager::can_get_message_statistics(MessageFullId message_full_id) {
|
bool MessagesManager::can_get_message_statistics(MessageFullId message_full_id) {
|
||||||
return can_get_message_statistics(message_full_id.get_dialog_id(),
|
return can_get_message_statistics(message_full_id.get_dialog_id(),
|
||||||
get_message_force(message_full_id, "can_get_message_statistics"));
|
get_message_force(message_full_id, "can_get_message_statistics"));
|
||||||
@ -17302,7 +17312,7 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa
|
|||||||
if (message_id.is_valid_sponsored()) {
|
if (message_id.is_valid_sponsored()) {
|
||||||
return promise.set_value(td_api::make_object<td_api::messageProperties>(false, false, false, false, false, false,
|
return promise.set_value(td_api::make_object<td_api::messageProperties>(false, false, false, false, false, false,
|
||||||
false, false, false, false, false, false,
|
false, false, false, false, false, false,
|
||||||
false, false, false, false));
|
false, false, false, false, false));
|
||||||
}
|
}
|
||||||
return promise.set_error(Status::Error(400, "Message not found"));
|
return promise.set_error(Status::Error(400, "Message not found"));
|
||||||
}
|
}
|
||||||
@ -17345,6 +17355,7 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa
|
|||||||
(dialog_type != DialogType::Chat || td_->chat_manager_->get_chat_is_active(dialog_id.get_chat_id()));
|
(dialog_type != DialogType::Chat || td_->chat_manager_->get_chat_is_active(dialog_id.get_chat_id()));
|
||||||
auto can_be_replied_in_another_chat = can_be_forwarded && m->message_id.is_server();
|
auto can_be_replied_in_another_chat = can_be_forwarded && m->message_id.is_server();
|
||||||
auto can_be_reported = dialog_type != DialogType::SecretChat && can_report_message(m->message_id).is_ok();
|
auto can_be_reported = dialog_type != DialogType::SecretChat && can_report_message(m->message_id).is_ok();
|
||||||
|
auto can_be_shared_in_story = can_share_message_in_story(dialog_id, m);
|
||||||
auto can_get_added_reactions = m->reactions != nullptr && m->reactions->can_get_added_reactions_;
|
auto can_get_added_reactions = m->reactions != nullptr && m->reactions->can_get_added_reactions_;
|
||||||
auto can_get_statistics = can_get_message_statistics(dialog_id, m);
|
auto can_get_statistics = can_get_message_statistics(dialog_id, m);
|
||||||
auto can_get_message_thread = get_top_thread_message_full_id(dialog_id, m, false).is_ok();
|
auto can_get_message_thread = get_top_thread_message_full_id(dialog_id, m, false).is_ok();
|
||||||
@ -17354,7 +17365,7 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa
|
|||||||
auto can_report_reactions = can_report_message_reactions(dialog_id, m);
|
auto can_report_reactions = can_report_message_reactions(dialog_id, m);
|
||||||
promise.set_value(td_api::make_object<td_api::messageProperties>(
|
promise.set_value(td_api::make_object<td_api::messageProperties>(
|
||||||
can_delete_for_self, can_delete_for_all_users, can_be_edited, can_be_forwarded, can_be_paid, can_be_replied,
|
can_delete_for_self, can_delete_for_all_users, can_be_edited, can_be_forwarded, can_be_paid, can_be_replied,
|
||||||
can_be_replied_in_another_chat, can_be_reported, can_be_saved, can_get_added_reactions,
|
can_be_replied_in_another_chat, can_be_reported, can_be_saved, can_be_shared_in_story, can_get_added_reactions,
|
||||||
can_get_media_timestamp_links, can_get_message_thread, can_get_read_date, can_get_statistics, can_get_viewers,
|
can_get_media_timestamp_links, can_get_message_thread, can_get_read_date, can_get_statistics, can_get_viewers,
|
||||||
can_report_reactions));
|
can_report_reactions));
|
||||||
}
|
}
|
||||||
|
@ -562,6 +562,8 @@ class MessagesManager final : public Actor {
|
|||||||
|
|
||||||
static Status can_report_message(MessageId message_id);
|
static Status can_report_message(MessageId message_id);
|
||||||
|
|
||||||
|
bool can_share_message_in_story(MessageFullId message_full_id);
|
||||||
|
|
||||||
bool can_get_message_statistics(MessageFullId message_full_id);
|
bool can_get_message_statistics(MessageFullId message_full_id);
|
||||||
|
|
||||||
DialogId get_dialog_message_sender(MessageFullId message_full_id);
|
DialogId get_dialog_message_sender(MessageFullId message_full_id);
|
||||||
@ -1917,6 +1919,8 @@ class MessagesManager final : public Actor {
|
|||||||
|
|
||||||
bool can_save_message(DialogId dialog_id, const Message *m) const;
|
bool can_save_message(DialogId dialog_id, const Message *m) const;
|
||||||
|
|
||||||
|
bool can_share_message_in_story(DialogId dialog_id, const Message *m) const;
|
||||||
|
|
||||||
bool can_get_message_statistics(DialogId dialog_id, const Message *m) const;
|
bool can_get_message_statistics(DialogId dialog_id, const Message *m) const;
|
||||||
|
|
||||||
struct CanDeleteDialog {
|
struct CanDeleteDialog {
|
||||||
|
Loading…
Reference in New Issue
Block a user