1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Check permission in multiselect

This commit is contained in:
David Ullmer 2021-10-03 17:59:28 +02:00
parent a70c83de3c
commit d97c459ea1
No known key found for this signature in database
GPG key ID: 4AEABE3359D5883C

View file

@ -8,6 +8,7 @@ import ServerConnections from '../ServerConnections';
import alert from '../alert'; import alert from '../alert';
import playlistEditor from '../playlisteditor/playlisteditor'; import playlistEditor from '../playlisteditor/playlisteditor';
import confirm from '../confirm/confirm'; import confirm from '../confirm/confirm';
import itemHelper from '../itemHelper';
/* eslint-disable indent */ /* eslint-disable indent */
@ -170,6 +171,8 @@ import confirm from '../confirm/confirm';
const apiClient = ServerConnections.currentApiClient(); const apiClient = ServerConnections.currentApiClient();
apiClient.getCurrentUser().then(user => { apiClient.getCurrentUser().then(user => {
// get first selected item to perform metadata refresh permission check
apiClient.getItem(apiClient.getCurrentUserId(), selectedItems[0]).then(firstItem => {
const menuItems = []; const menuItems = [];
menuItems.push({ menuItems.push({
@ -224,11 +227,15 @@ import confirm from '../confirm/confirm';
icon: 'check_box_outline_blank' icon: 'check_box_outline_blank'
}); });
// this assues that if the user can refresh metadata for the first item
// they can refresh metadata for all items
if (itemHelper.canRefreshMetadata(firstItem, user)) {
menuItems.push({ menuItems.push({
name: globalize.translate('RefreshMetadata'), name: globalize.translate('RefreshMetadata'),
id: 'refresh', id: 'refresh',
icon: 'refresh' icon: 'refresh'
}); });
}
import('../actionSheet/actionSheet').then((actionsheet) => { import('../actionSheet/actionSheet').then((actionsheet) => {
actionsheet.show({ actionsheet.show({
@ -296,6 +303,7 @@ import confirm from '../confirm/confirm';
}); });
}); });
}); });
});
} }
function dispatchNeedsRefresh() { function dispatchNeedsRefresh() {