mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
85e8c75ad1
3 changed files with 43 additions and 5 deletions
|
@ -35,6 +35,17 @@ QString IDString(not_null<PeerData *> peer) {
|
|||
return resultId;
|
||||
}
|
||||
|
||||
QString IDString(MsgId topic_root_id) {
|
||||
auto resultId = QString::number(topic_root_id.bare);
|
||||
|
||||
return resultId;
|
||||
}
|
||||
|
||||
|
||||
rpl::producer<TextWithEntities> IDValue(not_null<PeerData *> peer) {
|
||||
return rpl::single(IDString(peer)) | Ui::Text::ToWithEntities();
|
||||
}
|
||||
|
||||
rpl::producer<TextWithEntities> IDValue(MsgId topic_root_id) {
|
||||
return rpl::single(IDString(topic_root_id)) | Ui::Text::ToWithEntities();
|
||||
}
|
|
@ -9,5 +9,7 @@
|
|||
|
||||
|
||||
QString IDString(not_null<PeerData *> peer);
|
||||
QString IDString(MsgId topic_root_id);
|
||||
|
||||
rpl::producer<TextWithEntities> IDValue(not_null<PeerData *> peer);
|
||||
rpl::producer<TextWithEntities> IDValue(not_null<PeerData *> peer);
|
||||
rpl::producer<TextWithEntities> IDValue(MsgId topic_root_id);
|
|
@ -482,6 +482,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
|||
}
|
||||
|
||||
if (settings->showPeerId != 0) {
|
||||
|
||||
auto idDrawableText = IDValue(
|
||||
user
|
||||
) | rpl::map([](TextWithEntities &&text) {
|
||||
|
@ -565,12 +566,12 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
|||
addTranslateToMenu(about.text, AboutValue(_peer));
|
||||
}
|
||||
|
||||
if (settings->showPeerId != 0) {
|
||||
if (settings->showPeerId != 0 && !_topic) {
|
||||
auto idDrawableText = IDValue(
|
||||
_peer
|
||||
) | rpl::map([](TextWithEntities &&text) {
|
||||
return Ui::Text::Code(text.text);
|
||||
});
|
||||
) | rpl::map([](TextWithEntities &&text) {
|
||||
return Ui::Text::Code(text.text);
|
||||
});
|
||||
auto idInfo = addInfoOneLine(
|
||||
rpl::single(QString("ID")),
|
||||
std::move(idDrawableText),
|
||||
|
@ -587,6 +588,30 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
|||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if (settings->showPeerId != 0 && _topic) {
|
||||
const auto topicRootId = _topic->rootId();
|
||||
auto idDrawableText = IDValue(
|
||||
_peer->forumTopicFor(topicRootId)->topicRootId()
|
||||
) | rpl::map([](TextWithEntities &&text) {
|
||||
return Ui::Text::Code(text.text);
|
||||
});
|
||||
auto idInfo = addInfoOneLine(
|
||||
rpl::single(QString("ID")),
|
||||
std::move(idDrawableText),
|
||||
tr::ayu_ContextCopyID(tr::now)
|
||||
);
|
||||
|
||||
idInfo.text->setClickHandlerFilter([=, peer = _peer](auto &&...) {
|
||||
const auto idText = IDString(peer);
|
||||
if (!idText.isEmpty()) {
|
||||
QGuiApplication::clipboard()->setText(idText);
|
||||
const auto msg = tr::ayu_IDCopiedToast(tr::now);
|
||||
controller->showToast(msg);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!_peer->isSelf()) {
|
||||
// No notifications toggle for Self => no separator.
|
||||
|
|
Loading…
Add table
Reference in a new issue