// return success of updating or error message
if (!empty($photo)) {
+ Photo::clearAlbumCache($uid);
$data = ['photo' => $this->friendicaPhoto->createFromId($photo['resource_id'], null, $uid, $type)];
$this->response->exit('photo_create', $data, $this->parameters['extension'] ?? null);
} else {
// to the user and the contacts of the users (drop_items() do all the necessary magic to avoid orphans in database and federate deletion)
$condition = ['uid' => $uid, 'resource-id' => $request['photo_id'], 'post-type' => Item::PT_IMAGE, 'origin' => true];
Item::deleteForUser($condition, $uid);
-
+ Photo::clearAlbumCache($uid);
$result = ['result' => 'deleted', 'message' => 'photo with id `' . $request['photo_id'] . '` has been deleted from server.'];
$this->response->exit('photo_delete', ['$result' => $result], $this->parameters['extension'] ?? null);
} else {
// return success of updating or error message
if ($result) {
+ Photo::clearAlbumCache($uid);
$answer = ['result' => 'updated', 'message' => 'Image id `' . $photo_id . '` has been updated.'];
$this->response->exit('photo_update', ['$result' => $answer], $this->parameters['extension'] ?? null);
return;
// 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 {
// return success of updating or error message
if ($result) {
+ Photo::clearAlbumCache($uid);
$answer = ['result' => 'updated', 'message' => 'album `' . $request['album'] . '` with all containing photos has been renamed to `' . $request['album_new'] . '`.'];
$this->response->exit('photoalbum_update', ['$result' => $answer], $this->parameters['extension'] ?? null);
} else {