namespace Friendica\Module\Api\Friendica\Photoalbum;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\Photo;
use Friendica\Module\BaseApi;
*/
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'])) {
// 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) {
$answer = ['result' => 'deleted', 'message' => 'album `' . $request['album'] . '` with all containing photos has been deleted.'];
- self::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");
}