mirror of
https://github.com/friendica/friendica
synced 2025-03-12 18:28:25 +00:00
Merge pull request #14720 from MrPetovan/bug/14099-create-new-group
Show Create new Group link in widget even if there's no group membership to display
This commit is contained in:
commit
4fa82f4c73
2 changed files with 91 additions and 88 deletions
|
@ -97,22 +97,19 @@ class GroupManager
|
|||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @throws \ImagickException
|
||||
*/
|
||||
public static function widget(int $uid)
|
||||
public static function widget(int $uid): string
|
||||
{
|
||||
$o = '';
|
||||
|
||||
//sort by last updated item
|
||||
$lastitem = true;
|
||||
|
||||
$contacts = self::getList($uid, $lastitem, true, true);
|
||||
$contacts = self::getList($uid, true, true, true);
|
||||
$total = count($contacts);
|
||||
$visibleGroups = 10;
|
||||
|
||||
if (DBA::isResult($contacts)) {
|
||||
$id = 0;
|
||||
|
||||
$entries = [];
|
||||
|
||||
$contacts = [];
|
||||
|
||||
foreach ($contacts as $contact) {
|
||||
$entry = [
|
||||
'url' => 'contact/' . $contact['id'] . '/conversations',
|
||||
|
@ -127,7 +124,7 @@ class GroupManager
|
|||
|
||||
$tpl = Renderer::getMarkupTemplate('widget/group_list.tpl');
|
||||
|
||||
$o .= Renderer::replaceMacros(
|
||||
return Renderer::replaceMacros(
|
||||
$tpl,
|
||||
[
|
||||
'$title' => DI::l10n()->t('Groups'),
|
||||
|
@ -138,13 +135,11 @@ class GroupManager
|
|||
'$visible_groups' => $visibleGroups,
|
||||
'$showless' => DI::l10n()->t('show less'),
|
||||
'$showmore' => DI::l10n()->t('show more'),
|
||||
'$create_new_group' => DI::l10n()->t('Create new group')]
|
||||
'$create_new_group' => DI::l10n()->t('Create new group')
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format group list as contact block
|
||||
*
|
||||
|
@ -206,7 +201,11 @@ class GroupManager
|
|||
AND NOT `contact`.`pending` AND NOT `contact`.`archive`
|
||||
AND `contact`.`uid` = ?
|
||||
GROUP BY `contact`.`id`",
|
||||
DI::userSession()->getLocalUserId(), Protocol::DFRN, Protocol::ACTIVITYPUB, Contact::TYPE_COMMUNITY, DI::userSession()->getLocalUserId()
|
||||
DI::userSession()->getLocalUserId(),
|
||||
Protocol::DFRN,
|
||||
Protocol::ACTIVITYPUB,
|
||||
Contact::TYPE_COMMUNITY,
|
||||
DI::userSession()->getLocalUserId()
|
||||
);
|
||||
|
||||
return DBA::toArray($stmtContacts);
|
||||
|
|
|
@ -26,9 +26,11 @@ function showHideGroupList() {
|
|||
<span class="fakelink" onclick="openCloseWidget('group-list-sidebar', 'group-list-sidebar-inflated');">
|
||||
<h3>{{$title}}</h3>
|
||||
</span>
|
||||
{{if $groups}}
|
||||
<a class="group-new-tool pull-right widget-action faded-icon" id="sidebar-new-group" href="{{$new_group_page}}" data-toggle="tooltip" title="{{$create_new_group}}">
|
||||
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div id="sidebar-group-list" class="sidebar-widget-list">
|
||||
{{* The list of available groups *}}
|
||||
|
@ -53,6 +55,8 @@ function showHideGroupList() {
|
|||
<a class="group-widget-link" id="group-widget-link-{{$group.id}}" href="{{$group.url}}">{{$group.name}}</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{foreachelse}}
|
||||
<li><a href="{{$new_group_page}}"><i class="fa fa-plus" aria-hidden="true"></i> {{$create_new_group}}</a></li>
|
||||
{{/foreach}}
|
||||
|
||||
{{if $total > $visible_groups }}
|
||||
|
|
Loading…
Add table
Reference in a new issue