]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/User_group.php
Merge commit '5c4a7a10' into nightly
[quix0rs-gnu-social.git] / classes / User_group.php
index 3dc5fd4b2d8e0e1e799fad943b59301621a05ee3..344394a682052ef9d8d3203f1e41491002881837 100644 (file)
@@ -33,6 +33,12 @@ class User_group extends Managed_DataObject
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
+    public function getObjectType()
+    {
+        return ActivityObject::GROUP;
+    }
+
+
     public static function schemaDef()
     {
         return array(
@@ -312,13 +318,21 @@ class User_group extends Managed_DataObject
 
     function setOriginal($filename)
     {
-        $imagefile = new ImageFile($this->id, Avatar::path($filename));
+        // This should be handled by the Profile->setOriginal function so user and group avatars are handled the same
+        $imagefile = new ImageFile(null, Avatar::path($filename));
+
+        $sizes = array('homepage_logo' => AVATAR_PROFILE_SIZE,
+                       'stream_logo' => AVATAR_STREAM_SIZE,
+                       'mini_logo' => AVATAR_MINI_SIZE);
 
         $orig = clone($this);
         $this->original_logo = Avatar::url($filename);
-        $this->homepage_logo = Avatar::url($imagefile->resize(AVATAR_PROFILE_SIZE));
-        $this->stream_logo = Avatar::url($imagefile->resize(AVATAR_STREAM_SIZE));
-        $this->mini_logo = Avatar::url($imagefile->resize(AVATAR_MINI_SIZE));
+        foreach ($sizes as $name=>$size) {
+            $filename = Avatar::filename($this->profile_id, image_type_to_extension($imagefile->preferredType()),
+                                         $size, common_timestamp());
+            $imagefile->resizeTo(Avatar::path($filename), array('width'=>$size, 'height'=>$size));
+            $this->$name = Avatar::url($filename);
+        }
         common_debug(common_log_objstring($this));
         return $this->update($orig);
     }
@@ -810,7 +824,7 @@ class User_group extends Managed_DataObject
     function isPrivate()
     {
         return ($this->join_policy == self::JOIN_POLICY_MODERATE &&
-                $this->force_scope == 1);
+                intval($this->force_scope) === 1);
     }
 
     public function isLocal()