Merge pull request #13609 from MrPetovan/bug/13603-profile-public-cid

Use public contact ID in Model\Profile::getVCardHtml instead of potentially self-contact ID
This commit is contained in:
Michael Vogel 2023-11-06 09:01:06 +01:00 committed by GitHub
commit 0ba3fe3b2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 17 deletions

View File

@ -307,7 +307,12 @@ class Profile
$profile_url = $profile['url']; $profile_url = $profile['url'];
$cid = $profile['id']; $contact = Contact::selectFirst(['id'], ['uri-id' => $profile['uri-id'], 'uid' => 0]);
if (!$contact) {
return $o;
}
$cid = $contact['id'];
$follow_link = null; $follow_link = null;
$unfollow_link = null; $unfollow_link = null;
@ -457,12 +462,12 @@ class Profile
$mention_label = DI::l10n()->t('Post to group'); $mention_label = DI::l10n()->t('Post to group');
$mention_url = 'compose/0?body=!' . $profile['addr']; $mention_url = 'compose/0?body=!' . $profile['addr'];
$network_label = DI::l10n()->t('View group'); $network_label = DI::l10n()->t('View group');
$network_url = 'network/group/' . $profile['id']; $network_url = 'network/group/' . $cid;
} else { } else {
$mention_label = DI::l10n()->t('Mention'); $mention_label = DI::l10n()->t('Mention');
$mention_url = 'compose/0?body=@' . $profile['addr']; $mention_url = 'compose/0?body=@' . $profile['addr'];
$network_label = DI::l10n()->t('Network Posts'); $network_label = DI::l10n()->t('Network Posts');
$network_url = 'contact/' . $profile['id'] . '/conversations'; $network_url = 'contact/' . $cid . '/conversations';
} }
$tpl = Renderer::getMarkupTemplate('profile/vcard.tpl'); $tpl = Renderer::getMarkupTemplate('profile/vcard.tpl');

View File

@ -70,19 +70,21 @@
</button> </button>
</div> </div>
{{/if}} {{/if}}
{{if $profile.addr}} {{if $profile.addr}}
<div id="mention-link-button"> <div id="mention-link-button">
<button type="button" id="mention-link" class="btn btn-labeled btn-primary" onclick="openWallMessage('{{$mention_url}}')"> <button type="button" id="mention-link" class="btn btn-labeled btn-primary" onclick="openWallMessage('{{$mention_url}}')">
<span class=""><i class="fa fa-pencil-square-o"></i></span> <span class=""><i class="fa fa-pencil-square-o"></i></span>
<span class="">{{$mention_label}}</span> <span class="">{{$mention_label}}</span>
</div> </button>
</div>
{{/if}} {{/if}}
{{if $network_label}} {{if $network_label}}
<div id="showgroup-button"> <div id="showgroup-button">
<button type="button" id="showgroup" class="btn btn-labeled btn-primary" onclick="window.location.href=('{{$network_url}}')"> <a id="showgroup" class="btn btn-labeled btn-primary" href="{{$network_url}}">
<span class=""><i class="fa fa-group"></i></span> <span class=""><i class="fa fa-group"></i></span>
<span class="">{{$network_label}}</span> <span class="">{{$network_label}}</span>
</div> </a>
</div>
{{/if}} {{/if}}
</div> </div>
{{/if}} {{/if}}

View File

@ -66,10 +66,10 @@
{{/if}} {{/if}}
{{if $showgroup_link}} {{if $showgroup_link}}
<div id="show-group-button"> <div id="show-group-button">
<button type="button" id="show-group" class="btn btn-labeled btn-primary{{if !$always_open_compose}} modal-open{{/if}}" onclick="window.location.href='{{$showgroup_link}}'" title="{{$showgroup}}" aria-label="{{$showgroup}}"> <a type="button" id="show-group" class="btn btn-labeled btn-primary" href="{{$showgroup_link}}" title="{{$showgroup}}" aria-label="{{$showgroup}}">
<span class=""><i class="fa fa-group"></i></span> <span class=""><i class="fa fa-group"></i></span>
<span class="">{{$showgroup}}</span> <span class="">{{$showgroup}}</span>
</button> </a>
</div> </div>
{{/if}} {{/if}}
</div> </div>