mirror of https://github.com/procxx/kepka.git
Make links clickable in channel descriptions.
This commit is contained in:
parent
41873412e7
commit
747ebd2136
|
@ -80,29 +80,36 @@ rpl::producer<TextWithEntities> UsernameValue(
|
||||||
| WithEmptyEntities();
|
| WithEmptyEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<TextWithEntities> AboutValue(
|
rpl::producer<QString> PlainAboutValue(
|
||||||
not_null<PeerData*> peer) {
|
not_null<PeerData*> peer) {
|
||||||
if (auto channel = peer->asChannel()) {
|
if (auto channel = peer->asChannel()) {
|
||||||
return Notify::PeerUpdateValue(
|
return Notify::PeerUpdateValue(
|
||||||
channel,
|
channel,
|
||||||
Notify::PeerUpdate::Flag::AboutChanged)
|
Notify::PeerUpdate::Flag::AboutChanged)
|
||||||
| rpl::map([channel] { return channel->about(); })
|
| rpl::map([channel] { return channel->about(); });
|
||||||
| WithEmptyEntities();
|
|
||||||
} else if (auto user = peer->asUser()) {
|
} else if (auto user = peer->asUser()) {
|
||||||
if (user->botInfo) {
|
if (user->botInfo) {
|
||||||
return PlainBioValue(user)
|
return PlainBioValue(user);
|
||||||
| WithEmptyEntities()
|
|
||||||
| rpl::map([](TextWithEntities &&text) {
|
|
||||||
auto flags = TextParseLinks
|
|
||||||
| TextParseMentions
|
|
||||||
| TextParseHashtags
|
|
||||||
| TextParseBotCommands;
|
|
||||||
TextUtilities::ParseEntities(text, flags);
|
|
||||||
return std::move(text);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rpl::single(TextWithEntities{});
|
return rpl::single(QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
rpl::producer<TextWithEntities> AboutValue(
|
||||||
|
not_null<PeerData*> peer) {
|
||||||
|
auto flags = TextParseLinks
|
||||||
|
| TextParseMentions
|
||||||
|
| TextParseHashtags;
|
||||||
|
if (peer->isUser()) {
|
||||||
|
flags |= TextParseBotCommands;
|
||||||
|
}
|
||||||
|
return PlainAboutValue(peer)
|
||||||
|
| WithEmptyEntities()
|
||||||
|
| rpl::map([=](TextWithEntities &&text) {
|
||||||
|
TextUtilities::ParseEntities(text, flags);
|
||||||
|
return std::move(text);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<QString> LinkValue(
|
rpl::producer<QString> LinkValue(
|
||||||
|
|
Loading…
Reference in New Issue