Allow users to filter albums by contributors #48

Merged
Roflin merged 18 commits from refactor/viewalbum into master 2024-01-20 20:11:18 +01:00
Member
  • Refactor ViewPhotoAlbum a little to clean up the code
  • Add a method to enumerate contributors
  • Add a method to safely filter by contributor
  • Add a UI for users to select an available filter
  • Carry filter over to photo page (e.g. ?by, analogous to ?in)
  • Take active filter into account when generating previous/next photo url
  • Carry filter over to download page
  • Test things thoroughly
- [x] Refactor ViewPhotoAlbum a little to clean up the code - [x] Add a method to enumerate contributors - [x] Add a method to safely filter by contributor - [x] Add a UI for users to select an available filter - [x] Carry filter over to photo page (e.g. `?by`, analogous to `?in`) - [x] Take active filter into account when generating previous/next photo url - [x] Carry filter over to download page - [x] Test things thoroughly
Aaron added 6 commits 2024-01-14 21:29:30 +01:00
Aaron changed title from Allow users to filter albums by contributors to WIP: Allow users to filter albums by contributors 2024-01-14 21:29:34 +01:00
Aaron added 1 commit 2024-01-14 22:17:40 +01:00
Aaron added 4 commits 2024-01-15 00:55:52 +01:00
Aaron changed title from WIP: Allow users to filter albums by contributors to Allow users to filter albums by contributors 2024-01-15 00:56:50 +01:00
Aaron force-pushed refactor/viewalbum from 35cb6798c8 to 1f53689e4b 2024-01-15 01:01:08 +01:00 Compare
Member

Fixes #13

Fixes #13
minnozz requested changes 2024-01-15 10:01:34 +01:00
@ -66,0 +50,4 @@
$filters = [];
if (!empty($contributors))
{
$filters[''] = ['id_user' => null, 'caption' => 'Show all photos', 'link' => $tag->getUrl()];
Member

Key label missing

Key `label` missing
Author
Member

I initially didn't add it as it'd never be used. You're right, though, and it's better to just have it there for consistency.

I initially didn't add it as it'd never be used. You're right, though, and it's better to just have it there for consistency.
Aaron marked this conversation as resolved
@ -74,3 +91,3 @@
// Load a photo mosaic for the current tag.
list($mosaic, $total_count) = $this->getPhotoMosaic($id_tag, $page, !isset($is_person));
list($mosaic, $total_count) = $this->getPhotoMosaic($id_tag, $id_user_uploaded, $current_page, !isset($is_person));
Member

$is_person is never set

(At $employer we had the convention to always use !== null instead of isset when you expect the variable to exist to catch these kind of errors. empty() was also discouraged for this reason)

`$is_person` is never set (At $employer we had the convention to always use `!== null` instead of `isset` when you expect the variable to exist to catch these kind of errors. `empty()` was also discouraged for this reason)
Author
Member

Yeah, I don't like this either. I've opted instead to explicitly declare it as a boolean before it's used.

Yeah, I don't like this either. I've opted instead to explicitly declare it as a boolean before it's used.
Aaron marked this conversation as resolved
@ -201,0 +235,4 @@
{
$back_link = BASEURL . '/people/';
$back_link_title = 'Back to "People"';
$is_person = true;
Member

Unused here

Unused here
Aaron marked this conversation as resolved
Aaron added 1 commit 2024-01-15 11:25:30 +01:00
Aaron added 1 commit 2024-01-15 11:26:43 +01:00
Aaron added 2 commits 2024-01-15 11:40:59 +01:00
Aaron added 1 commit 2024-01-15 11:46:22 +01:00
minnozz approved these changes 2024-01-15 11:48:01 +01:00
Aaron added 1 commit 2024-01-15 13:42:13 +01:00
Aaron added 1 commit 2024-01-15 13:44:59 +01:00
Aaron added 4 commits 2024-01-17 17:54:40 +01:00
Aaron force-pushed refactor/viewalbum from f82bd7b065 to 30bc0bb884 2024-01-17 18:21:31 +01:00 Compare
Roflin merged commit cf6adbf80c into master 2024-01-20 20:11:18 +01:00
Aaron deleted branch refactor/viewalbum 2024-01-20 20:52:17 +01:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Public/pics#48
No description provided.