mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-29 17:03:03 +02:00
Added handling of group rights changes to scheduled WebPage preview.
Slightly refactored code.
This commit is contained in:
parent
129de6d87f
commit
e862215efb
2 changed files with 26 additions and 20 deletions
|
@ -7,33 +7,33 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "history/view/history_view_compose_controls.h"
|
#include "history/view/history_view_compose_controls.h"
|
||||||
|
|
||||||
#include "base/unixtime.h"
|
|
||||||
#include "data/data_messages.h"
|
|
||||||
#include "data/data_web_page.h"
|
|
||||||
#include "ui/widgets/input_fields.h"
|
|
||||||
#include "ui/special_buttons.h"
|
|
||||||
#include "ui/text_options.h"
|
|
||||||
#include "ui/ui_utility.h"
|
|
||||||
#include "lang/lang_keys.h"
|
|
||||||
#include "base/event_filter.h"
|
#include "base/event_filter.h"
|
||||||
#include "base/call_delayed.h"
|
|
||||||
#include "base/qt_signal_producer.h"
|
#include "base/qt_signal_producer.h"
|
||||||
#include "history/history.h"
|
#include "base/unixtime.h"
|
||||||
#include "history/history_item.h"
|
#include "chat_helpers/emoji_suggestions_widget.h"
|
||||||
#include "history/view/history_view_webpage_preview.h"
|
#include "chat_helpers/message_field.h"
|
||||||
#include "main/main_session.h"
|
|
||||||
#include "data/data_session.h"
|
|
||||||
#include "chat_helpers/tabbed_panel.h"
|
#include "chat_helpers/tabbed_panel.h"
|
||||||
#include "chat_helpers/tabbed_section.h"
|
#include "chat_helpers/tabbed_section.h"
|
||||||
#include "chat_helpers/tabbed_selector.h"
|
#include "chat_helpers/tabbed_selector.h"
|
||||||
#include "chat_helpers/message_field.h"
|
|
||||||
#include "chat_helpers/emoji_suggestions_widget.h"
|
|
||||||
#include "window/window_session_controller.h"
|
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "core/core_settings.h"
|
#include "core/core_settings.h"
|
||||||
#include "inline_bots/inline_results_widget.h"
|
#include "data/data_changes.h"
|
||||||
|
#include "data/data_messages.h"
|
||||||
|
#include "data/data_session.h"
|
||||||
|
#include "data/data_web_page.h"
|
||||||
#include "facades.h"
|
#include "facades.h"
|
||||||
|
#include "history/history.h"
|
||||||
|
#include "history/history_item.h"
|
||||||
|
#include "history/view/history_view_webpage_preview.h"
|
||||||
|
#include "inline_bots/inline_results_widget.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
#include "main/main_session.h"
|
||||||
#include "styles/style_history.h"
|
#include "styles/style_history.h"
|
||||||
|
#include "ui/special_buttons.h"
|
||||||
|
#include "ui/text_options.h"
|
||||||
|
#include "ui/ui_utility.h"
|
||||||
|
#include "ui/widgets/input_fields.h"
|
||||||
|
#include "window/window_session_controller.h"
|
||||||
|
|
||||||
namespace HistoryView {
|
namespace HistoryView {
|
||||||
|
|
||||||
|
@ -859,6 +859,7 @@ void ComposeControls::cancelEditMessage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComposeControls::initWebpageProcess() {
|
void ComposeControls::initWebpageProcess() {
|
||||||
|
Expects(_history);
|
||||||
const auto peer = _history->peer;
|
const auto peer = _history->peer;
|
||||||
auto &lifetime = _wrap->lifetime();
|
auto &lifetime = _wrap->lifetime();
|
||||||
const auto requestRepaint = crl::guard(_header.get(), [=] {
|
const auto requestRepaint = crl::guard(_header.get(), [=] {
|
||||||
|
@ -886,7 +887,6 @@ void ComposeControls::initWebpageProcess() {
|
||||||
auto t = QString();
|
auto t = QString();
|
||||||
auto d = QString();
|
auto d = QString();
|
||||||
if (ShowWebPagePreview(*previewData)) {
|
if (ShowWebPagePreview(*previewData)) {
|
||||||
// updateMouseTracking();
|
|
||||||
if (const auto till = (*previewData)->pendingTill) {
|
if (const auto till = (*previewData)->pendingTill) {
|
||||||
t = tr::lng_preview_loading(tr::now);
|
t = tr::lng_preview_loading(tr::now);
|
||||||
d = (*previewLinks).splitRef(' ').at(0).toString();
|
d = (*previewLinks).splitRef(' ').at(0).toString();
|
||||||
|
@ -990,6 +990,12 @@ void ComposeControls::initWebpageProcess() {
|
||||||
getWebPagePreview();
|
getWebPagePreview();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_window->session().changes().peerUpdates(
|
||||||
|
Data::PeerUpdate::Flag::Rights
|
||||||
|
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
||||||
|
return (update.peer.get() == peer);
|
||||||
|
}) | rpl::start_with_next(checkPreview, lifetime);
|
||||||
|
|
||||||
const auto fieldLinksParser =
|
const auto fieldLinksParser =
|
||||||
lifetime.make_state<MessageLinksParser>(_field);
|
lifetime.make_state<MessageLinksParser>(_field);
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ bool HasEditScheduledMessageAction(const ContextMenuRequest &request) {
|
||||||
}
|
}
|
||||||
const auto peer = item->history()->peer;
|
const auto peer = item->history()->peer;
|
||||||
if (const auto channel = peer->asChannel()) {
|
if (const auto channel = peer->asChannel()) {
|
||||||
if (!channel->canEditMessages()) {
|
if (!channel->isMegagroup() && !channel->canEditMessages()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue