mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fix direct story links for channels.
This commit is contained in:
parent
eaa491518e
commit
846e96579d
3 changed files with 5 additions and 7 deletions
|
@ -776,10 +776,9 @@ QString ApiWrap::exportDirectMessageLink(
|
|||
|
||||
QString ApiWrap::exportDirectStoryLink(not_null<Data::Story*> story) {
|
||||
const auto storyId = story->fullId();
|
||||
const auto user = story->peer()->asUser();
|
||||
Assert(user != nullptr);
|
||||
const auto peer = story->peer();
|
||||
const auto fallback = [&] {
|
||||
const auto base = user->username();
|
||||
const auto base = peer->userName();
|
||||
const auto story = QString::number(storyId.story);
|
||||
const auto query = base + "/s/" + story;
|
||||
return session().createInternalLinkFull(query);
|
||||
|
@ -789,7 +788,7 @@ QString ApiWrap::exportDirectStoryLink(not_null<Data::Story*> story) {
|
|||
? i->second
|
||||
: fallback();
|
||||
request(MTPstories_ExportStoryLink(
|
||||
story->peer()->input,
|
||||
peer->input,
|
||||
MTP_int(story->id())
|
||||
)).done([=](const MTPExportedStoryLink &result) {
|
||||
const auto link = qs(result.data().vlink());
|
||||
|
|
|
@ -370,8 +370,7 @@ bool Story::hasDirectLink() const {
|
|||
if (!_privacyPublic || (!_pinned && expired())) {
|
||||
return false;
|
||||
}
|
||||
const auto user = _peer->asUser();
|
||||
return user && !user->username().isEmpty();
|
||||
return !_peer->userName().isEmpty();
|
||||
}
|
||||
|
||||
std::optional<QString> Story::errorTextForForward(
|
||||
|
|
|
@ -502,7 +502,7 @@ void SessionNavigation::showPeerByLinkResolved(
|
|||
info.messageId,
|
||||
callback);
|
||||
}
|
||||
} else if (peer->isUser() && info.storyId) {
|
||||
} else if (info.storyId) {
|
||||
const auto storyId = FullStoryId{ peer->id, info.storyId };
|
||||
peer->owner().stories().resolve(storyId, crl::guard(this, [=] {
|
||||
if (peer->owner().stories().lookup(storyId)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue