@@ -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