mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix sonarjs prefer-single-boolean-return
This commit is contained in:
parent
bb86ab7f27
commit
b426b6e2bf
18 changed files with 52 additions and 187 deletions
|
@ -117,11 +117,7 @@ export function canEdit(user, item) {
|
|||
}
|
||||
|
||||
export function isLocalItem(item) {
|
||||
if (item && item.Id && typeof item.Id === 'string' && item.Id.indexOf('local') === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return item && item.Id && typeof item.Id === 'string' && item.Id.indexOf('local') === 0;
|
||||
}
|
||||
|
||||
export function canIdentify (user, item) {
|
||||
|
@ -148,11 +144,7 @@ export function canEditImages (user, item) {
|
|||
}
|
||||
|
||||
if (itemType === 'UserView') {
|
||||
if (user.Policy.IsAdministrator) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return user.Policy.IsAdministrator;
|
||||
}
|
||||
|
||||
if (item.Type === 'Recording' && item.Status !== 'Completed') {
|
||||
|
@ -218,29 +210,21 @@ export function canMarkPlayed (item) {
|
|||
}
|
||||
}
|
||||
|
||||
if (item.Type === 'Series' ||
|
||||
item.Type === 'Season' ||
|
||||
item.Type === 'BoxSet' ||
|
||||
item.MediaType === 'Book' ||
|
||||
item.MediaType === 'Recording') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return item.Type === 'Series'
|
||||
|| item.Type === 'Season'
|
||||
|| item.Type === 'BoxSet'
|
||||
|| item.MediaType === 'Book'
|
||||
|| item.MediaType === 'Recording';
|
||||
}
|
||||
|
||||
export function canRate (item) {
|
||||
if (item.Type === 'Program'
|
||||
return item.Type === 'Program'
|
||||
|| item.Type === 'Timer'
|
||||
|| item.Type === 'SeriesTimer'
|
||||
|| item.Type === 'CollectionFolder'
|
||||
|| item.Type === 'UserView'
|
||||
|| item.Type === 'Channel'
|
||||
|| !item.UserData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|| !item.UserData;
|
||||
}
|
||||
|
||||
export function canConvert (item, user) {
|
||||
|
@ -271,11 +255,7 @@ export function canConvert (item, user) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (item.IsPlaceHolder) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return item.IsPlaceHolder;
|
||||
}
|
||||
|
||||
export function canRefreshMetadata (item, user) {
|
||||
|
@ -307,11 +287,8 @@ export function supportsMediaSourceSelection (item) {
|
|||
if (item.EnableMediaSourceDisplay === false) {
|
||||
return false;
|
||||
}
|
||||
if (item.EnableMediaSourceDisplay == null && item.SourceType && item.SourceType !== 'Library') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return item.EnableMediaSourceDisplay == null && item.SourceType && item.SourceType !== 'Library';
|
||||
}
|
||||
|
||||
export function sortTracks (trackA, trackB) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue