Fixed fast share button's display in section of pinned messages.

This commit is contained in:
23rd 2020-10-30 15:13:48 +03:00 committed by John Preston
parent de459fa1fe
commit 9a2fcdde29
2 changed files with 13 additions and 6 deletions

View file

@ -2075,7 +2075,7 @@ HistoryMessageReply *Message::displayedReply() const {
}
bool Message::displayPinIcon() const {
return data()->isPinned() && context() != Context::Pinned;
return data()->isPinned() && !isPinnedContext();
}
bool Message::hasFromName() const {
@ -2250,7 +2250,7 @@ bool Message::displayFastShare() const {
}
bool Message::displayGoToOriginal() const {
if (context() == Context::Pinned) {
if (isPinnedContext()) {
return !hasOutLayout();
}
const auto item = message();
@ -2305,16 +2305,17 @@ void Message::drawRightAction(
views->repliesSmall.text,
views->repliesSmall.textWidth);
}
} else if (displayFastShare()) {
st::historyFastShareIcon.paintInCenter(p, { left, top, size->width(), size->height() });
} else {
st::historyGoToOriginalIcon.paintInCenter(p, { left, top, size->width(), size->height() });
const auto &icon = (displayFastShare() && !isPinnedContext())
? st::historyFastShareIcon
: st::historyGoToOriginalIcon;
icon.paintInCenter(p, { left, top, size->width(), size->height() });
}
}
ClickHandlerPtr Message::rightActionLink() const {
if (!_rightActionLink) {
if (context() == Context::Pinned) {
if (isPinnedContext()) {
_rightActionLink = goToMessageClickHandler(data());
return _rightActionLink;
} else if (displayRightActionComments()) {
@ -2390,6 +2391,10 @@ ClickHandlerPtr Message::fastReplyLink() const {
return _fastReplyLink;
}
bool Message::isPinnedContext() const {
return context() == Context::Pinned;
}
void Message::updateMediaInBubbleState() {
const auto item = message();
const auto media = this->media();

View file

@ -176,6 +176,8 @@ private:
QSize performCountCurrentSize(int newWidth) override;
bool hasVisibleText() const override;
[[nodiscard]] bool isPinnedContext() const;
[[nodiscard]] bool displayFastShare() const;
[[nodiscard]] bool displayGoToOriginal() const;
[[nodiscard]] ClickHandlerPtr fastReplyLink() const;