2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Show phone number only in the chat top bar.

This commit is contained in:
John Preston
2019-06-12 12:45:06 +02:00
parent aca3ec0ab8
commit e9677779b8
10 changed files with 43 additions and 29 deletions

View File

@@ -100,7 +100,7 @@ PeerData::PeerData(not_null<Data::Session*> owner, PeerId id)
: id(id)
, _owner(owner)
, _userpicEmpty(createEmptyUserpic()) {
nameText.setText(st::msgNameStyle, QString(), Ui::NameTextOptions());
_nameText.setText(st::msgNameStyle, QString(), Ui::NameTextOptions());
}
Data::Session &PeerData::owner() const {
@@ -134,7 +134,7 @@ void PeerData::updateNameDelayed(
}
}
name = newName;
nameText.setText(st::msgNameStyle, name, Ui::NameTextOptions());
_nameText.setText(st::msgNameStyle, name, Ui::NameTextOptions());
refreshEmptyUserpic();
Notify::PeerUpdate update(this);
if (nameVersion++ > 1) {
@@ -592,12 +592,22 @@ not_null<const PeerData*> PeerData::migrateToOrMe() const {
return this;
}
const Text &PeerData::dialogName() const {
return migrateTo()
? migrateTo()->dialogName()
: (isUser() && !asUser()->phoneText.isEmpty())
? asUser()->phoneText
: nameText;
const Text &PeerData::topBarNameText() const {
if (const auto to = migrateTo()) {
return to->topBarNameText();
} else if (const auto user = asUser()) {
if (!user->phoneText.isEmpty()) {
return user->phoneText;
}
}
return _nameText;
}
const Text &PeerData::nameText() const {
if (const auto to = migrateTo()) {
return to->nameText();
}
return _nameText;
}
const QString &PeerData::shortName() const {