diff --git a/Telegram/SourceFiles/calls/group/calls_group_messages.cpp b/Telegram/SourceFiles/calls/group/calls_group_messages.cpp index e0a7727ee6..dfcebb3695 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_messages.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_messages.cpp @@ -164,6 +164,7 @@ void Messages::send(TextWithTags text, int stars) { _sendingIdByRandomId.emplace(randomId, localId); const auto from = _call->messagesFrom(); + const auto creator = _real->creator(); const auto skip = skipMessage(prepared, stars); if (skip) { _skippedIds.emplace(localId); @@ -173,7 +174,7 @@ void Messages::send(TextWithTags text, int stars) { .peer = from, .text = std::move(prepared), .stars = stars, - .admin = (from == _call->peer()), + .admin = (from == _call->peer()) || (creator && from->isSelf()), .mine = true, }); } @@ -233,7 +234,8 @@ void Messages::received(const MTPDupdateGroupCallMessage &data) { fields.vfrom_id(), fields.vmessage(), fields.vdate().v, - fields.vpaid_message_stars().value_or_empty()); + fields.vpaid_message_stars().value_or_empty(), + fields.is_from_admin()); } void Messages::received(const MTPDupdateGroupCallEncryptedMessage &data) { @@ -268,6 +270,7 @@ void Messages::received(const MTPDupdateGroupCallEncryptedMessage &data) { deserialized->message, base::unixtime::now(), // date 0, // stars + false, true); // checkCustomEmoji } @@ -332,6 +335,7 @@ void Messages::received( const MTPTextWithEntities &message, TimeId date, int stars, + bool fromAdmin, bool checkCustomEmoji) { const auto peer = _call->peer(); const auto i = ranges::find(_messages, id, &Message::id); @@ -381,7 +385,7 @@ void Messages::received( .peer = author, .text = std::move(text), .stars = stars, - .admin = (author == _call->peer()), + .admin = fromAdmin, .mine = mine, }); ranges::sort(_messages, ranges::less(), &Message::id); diff --git a/Telegram/SourceFiles/calls/group/calls_group_messages.h b/Telegram/SourceFiles/calls/group/calls_group_messages.h index 3d0d2bf6ed..ff465c9735 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_messages.h +++ b/Telegram/SourceFiles/calls/group/calls_group_messages.h @@ -145,6 +145,7 @@ private: const MTPTextWithEntities &message, TimeId date, int stars, + bool fromAdmin, bool checkCustomEmoji = false); void sent(uint64 randomId, const MTP::Response &response); void sent(uint64 randomId, MsgId realId); diff --git a/Telegram/SourceFiles/calls/group/calls_group_messages_ui.cpp b/Telegram/SourceFiles/calls/group/calls_group_messages_ui.cpp index c7b94ac400..03ac456660 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_messages_ui.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_messages_ui.cpp @@ -551,7 +551,14 @@ void MessagesUi::updateMessageSize(MessageView &entry) { entry.left = _streamMode ? 0 : (_width - entry.width) / 2; entry.textLeft = leftSkip; entry.textTop = padding.top() + nameHeight; - entry.nameWidth = std::min(entry.width - widthSkip, nameWidth); + entry.nameWidth = std::min( + nameWidth, + (entry.width + - widthSkip + - space + - _liveBadge.maxWidth() + - space + - _adminBadge.maxWidth())); updateReactionPosition(entry); const auto contentHeight = entry.textTop + textHeight + padding.bottom(); @@ -1275,6 +1282,7 @@ void MessagesUi::setupMessagesWidget() { }, .availableWidth = entry.nameWidth, .palette = &st::groupCallMessagePalette, + .elisionLines = 1, }); const auto liveLeft = x + textLeft + entry.nameWidth + space; _liveBadge.draw(p, { diff --git a/Telegram/SourceFiles/data/data_group_call.cpp b/Telegram/SourceFiles/data/data_group_call.cpp index bf5bb9de88..7318e271db 100644 --- a/Telegram/SourceFiles/data/data_group_call.cpp +++ b/Telegram/SourceFiles/data/data_group_call.cpp @@ -147,6 +147,10 @@ GroupCallOrigin GroupCall::origin() const { : GroupCallOrigin::Group; } +bool GroupCall::creator() const { + return _creator; +} + bool GroupCall::canManage() const { return _conference ? _creator : _peer->canManageGroupCall(); } diff --git a/Telegram/SourceFiles/data/data_group_call.h b/Telegram/SourceFiles/data/data_group_call.h index 9709d55898..a97f7246a1 100644 --- a/Telegram/SourceFiles/data/data_group_call.h +++ b/Telegram/SourceFiles/data/data_group_call.h @@ -84,6 +84,7 @@ public: [[nodiscard]] rpl::producer loadedValue() const; [[nodiscard]] bool rtmp() const; [[nodiscard]] GroupCallOrigin origin() const; + [[nodiscard]] bool creator() const; [[nodiscard]] bool canManage() const; [[nodiscard]] bool listenersHidden() const; [[nodiscard]] bool blockchainMayBeEmpty() const;