<?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
*
*/
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);
// 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
// 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 {