]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Api/Friendica/Photoalbum/Delete.php
Merge pull request #11037 from MrPetovan/bug/11023-api-photo-delete
[friendica.git] / src / Module / Api / Friendica / Photoalbum / Delete.php
index dd18365b4634ae3a3f6cebb9960fcd581daba9ac..8a45de2d3632fb78497f9ea9e87bd51230cc3e20 100644 (file)
@@ -34,14 +34,14 @@ use Friendica\Network\HTTPException\InternalServerErrorException;
  */
 class Delete extends BaseApi
 {
-       public static function rawContent(array $parameters = [])
+       protected function rawContent(array $request = [])
        {
                self::checkAllowedScope(self::SCOPE_WRITE);
                $uid = self::getCurrentUserID();
 
                $request = self::getRequest([
                        'album' => '', // Album name
-               ]);
+               ], $request);
 
                // we do not allow calls without album string
                if (empty($request['album'])) {
@@ -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
@@ -67,7 +67,7 @@ class Delete extends BaseApi
                // return success of deletion or error message
                if ($result) {
                        $answer = ['result' => 'deleted', 'message' => 'album `' . $request['album'] . '` with all containing photos has been deleted.'];
-                       DI::apiResponse()->exit('photoalbum_delete', ['$result' => $answer], $parameters['extension'] ?? null);
+                       $this->response->exit('photoalbum_delete', ['$result' => $answer], $this->parameters['extension'] ?? null);
                } else {
                        throw new InternalServerErrorException("unknown error - deleting from database failed");
                }