Skip to content

Commit d9f299a

Browse files
authored
V7 small fixes (#1426)
1 parent e80590a commit d9f299a

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

files/forms.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,11 @@ def clean(self):
178178
state = cleaned_data.get("state")
179179
categories = cleaned_data.get("category")
180180

181-
if getattr(settings, 'USE_RBAC', False) and 'category' in self.fields:
181+
if state in ['private', 'unlisted']:
182+
custom_permissions = self.instance.permissions.exists()
182183
rbac_categories = categories.filter(is_rbac_category=True).values_list('title', flat=True)
183-
184-
if rbac_categories and state in ['private', 'unlisted']:
185-
# Make the confirm_state field visible and add it to the layout
184+
if rbac_categories or custom_permissions:
186185
self.fields['confirm_state'].widget = forms.CheckboxInput()
187-
188-
# add it after the state field
189186
state_index = None
190187
for i, layout_item in enumerate(self.helper.layout):
191188
if isinstance(layout_item, CustomField) and layout_item.fields[0] == 'state':
@@ -198,8 +195,12 @@ def clean(self):
198195
self.helper.layout = Layout(*layout_items)
199196

200197
if not cleaned_data.get('confirm_state'):
201-
error_message = f"I understand that although media state is {state}, the media is also shared with users that have access to the following categories: {', '.join(rbac_categories)}"
202-
self.add_error('confirm_state', error_message)
198+
if rbac_categories:
199+
error_message = f"I understand that although media state is {state}, the media is also shared with users that have access to categories: {', '.join(rbac_categories)}"
200+
self.add_error('confirm_state', error_message)
201+
if custom_permissions:
202+
error_message = f"I understand that although media state is {state}, the media is also shared by me with other users, that I can see in the 'Shared by me' page"
203+
self.add_error('confirm_state', error_message)
203204

204205
return cleaned_data
205206

files/models/media.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ def thumbnail_url(self):
763763
return helpers.url_from_path(self.uploaded_thumbnail.path)
764764
if self.thumbnail:
765765
return helpers.url_from_path(self.thumbnail.path)
766+
if self.media_type == "audio":
767+
return helpers.url_from_path("userlogos/poster_audio.jpg")
766768
return None
767769

768770
@property

frontend/src/static/js/components/media-actions/VideoMediaDownloadLink.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function downloadOptionsList() {
2626
link: formatInnerLink(encodings_info[k][g].url, SiteContext._currentValue.url),
2727
linkAttr: {
2828
target: '_blank',
29-
download: media_data.title + '_' + k + '_' + g.toUpperCase(),
29+
download: k + '_' + g.toLowerCase() + '_' + media_data.title,
3030
},
3131
};
3232
}
42.6 KB
Loading

static/js/media.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)