mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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) {
|
QString ApiWrap::exportDirectStoryLink(not_null<Data::Story*> story) {
|
||||||
const auto storyId = story->fullId();
|
const auto storyId = story->fullId();
|
||||||
const auto user = story->peer()->asUser();
|
const auto peer = story->peer();
|
||||||
Assert(user != nullptr);
|
|
||||||
const auto fallback = [&] {
|
const auto fallback = [&] {
|
||||||
const auto base = user->username();
|
const auto base = peer->userName();
|
||||||
const auto story = QString::number(storyId.story);
|
const auto story = QString::number(storyId.story);
|
||||||
const auto query = base + "/s/" + story;
|
const auto query = base + "/s/" + story;
|
||||||
return session().createInternalLinkFull(query);
|
return session().createInternalLinkFull(query);
|
||||||
|
@ -789,7 +788,7 @@ QString ApiWrap::exportDirectStoryLink(not_null<Data::Story*> story) {
|
||||||
? i->second
|
? i->second
|
||||||
: fallback();
|
: fallback();
|
||||||
request(MTPstories_ExportStoryLink(
|
request(MTPstories_ExportStoryLink(
|
||||||
story->peer()->input,
|
peer->input,
|
||||||
MTP_int(story->id())
|
MTP_int(story->id())
|
||||||
)).done([=](const MTPExportedStoryLink &result) {
|
)).done([=](const MTPExportedStoryLink &result) {
|
||||||
const auto link = qs(result.data().vlink());
|
const auto link = qs(result.data().vlink());
|
||||||
|
|
|
@ -370,8 +370,7 @@ bool Story::hasDirectLink() const {
|
||||||
if (!_privacyPublic || (!_pinned && expired())) {
|
if (!_privacyPublic || (!_pinned && expired())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto user = _peer->asUser();
|
return !_peer->userName().isEmpty();
|
||||||
return user && !user->username().isEmpty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<QString> Story::errorTextForForward(
|
std::optional<QString> Story::errorTextForForward(
|
||||||
|
|
|
@ -502,7 +502,7 @@ void SessionNavigation::showPeerByLinkResolved(
|
||||||
info.messageId,
|
info.messageId,
|
||||||
callback);
|
callback);
|
||||||
}
|
}
|
||||||
} else if (peer->isUser() && info.storyId) {
|
} else if (info.storyId) {
|
||||||
const auto storyId = FullStoryId{ peer->id, info.storyId };
|
const auto storyId = FullStoryId{ peer->id, info.storyId };
|
||||||
peer->owner().stories().resolve(storyId, crl::guard(this, [=] {
|
peer->owner().stories().resolve(storyId, crl::guard(this, [=] {
|
||||||
if (peer->owner().stories().lookup(storyId)) {
|
if (peer->owner().stories().lookup(storyId)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue