Skip to content

Limit photo album visibility #969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions app/abilities/photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
}

get canShowPhotoComments() {
return (
this.session.hasPermission('photo-comment.read') ||
this.model.photoAlbum.get('publiclyVisible')
);
return this.session.hasPermission('photo-comment.read');

Check warning on line 9 in app/abilities/photo.js

View check run for this annotation

Codecov / codecov/patch

app/abilities/photo.js#L9

Added line #L9 was not covered by tests
}

get canShowPhotoTags() {
Expand Down
17 changes: 11 additions & 6 deletions app/components/forms/photo-album-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@
@property='date'
@label='Datum van activiteit'
/>
<ModelForm::CheckboxInput
<item>
<ModelForm::RadioGroup

Check failure on line 19 in app/components/forms/photo-album-form.hbs

View workflow job for this annotation

GitHub Actions / Lint

Incorrect indentation for `<ModelForm::RadioGroup>` beginning at L19:C7. Expected `<ModelForm::RadioGroup>` to be at an indentation of 8 but was found at 7.
@model={{@model}}
@property='publiclyVisible'
@label='Zichtbaar voor externen'
/>

@property='visibility'
@options={{this.visibilityOptions}}
@inputLayout='vertical'
@label='Zichtbaar voor'
@inputIdentifier='photoCategory'
@class='sort-radio-group'
/>
</item>

Check failure on line 28 in app/components/forms/photo-album-form.hbs

View workflow job for this annotation

GitHub Actions / Lint

Incorrect indentation for `item` beginning at L18:C6. Expected `</item>` ending at L28:C12 to be at an indentation of 6 but was found at 5.
{{#if @model.publiclyVisible}}
<div class="row">
<div class="col-sm-10 offset-sm-2">
Expand Down Expand Up @@ -92,4 +97,4 @@
</ModelForm::FormActions>
</form>
</div>
</div>
</div>
10 changes: 9 additions & 1 deletion app/models/photo-album.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Properties
@attr title;
@attr('date-only') date;
@attr({ defaultValue: false }) publiclyVisible;
@attr visibility;

// Relations
@hasMany photos;
Expand Down Expand Up @@ -47,6 +47,14 @@
return this.photos.length;
}

get visibilityOptions() {
return [

Check warning on line 51 in app/models/photo-album.js

View check run for this annotation

Codecov / codecov/patch

app/models/photo-album.js#L51

Added line #L51 was not covered by tests
{ value: 'public', label: 'Iedereen' },
{ value: 'alumni', label: 'Leden & oudleden' },
{ value: 'author', label: 'Leden' },
];
}

// Methods
isOwner(user) {
if (user.get('id') === this.author.get('id')) {
Expand Down
Loading