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

Merge pull request #3033 from daullmer/refresh-permission

Check permission in multiselect for refresh option in menu
This commit is contained in:
Bill Thornton 2021-10-24 00:41:46 -04:00 committed by GitHub
commit 0293ed805f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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