Skip to content

Commit 5bdd75e

Browse files
ildyrianagmat84
andauthored
fix smart albums rights + fix sharing link menu + faster CICD (#1578)
Co-authored-by: Matthias Nagel <matthias.h.nagel@posteo.de>
1 parent 0fc21a4 commit 5bdd75e

File tree

6 files changed

+174
-11
lines changed

6 files changed

+174
-11
lines changed

.github/workflows/CICD.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ on:
77
- '**/*.md'
88
- 'public/dist/*.js'
99
- 'public/dist/**/*.js'
10+
- 'public/Lychee-front'
1011
pull_request:
1112
paths-ignore:
1213
- '**/*.md'
1314
- 'public/dist/*.js'
1415
- 'public/dist/**/*.js'
16+
- 'public/Lychee-front'
1517
# Allow manually triggering the workflow.
1618
workflow_dispatch:
1719

@@ -23,7 +25,7 @@ jobs:
2325
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
2426
steps:
2527
- name: Cancel Previous Runs
26-
uses: styfle/cancel-workflow-action@0.7.0
28+
uses: styfle/cancel-workflow-action@0.11.0
2729
with:
2830
access_token: ${{ github.token }}
2931

public/dist/leaflet.markercluster.js.map

100755100644
File mode changed.

public/dist/main.css

100755100644
File mode changed.

public/dist/main.js

Lines changed: 134 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/dist/view.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,37 @@ build.album = function (data) {
680680
var formattedCreationTs = lychee.locale.printMonthYear(data.created_at);
681681
var formattedMinTs = lychee.locale.printMonthYear(data.min_taken_at);
682682
var formattedMaxTs = lychee.locale.printMonthYear(data.max_taken_at);
683+
// The condition below is faulty wrt. to two issues:
684+
//
685+
// a) The condition only checks whether the owning/current album is
686+
// uploadable (aka "editable"), but it does not check whether the
687+
// album at hand whose icon is built is editable.
688+
// But this is of similar importance.
689+
// Currently, we only check whether the album at hand is a smart
690+
// album or tag album which are always considered non-editable.
691+
// But this is only half of the story.
692+
// For example, a regular album might still be non-editable, if the
693+
// current user is not the owner of that album.
694+
// b) This method is not only called if the owning/current album is a
695+
// proper album, but also for the root view.
696+
// However, `album.isUploadable` should not be called for the root
697+
// view.
698+
//
699+
// Moreover, we have to distinguish between "drag" and "drop".
700+
// Doing so would also solve the problems above:
701+
//
702+
// - "Drag": If the current child album at hand can be dragged (away)
703+
// is mostly determined by the user's rights on the parent album.
704+
// Instead of (erroneously) using `album.isUploadable()` for that
705+
// (even for the root view), the "right to drag" should be passed to
706+
// this method as a parameter very much like `disabled` such that this
707+
// method can be used for both regular albums and the root view.
708+
// - "Drop": If something (e.g. a photo) can be dropped onto the child
709+
// album at hand is independent of the user's rights on the containing
710+
// album.
711+
// Whether the child album supports the drop event depends on the type
712+
// of the album (i.e. it must not be a smart or tag album), but also
713+
// on the ownership of the album.
683714
var disableDragDrop = !album.isUploadable() || disabled || album.isSmartID(data.id) || data.is_tag_album;
684715
var subtitle = formattedCreationTs;
685716

@@ -1344,7 +1375,11 @@ header.setMode = function (mode) {
13441375
tabindex.makeFocusable(_e9);
13451376
}
13461377

1347-
if (album.json && album.json.hasOwnProperty("is_share_button_visible") && !album.json.is_share_button_visible) {
1378+
if (album.json && album.json.is_share_button_visible === false && (
1379+
// The owner of an album (or the admin) shall always see
1380+
// the share button and be unaffected by the settings of
1381+
// the album
1382+
lychee.user === null || lychee.user.username !== album.json.owner_name) && !lychee.rights.is_admin) {
13481383
var _e10 = $("#button_share_album");
13491384
_e10.hide();
13501385
tabindex.makeUnfocusable(_e10);

0 commit comments

Comments
 (0)