Merge pull request #13518 from MrPetovan/bug/warnings

Normalize template variables in Widget\VCard
This commit is contained in:
Michael Vogel 2023-10-09 05:29:06 +02:00 committed by GitHub
commit 947ad55185
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 17 deletions

View File

@ -297,7 +297,7 @@ class Item
if ($this->activity->match($item['verb'], Activity::TAG)) { if ($this->activity->match($item['verb'], Activity::TAG)) {
$fields = [ $fields = [
'author-id', 'author-link', 'author-name', 'author-network', 'author-id', 'author-link', 'author-name', 'author-network', 'author-link', 'author-alias',
'verb', 'object-type', 'resource-id', 'body', 'plink' 'verb', 'object-type', 'resource-id', 'body', 'plink'
]; ];
$obj = Post::selectFirst($fields, ['uri' => $item['parent-uri']]); $obj = Post::selectFirst($fields, ['uri' => $item['parent-uri']]);

View File

@ -68,6 +68,8 @@ class VCard
$follow_link = ''; $follow_link = '';
$unfollow_link = ''; $unfollow_link = '';
$wallmessage_link = ''; $wallmessage_link = '';
$mention_label = '';
$mention_link = '';
$showgroup_link = ''; $showgroup_link = '';
$photo = Contact::getPhoto($contact); $photo = Contact::getPhoto($contact);
@ -103,14 +105,12 @@ class VCard
if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) { if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) {
$mention_label = DI::l10n()->t('Post to group'); $mention_label = DI::l10n()->t('Post to group');
$mention_url = 'compose/0?body=!' . $contact['addr']; $mention_link = 'compose/0?body=!' . $contact['addr'];
$showgroup_label = DI::l10n()->t('View group'); $showgroup_link = 'network/group/' . $id;
$showgroup_url = 'network/group/' . $id;
} else { } else {
$mention_label = DI::l10n()->t('Mention'); $mention_label = DI::l10n()->t('Mention');
$mention_url = 'compose/0?body=@' . $contact['addr']; $mention_link = 'compose/0?body=@' . $contact['addr'];
} }
} }
return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [ return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [
@ -131,8 +131,10 @@ class VCard
'$unfollow_link' => $unfollow_link, '$unfollow_link' => $unfollow_link,
'$wallmessage' => DI::l10n()->t('Message'), '$wallmessage' => DI::l10n()->t('Message'),
'$wallmessage_link' => $wallmessage_link, '$wallmessage_link' => $wallmessage_link,
'$mention' => [$mention_label, $mention_url], '$mention' => $mention_label,
'$showgroup' => [$showgroup_label, $showgroup_url] '$mention_link' => $mention_link,
'$showgroup' => DI::l10n()->t('View group'),
'$showgroup_link' => $showgroup_link,
]); ]);
} }
} }

View File

@ -23,6 +23,7 @@ namespace Friendica\Core\Logger\Util;
use Friendica\App\Request; use Friendica\App\Request;
use Friendica\Core\Logger\Capability\IHaveCallIntrospections; use Friendica\Core\Logger\Capability\IHaveCallIntrospections;
use Friendica\Core\System;
/** /**
* Get Introspection information about the current call * Get Introspection information about the current call
@ -86,6 +87,7 @@ class Introspection implements IHaveCallIntrospections
'line' => $trace[$i - 1]['line'] ?? null, 'line' => $trace[$i - 1]['line'] ?? null,
'function' => $trace[$i]['function'] ?? null, 'function' => $trace[$i]['function'] ?? null,
'request-id' => $this->requestId, 'request-id' => $this->requestId,
'stack' => System::callstack(10, 4),
]; ];
} }

View File

@ -41,6 +41,12 @@
{{if $wallmessage_link}} {{if $wallmessage_link}}
<li><a id="wallmessage-link" href="{{$wallmessage_link}}">{{$wallmessage}}</a></li> <li><a id="wallmessage-link" href="{{$wallmessage_link}}">{{$wallmessage}}</a></li>
{{/if}} {{/if}}
{{if $mention_link}}
<li><a id="mention-link" href="{{$mention_link}}">{{$mention}}</a></li>
{{/if}}
{{if $showgroup_link}}
<li><a id="showgroup-link" href="{{$showgroup_link}}">{{$showgroup}}</a></li>
{{/if}}
</ul> </ul>
</div> </div>

View File

@ -56,19 +56,19 @@
</button> </button>
</div> </div>
{{/if}} {{/if}}
{{if $contact.addr}} {{if $mention_link}}
<div id="mention-link-button"> <div id="mention-link-button">
<button type="button" id="mention-link" class="btn btn-labeled btn-primary{{if !$always_open_compose}} modal-open{{/if}}" onclick="openWallMessage('{{$mention.1}}')" titel="{{$mention.0}}" aria-label="{{$mention.0}}"> <button type="button" id="mention-link" class="btn btn-labeled btn-primary{{if !$always_open_compose}} modal-open{{/if}}" onclick="openWallMessage('{{$mention_link}}')" title="{{$mention}}" aria-label="{{$mention}}">
<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.0}}</span> <span class="">{{$mention}}</span>
</button> </button>
</div> </div>
{{/if}} {{/if}}
{{if $contact.forum==1 || $contact.prv==1}} {{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.1}}'"> <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}}">
<span class=""><i class="fa fa-group"></i></span> <span class=""><i class="fa fa-group"></i></span>
<span class="">{{$showgroup.0}}</span> <span class="">{{$showgroup}}</span>
</button> </button>
</div> </div>
{{/if}} {{/if}}