]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/showgroup.php
Clean up edge cases in OStatus FeedDiscoveryTest
[quix0rs-gnu-social.git] / actions / showgroup.php
index 6e06666909a10b31831859334e1fd4659cbe4eb3..9a12bafaf62aba1b4ff763738f1125c558f8cf19 100644 (file)
@@ -316,6 +316,12 @@ class ShowgroupAction extends GroupDesignAction
             Event::handle('EndGroupSubscribe', array($this, $this->group));
         }
         $this->elementEnd('li');
+        if ($cur->hasRight(Right::DELETEGROUP)) {
+            $this->elementStart('li', 'entity_delete');
+            $df = new DeleteGroupForm($this, $this->group);
+            $df->show();
+            $this->elementEnd('li');
+        }
         $this->elementEnd('ul');
         $this->elementEnd('div');
     }
@@ -392,8 +398,8 @@ class ShowgroupAction extends GroupDesignAction
 
             $this->element('h2', null, _('Members'));
 
-            $pml = new ProfileMiniList($member, $this);
-            $cnt = $pml->show();
+            $gmml = new GroupMembersMiniList($member, $this);
+            $cnt = $gmml->show();
             if ($cnt == 0) {
                 $this->element('p', null, _('(None)'));
             }
@@ -430,14 +436,6 @@ class ShowgroupAction extends GroupDesignAction
 
     function showStatistics()
     {
-        // XXX: WORM cache this
-        $members = $this->group->getMembers();
-        $members_count = 0;
-        /** $member->count() doesn't work. */
-        while ($members->fetch()) {
-            $members_count++;
-        }
-
         $this->elementStart('div', array('id' => 'entity_statistics',
                                          'class' => 'section'));
 
@@ -451,7 +449,7 @@ class ShowgroupAction extends GroupDesignAction
 
         $this->elementStart('dl', 'entity_members');
         $this->element('dt', null, _('Members'));
-        $this->element('dd', null, (is_int($members_count)) ? $members_count : '0');
+        $this->element('dd', null, $this->group->getMemberCount());
         $this->elementEnd('dl');
 
         $this->elementEnd('div');
@@ -507,3 +505,26 @@ class GroupAdminSection extends ProfileSection
         return null;
     }
 }
+
+class GroupMembersMiniList extends ProfileMiniList
+{
+    function newListItem($profile)
+    {
+        return new GroupMembersMiniListItem($profile, $this->action);
+    }
+}
+
+class GroupMembersMiniListItem extends ProfileMiniListItem
+{
+    function linkAttributes()
+    {
+        $aAttrs = parent::linkAttributes();
+
+        if (common_config('nofollow', 'members')) {
+            $aAttrs['rel'] .= ' nofollow';
+        }
+
+        return $aAttrs;
+    }
+}
+