2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add edit / view of user information for support.

This commit is contained in:
John Preston
2018-11-20 19:36:36 +04:00
parent 5e1b8212b2
commit 9a8ab84ecb
13 changed files with 407 additions and 43 deletions

View File

@@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "info/profile/info_profile_values.h"
#include "info/profile/info_profile_button.h"
#include "info/profile/info_profile_text.h"
#include "support/support_helper.h"
#include "window/window_controller.h"
#include "window/window_peer_menu.h"
#include "mainwidget.h"
@@ -210,19 +211,28 @@ DetailsFiller::DetailsFiller(
object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
auto result = object_ptr<Ui::VerticalLayout>(_wrap);
auto tracker = Ui::MultiSlideTracker();
auto addInfoLine = [&](
LangKey label,
auto addInfoLineGeneric = [&](
rpl::producer<QString> label,
rpl::producer<TextWithEntities> &&text,
const style::FlatLabel &textSt = st::infoLabeled) {
auto line = CreateTextWithLabel(
result,
Lang::Viewer(label) | WithEmptyEntities(),
std::move(label) | WithEmptyEntities(),
std::move(text),
textSt,
st::infoProfileLabeledPadding);
tracker.track(result->add(std::move(line.wrap)));
return line.text;
};
auto addInfoLine = [&](
LangKey label,
rpl::producer<TextWithEntities> &&text,
const style::FlatLabel &textSt = st::infoLabeled) {
return addInfoLineGeneric(
Lang::Viewer(label),
std::move(text),
textSt);
};
auto addInfoOneLine = [&](
LangKey label,
rpl::producer<TextWithEntities> &&text,
@@ -236,6 +246,12 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
return result;
};
if (auto user = _peer->asUser()) {
if (Auth().supportMode()) {
addInfoLineGeneric(
Auth().supportHelper().infoLabelValue(user),
Auth().supportHelper().infoTextValue(user));
}
addInfoOneLine(
lng_info_mobile_label,
PhoneValue(user),