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

Fix sonarjs no-duplicated-branches

This commit is contained in:
Bill Thornton 2022-10-04 17:31:48 -04:00
parent ad5c1ab018
commit 554cd1210c
8 changed files with 21 additions and 54 deletions

View file

@ -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;

View file

@ -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();
}
}

View file

@ -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();
}
}