mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-25 01:50:36 +00:00
Fixed updating over state in history widget when edit spoiler of media.
This commit is contained in:
parent
4ee7d46d78
commit
13737577e7
@ -330,6 +330,10 @@ HistoryWidget::HistoryWidget(
|
||||
_fieldBarCancel->addClickHandler([=] { cancelFieldAreaState(); });
|
||||
_send->addClickHandler([=] { sendButtonClicked(); });
|
||||
|
||||
_mediaEditManager.updateRequests() | rpl::start_with_next([this] {
|
||||
updateOverStates(mapFromGlobal(QCursor::pos()));
|
||||
}, lifetime());
|
||||
|
||||
{
|
||||
using namespace SendMenu;
|
||||
const auto sendAction = [=](Action action, Details) {
|
||||
|
@ -53,6 +53,7 @@ void MediaEditManager::apply(SendMenu::Action action) {
|
||||
} else if (action.type == Type::SpoilerOff) {
|
||||
_spoilered = false;
|
||||
}
|
||||
_updateRequests.fire({});
|
||||
}
|
||||
|
||||
void MediaEditManager::cancel() {
|
||||
@ -145,6 +146,10 @@ SendMenu::Details MediaEditManager::sendMenuDetails(
|
||||
};
|
||||
}
|
||||
|
||||
rpl::producer<> MediaEditManager::updateRequests() const {
|
||||
return _updateRequests.events();
|
||||
}
|
||||
|
||||
bool MediaEditManager::CanBeSpoilered(not_null<HistoryItem*> item) {
|
||||
const auto media = item ? item->media() : nullptr;
|
||||
const auto editingMedia = media && media->allowsEditMedia();
|
||||
|
@ -48,6 +48,8 @@ public:
|
||||
[[nodiscard]] SendMenu::Details sendMenuDetails(
|
||||
bool hasCaptionText) const;
|
||||
|
||||
[[nodiscard]] rpl::producer<> updateRequests() const;
|
||||
|
||||
[[nodiscard]] explicit operator bool() const {
|
||||
return _item != nullptr;
|
||||
}
|
||||
@ -60,6 +62,8 @@ private:
|
||||
bool _spoilered = false;
|
||||
bool _invertCaption = false;
|
||||
|
||||
rpl::event_stream<> _updateRequests;
|
||||
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user