]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Api/Friendica/Photoalbum/Delete.php
Fix Friendica API Photo Album list documentation to reflect endpoint
[friendica.git] / src / Module / Api / Friendica / Photoalbum / Delete.php
index 8c277d39eb5391ca14478a3a25e18ec23489b152..76062b2fdedfe6e7df15fda0e2b607f003b1e7a7 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -34,12 +34,12 @@ use Friendica\Network\HTTPException\InternalServerErrorException;
  */
 class Delete extends BaseApi
 {
-       protected function post(array $request = [], array $post = [])
+       protected function post(array $request = [])
        {
                self::checkAllowedScope(self::SCOPE_WRITE);
                $uid = self::getCurrentUserID();
 
-               $request = self::getRequest([
+               $request = $this->getRequest([
                        'album' => '', // Album name
                ], $request);
 
@@ -58,7 +58,7 @@ class Delete extends BaseApi
 
                // function for setting the items to "deleted = 1" which ensures that comments, likes etc. are not shown anymore
                // to the user and the contacts of the users (drop_items() performs the federation of the deletion to other networks
-               $condition = ['uid' => $uid, 'resource-id' => $resourceIds, 'type' => 'photo'];
+               $condition = ['uid' => $uid, 'resource-id' => $resourceIds, 'post-type' => Item::PT_IMAGE, 'origin' => true];
                Item::deleteForUser($condition, $uid);
 
                // now let's delete all photos from the album
@@ -66,6 +66,7 @@ class Delete extends BaseApi
 
                // return success of deletion or error message
                if ($result) {
+                       Photo::clearAlbumCache($uid);
                        $answer = ['result' => 'deleted', 'message' => 'album `' . $request['album'] . '` with all containing photos has been deleted.'];
                        $this->response->exit('photoalbum_delete', ['$result' => $answer], $this->parameters['extension'] ?? null);
                } else {