mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-01 23:25:15 +00:00
Set name / phone texts on-demand.
This commit is contained in:
@@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_peer_values.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwidget.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
@@ -41,7 +42,7 @@ namespace {
|
||||
list.size() - (throwAwayLastName ? 1 : 0)
|
||||
);
|
||||
const auto wrapName = [](not_null<History*> history) {
|
||||
const auto name = history->peer->name;
|
||||
const auto name = history->peer->name();
|
||||
return TextWithEntities{
|
||||
.text = name,
|
||||
.entities = (history->unreadCount() > 0)
|
||||
@@ -343,4 +344,15 @@ FakeRow::FakeRow(Key searchInChat, not_null<HistoryItem*> item)
|
||||
, _item(item) {
|
||||
}
|
||||
|
||||
const Ui::Text::String &FakeRow::name() const {
|
||||
if (_name.isEmpty()) {
|
||||
const auto from = _searchInChat
|
||||
? _item->displayFrom()
|
||||
: nullptr;
|
||||
const auto peer = from ? from : _item->history()->peer.get();
|
||||
_name.setText(st::msgNameStyle, peer->name(), Ui::NameTextOptions());
|
||||
}
|
||||
return _name;
|
||||
}
|
||||
|
||||
} // namespace Dialogs
|
||||
|
Reference in New Issue
Block a user