Fix wanted pages are not updated properly after changing language profile

pull/1485/head
LASER-Yi 3 years ago
parent bb1c30a921
commit ed30f76c57

@ -716,6 +716,15 @@ class Series(Resource):
list_missing_subtitles(no=seriesId, send_event=False) list_missing_subtitles(no=seriesId, send_event=False)
event_stream(type='series', payload=seriesId) event_stream(type='series', payload=seriesId)
episode_id_list = TableEpisodes\
.select(TableEpisodes.sonarrEpisodeId)\
.where(TableEpisodes.sonarrSeriesId == seriesId)\
.dicts()
for item in episode_id_list:
event_stream(type='episode-wanted', payload=item['sonarrEpisodeId'])
event_stream(type='badges') event_stream(type='badges')
return '', 204 return '', 204
@ -963,6 +972,7 @@ class Movies(Resource):
list_missing_subtitles_movies(no=radarrId, send_event=False) list_missing_subtitles_movies(no=radarrId, send_event=False)
event_stream(type='movie', payload=radarrId) event_stream(type='movie', payload=radarrId)
event_stream(type='movie-wanted', payload=radarrId)
event_stream(type='badges') event_stream(type='badges')
return '', 204 return '', 204

@ -5,13 +5,11 @@ import {
episodeDeleteItems, episodeDeleteItems,
episodeUpdateBy, episodeUpdateBy,
episodeUpdateById, episodeUpdateById,
movieDeleteWantedItems,
movieUpdateBlacklist, movieUpdateBlacklist,
movieUpdateHistoryList, movieUpdateHistoryList,
movieUpdateList, movieUpdateList,
movieUpdateWantedList, movieUpdateWantedList,
providerUpdateList, providerUpdateList,
seriesDeleteWantedItems,
seriesUpdateBlacklist, seriesUpdateBlacklist,
seriesUpdateHistoryList, seriesUpdateHistoryList,
seriesUpdateList, seriesUpdateList,
@ -324,18 +322,6 @@ export function useWantedSeries() {
const update = useReduxAction(seriesUpdateWantedList); const update = useReduxAction(seriesUpdateWantedList);
const items = useReduxStore((d) => d.series.wantedEpisodesList); const items = useReduxStore((d) => d.series.wantedEpisodesList);
const updateAction = useWrapToOptionalId(update);
const deleteAction = useReduxAction(seriesDeleteWantedItems);
const reducer = useMemo<SocketIO.Reducer>(
() => ({
key: "episode-wanted",
update: updateAction,
delete: deleteAction,
}),
[updateAction, deleteAction]
);
useSocketIOReducer(reducer);
return stateBuilder(items, update); return stateBuilder(items, update);
} }
@ -343,18 +329,6 @@ export function useWantedMovies() {
const update = useReduxAction(movieUpdateWantedList); const update = useReduxAction(movieUpdateWantedList);
const items = useReduxStore((d) => d.movie.wantedMovieList); const items = useReduxStore((d) => d.movie.wantedMovieList);
const updateAction = useWrapToOptionalId(update);
const deleteAction = useReduxAction(movieDeleteWantedItems);
const reducer = useMemo<SocketIO.Reducer>(
() => ({
key: "movie-wanted",
update: updateAction,
delete: deleteAction,
}),
[updateAction, deleteAction]
);
useSocketIOReducer(reducer);
return stateBuilder(items, update); return stateBuilder(items, update);
} }

@ -3,9 +3,13 @@ import {
badgeUpdateAll, badgeUpdateAll,
bootstrap, bootstrap,
movieDeleteItems, movieDeleteItems,
movieDeleteWantedItems,
movieUpdateList, movieUpdateList,
movieUpdateWantedList,
seriesDeleteItems, seriesDeleteItems,
seriesDeleteWantedItems,
seriesUpdateList, seriesUpdateList,
seriesUpdateWantedList,
siteAddNotifications, siteAddNotifications,
siteAddProgress, siteAddProgress,
siteInitializationFailed, siteInitializationFailed,
@ -91,6 +95,24 @@ export function createDefaultReducer(): SocketIO.Reducer[] {
update: bindToReduxStore(movieUpdateList), update: bindToReduxStore(movieUpdateList),
delete: bindToReduxStore(movieDeleteItems), delete: bindToReduxStore(movieDeleteItems),
}, },
{
key: "episode-wanted",
update: (ids: number[] | undefined) => {
if (ids) {
reduxStore.dispatch(seriesUpdateWantedList(ids) as any);
}
},
delete: bindToReduxStore(seriesDeleteWantedItems),
},
{
key: "movie-wanted",
update: (ids: number[] | undefined) => {
if (ids) {
reduxStore.dispatch(movieUpdateWantedList(ids) as any);
}
},
delete: bindToReduxStore(movieDeleteWantedItems),
},
{ {
key: "settings", key: "settings",
any: bindToReduxStore(systemUpdateSettings), any: bindToReduxStore(systemUpdateSettings),

Loading…
Cancel
Save