mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
Fix minimal width of message bubble with comments.
This commit is contained in:
parent
3a51303fb0
commit
e9dffe78e3
2 changed files with 35 additions and 5 deletions
|
@ -751,7 +751,14 @@ bool PeerData::isBroadcast() const {
|
|||
}
|
||||
|
||||
bool PeerData::isRepliesChat() const {
|
||||
return (id == peerFromUser(708513));
|
||||
constexpr auto kProductionId = peerFromUser(1271266957);
|
||||
constexpr auto kTestId = peerFromUser(708513);
|
||||
if (id != kTestId && id != kProductionId) {
|
||||
return false;
|
||||
}
|
||||
return ((session().mtp().environment() == MTP::Environment::Production)
|
||||
? kProductionId
|
||||
: kTestId) == id;
|
||||
}
|
||||
|
||||
bool PeerData::canWrite() const {
|
||||
|
|
|
@ -255,10 +255,11 @@ QSize Message::performCountOptimalSize() {
|
|||
}
|
||||
|
||||
if (drawBubble()) {
|
||||
auto forwarded = item->Get<HistoryMessageForwarded>();
|
||||
auto reply = displayedReply();
|
||||
auto via = item->Get<HistoryMessageVia>();
|
||||
auto entry = logEntryOriginal();
|
||||
const auto forwarded = item->Get<HistoryMessageForwarded>();
|
||||
const auto reply = displayedReply();
|
||||
const auto via = item->Get<HistoryMessageVia>();
|
||||
const auto entry = logEntryOriginal();
|
||||
const auto views = item->Get<HistoryMessageViews>();
|
||||
if (forwarded) {
|
||||
forwarded->create(via);
|
||||
}
|
||||
|
@ -362,6 +363,28 @@ QSize Message::performCountOptimalSize() {
|
|||
minHeight += entry->minHeight();
|
||||
}
|
||||
}
|
||||
if (item->repliesAreComments() && !views->replies.text.isEmpty()) {
|
||||
const auto limit = HistoryMessageViews::kMaxRecentRepliers;
|
||||
const auto single = st::historyCommentsUserpicSize;
|
||||
const auto shift = st::historyCommentsUserpicOverlap;
|
||||
const auto added = single
|
||||
+ (limit - 1) * (single - shift)
|
||||
+ st::historyCommentsSkipLeft
|
||||
+ st::historyCommentsSkipRight
|
||||
+ st::historyCommentsSkipText
|
||||
+ st::historyCommentsOpenOutSelected.width()
|
||||
+ st::historyCommentsSkipRight;
|
||||
accumulate_max(maxWidth, added + views->replies.textWidth);
|
||||
} else if (item->externalReply()) {
|
||||
const auto added = st::historyCommentsIn.width()
|
||||
+ st::historyCommentsSkipLeft
|
||||
+ st::historyCommentsSkipRight
|
||||
+ st::historyCommentsSkipText
|
||||
+ st::historyCommentsOpenOutSelected.width()
|
||||
+ st::historyCommentsSkipRight;
|
||||
accumulate_max(maxWidth, added + st::semiboldFont->width(
|
||||
tr::lng_replies_view_original(tr::now)));
|
||||
}
|
||||
} else if (media) {
|
||||
media->initDimensions();
|
||||
maxWidth = media->maxWidth();
|
||||
|
|
Loading…
Add table
Reference in a new issue