mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2025-02-19 22:11:34 +00:00
Fix sonarjs no-duplicated-branches
This commit is contained in:
parent
ad5c1ab018
commit
554cd1210c
@ -76,7 +76,6 @@ module.exports = {
|
||||
'sonarjs/cognitive-complexity': ['warn'],
|
||||
// TODO: Enable the following rules and fix issues
|
||||
'sonarjs/no-duplicate-string': ['off'],
|
||||
'sonarjs/no-duplicated-branches': ['off'],
|
||||
'sonarjs/no-identical-functions': ['off'],
|
||||
'sonarjs/no-redundant-jump': ['off'],
|
||||
'sonarjs/no-small-switch': ['off'],
|
||||
|
@ -513,6 +513,7 @@ import { appRouter } from '../appRouter';
|
||||
let imgType = null;
|
||||
let itemId = null;
|
||||
|
||||
/* eslint-disable sonarjs/no-duplicated-branches */
|
||||
if (options.preferThumb && item.ImageTags && item.ImageTags.Thumb) {
|
||||
imgType = 'Thumb';
|
||||
imgTag = item.ImageTags.Thumb;
|
||||
@ -609,6 +610,7 @@ import { appRouter } from '../appRouter';
|
||||
imgTag = item.ParentBackdropImageTags[0];
|
||||
itemId = item.ParentBackdropItemId;
|
||||
}
|
||||
/* eslint-enable sonarjs/no-duplicated-branches */
|
||||
|
||||
if (!itemId) {
|
||||
itemId = item.Id;
|
||||
|
@ -4,13 +4,12 @@ import { Events } from 'jellyfin-apiclient';
|
||||
|
||||
function onUserDataChanged() {
|
||||
const instance = this;
|
||||
|
||||
const eventsToMonitor = getEventsToMonitor(instance);
|
||||
|
||||
// TODO: Check user data change reason?
|
||||
if (eventsToMonitor.indexOf('markfavorite') !== -1) {
|
||||
instance.notifyRefreshNeeded();
|
||||
} else if (eventsToMonitor.indexOf('markplayed') !== -1) {
|
||||
if (eventsToMonitor.indexOf('markfavorite') !== -1
|
||||
|| eventsToMonitor.indexOf('markplayed') !== -1
|
||||
) {
|
||||
instance.notifyRefreshNeeded();
|
||||
}
|
||||
}
|
||||
|
@ -61,31 +61,20 @@ function fetchData(instance) {
|
||||
|
||||
function onTimerChangedExternally(e, apiClient, data) {
|
||||
const options = this.options;
|
||||
let refresh = false;
|
||||
|
||||
if (data.Id && this.TimerId === data.Id) {
|
||||
refresh = true;
|
||||
} else if (data.ProgramId && options && options.programId === data.ProgramId) {
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if (refresh) {
|
||||
if ((data.Id && this.TimerId === data.Id)
|
||||
|| (data.ProgramId && options && options.programId === data.ProgramId)
|
||||
) {
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
function onSeriesTimerChangedExternally(e, apiClient, data) {
|
||||
const options = this.options;
|
||||
let refresh = false;
|
||||
|
||||
if (data.Id && this.SeriesTimerId === data.Id) {
|
||||
refresh = true;
|
||||
}
|
||||
if (data.ProgramId && options && options.programId === data.ProgramId) {
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if (refresh) {
|
||||
if ((data.Id && this.SeriesTimerId === data.Id)
|
||||
|| (data.ProgramId && options && options.programId === data.ProgramId)
|
||||
) {
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
|
@ -153,9 +153,9 @@ import Sortable from 'sortablejs';
|
||||
const eventsToMonitor = getEventsToMonitor(itemsContainer);
|
||||
|
||||
// TODO: Check user data change reason?
|
||||
if (eventsToMonitor.indexOf('markfavorite') !== -1) {
|
||||
itemsContainer.notifyRefreshNeeded();
|
||||
} else if (eventsToMonitor.indexOf('markplayed') !== -1) {
|
||||
if (eventsToMonitor.indexOf('markfavorite') !== -1
|
||||
|| eventsToMonitor.indexOf('markplayed') !== -1
|
||||
) {
|
||||
itemsContainer.notifyRefreshNeeded();
|
||||
}
|
||||
}
|
||||
|
@ -63,18 +63,6 @@ import ServerConnections from '../../components/ServerConnections';
|
||||
}
|
||||
|
||||
button.classList.add('ratingbutton-withrating');
|
||||
} else if (likes) {
|
||||
if (icon) {
|
||||
icon.classList.add('favorite');
|
||||
icon.classList.remove('ratingbutton-icon-withrating');
|
||||
}
|
||||
button.classList.remove('ratingbutton-withrating');
|
||||
} else if (likes === false) {
|
||||
if (icon) {
|
||||
icon.classList.add('favorite');
|
||||
icon.classList.remove('ratingbutton-icon-withrating');
|
||||
}
|
||||
button.classList.remove('ratingbutton-withrating');
|
||||
} else {
|
||||
if (icon) {
|
||||
icon.classList.add('favorite');
|
||||
|
@ -1490,15 +1490,14 @@ function tryRemoveElement(elem) {
|
||||
if (
|
||||
// Check non-standard Safari PiP support
|
||||
typeof video.webkitSupportsPresentationMode === 'function' && video.webkitSupportsPresentationMode('picture-in-picture') && typeof video.webkitSetPresentationMode === 'function'
|
||||
// Check non-standard Windows PiP support
|
||||
|| (window.Windows
|
||||
&& Windows.UI.ViewManagement.ApplicationView.getForCurrentView()
|
||||
.isViewModeSupported(Windows.UI.ViewManagement.ApplicationViewMode.compactOverlay))
|
||||
// Check standard PiP support
|
||||
|| document.pictureInPictureEnabled
|
||||
) {
|
||||
list.push('PictureInPicture');
|
||||
} else if (window.Windows
|
||||
&& Windows.UI.ViewManagement.ApplicationView.getForCurrentView()
|
||||
.isViewModeSupported(Windows.UI.ViewManagement.ApplicationViewMode.compactOverlay)
|
||||
) {
|
||||
list.push('PictureInPicture');
|
||||
}
|
||||
|
||||
if (browser.safari || browser.iOS || browser.iPad) {
|
||||
|
@ -110,7 +110,7 @@ import browser from './browser';
|
||||
function canPlayAudioFormat(format) {
|
||||
let typeString;
|
||||
|
||||
if (format === 'flac') {
|
||||
if (format === 'flac' || format === 'asf') {
|
||||
if (browser.tizen || browser.web0s || browser.edgeUwp) {
|
||||
return true;
|
||||
}
|
||||
@ -118,10 +118,6 @@ import browser from './browser';
|
||||
if (browser.tizen || browser.edgeUwp) {
|
||||
return true;
|
||||
}
|
||||
} else if (format === 'asf') {
|
||||
if (browser.tizen || browser.web0s || browser.edgeUwp) {
|
||||
return true;
|
||||
}
|
||||
} else if (format === 'opus') {
|
||||
if (browser.web0s) {
|
||||
// canPlayType lies about OPUS support
|
||||
@ -171,9 +167,7 @@ import browser from './browser';
|
||||
}
|
||||
|
||||
function testCanPlayAv1(videoTestElement) {
|
||||
if (browser.tizenVersion >= 5.5) {
|
||||
return true;
|
||||
} else if (browser.web0sVersion >= 5) {
|
||||
if (browser.tizenVersion >= 5.5 || browser.web0sVersion >= 5) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -199,6 +193,7 @@ import browser from './browser';
|
||||
|
||||
switch (container) {
|
||||
case 'asf':
|
||||
case 'wmv':
|
||||
supported = browser.tizen || browser.web0s || browser.edgeUwp;
|
||||
videoAudioCodecs = [];
|
||||
break;
|
||||
@ -241,10 +236,6 @@ import browser from './browser';
|
||||
videoCodecs.push('mpeg2video');
|
||||
}
|
||||
break;
|
||||
case 'wmv':
|
||||
supported = browser.tizen || browser.web0s || browser.edgeUwp;
|
||||
videoAudioCodecs = [];
|
||||
break;
|
||||
case 'ts':
|
||||
supported = testCanPlayTs();
|
||||
videoCodecs.push('h264');
|
||||
|
Loading…
x
Reference in New Issue
Block a user