Add Photo album cache flushes to Friendica Photo endpoints
This commit is contained in:
parent
8f56aa316b
commit
800f94495b
|
@ -88,6 +88,7 @@ class Create extends BaseApi
|
|||
|
||||
// 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 {
|
||||
|
|
|
@ -60,7 +60,7 @@ class Delete extends BaseApi
|
|||
// 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 {
|
||||
|
|
|
@ -135,6 +135,7 @@ class Update extends BaseApi
|
|||
|
||||
// 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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -58,6 +58,7 @@ class Update extends BaseApi
|
|||
|
||||
// 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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user