]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Delete the notice *and* the photo
authorMax Shinn <trombonechamp@gmail.com>
Wed, 29 Dec 2010 19:03:23 +0000 (13:03 -0600)
committerMax Shinn <trombonechamp@gmail.com>
Wed, 29 Dec 2010 19:03:23 +0000 (13:03 -0600)
plugins/GNUsocialPhotos/actions/editphoto.php

index eacd09156da9100c326c7fb76091d60a84b1c93a..e32b5fe01d7e3d63e25c9d9002f8f50eea346af5 100644 (file)
@@ -182,20 +182,15 @@ class EditphotoAction extends Action
         //For redirection
         $oldalbum = $this->album_id;
 
-        $this->photo->title = "";
-        $this->photo->photo_description = "";
-        $this->photo->profile_id = 0;
-        $this->photo->album_id = 0;
-        $this->photo->uri = "";
-        $this->photo->thumb_uri = "";
+        $notice = Notice::staticGet('id', $this->photo->notice_id);
 
-        if ($this->photo->validate())
-            $this->photo->update();
-        else {
-            $this->showForm(_('Error: The photo data is not valid.'));
-            return;
+        $this->photo->delete();
+        
+        if (Event::handle('StartDeleteOwnNotice', array($this->user, $notice))) {
+            $notice->delete();
+            Event::handle('EndDeleteOwnNotice', array($this->user, $notice));
         }
-        $this->showForm(_('Success!'));
+       $this->showForm(_('Success!'));
         common_redirect('/' . $this->user->nickname . '/photos/' . $oldalbum, '303');
         return;
     }