From: Hank Grabowski <hankgrabowski@gmail.com>
Date: Tue, 13 Dec 2022 20:41:24 +0000 (-0500)
Subject: Add latest_first parameter to photo gallery listing Friendica API endpoint
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=991c5fa6de529df26fb91365158472a748f04d85;p=friendica.git

Add latest_first parameter to photo gallery listing Friendica API endpoint
---

diff --git a/src/Module/Api/Friendica/Photoalbum/Show.php b/src/Module/Api/Friendica/Photoalbum/Show.php
index 20c5c4a6fb..da16cbedc2 100644
--- a/src/Module/Api/Friendica/Photoalbum/Show.php
+++ b/src/Module/Api/Friendica/Photoalbum/Show.php
@@ -60,15 +60,17 @@ class Show extends BaseApi
 			'album'           => '',    // Get pictures in this album
 			'offset'          => 0,     // Return results offset by this value
 			'limit'           => 50,    // Maximum number of results to return. Defaults to 50. Max 500
+			'latest_first'    => false, // Whether to reverse the order so newest are first
 		], $request);
 		if (empty($request['album'])) {
 			throw new HTTPException\BadRequestException('No album name specified.');
 		}
 
 
+		$orderDescending = $request['latest_first'];
 		$album = $request['album'];
 		$condition = ["`uid` = ? AND `album` = ?", $uid, $album];
-		$params = ['order' => ['id'], 'group_by' => ['resource-id']];
+		$params = ['order' => ['id' => $orderDescending], 'group_by' => ['resource-id']];
 
 		//'limit' => [$request['offset'], $request['limit']]
 		$limit = $request['limit'];