Fix wanted pages are not updated properly after changing language profile

This commit is contained in:
LASER-Yi 2021-07-22 21:13:07 +08:00
parent bb1c30a921
commit ed30f76c57
3 changed files with 32 additions and 26 deletions

View File

@ -716,6 +716,15 @@ class Series(Resource):
list_missing_subtitles(no=seriesId, send_event=False)
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')
return '', 204
@ -963,6 +972,7 @@ class Movies(Resource):
list_missing_subtitles_movies(no=radarrId, send_event=False)
event_stream(type='movie', payload=radarrId)
event_stream(type='movie-wanted', payload=radarrId)
event_stream(type='badges')
return '', 204

View File

@ -5,13 +5,11 @@ import {
episodeDeleteItems,
episodeUpdateBy,
episodeUpdateById,
movieDeleteWantedItems,
movieUpdateBlacklist,
movieUpdateHistoryList,
movieUpdateList,
movieUpdateWantedList,
providerUpdateList,
seriesDeleteWantedItems,
seriesUpdateBlacklist,
seriesUpdateHistoryList,
seriesUpdateList,
@ -324,18 +322,6 @@ export function useWantedSeries() {
const update = useReduxAction(seriesUpdateWantedList);
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);
}
@ -343,18 +329,6 @@ export function useWantedMovies() {
const update = useReduxAction(movieUpdateWantedList);
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);
}

View File

@ -3,9 +3,13 @@ import {
badgeUpdateAll,
bootstrap,
movieDeleteItems,
movieDeleteWantedItems,
movieUpdateList,
movieUpdateWantedList,
seriesDeleteItems,
seriesDeleteWantedItems,
seriesUpdateList,
seriesUpdateWantedList,
siteAddNotifications,
siteAddProgress,
siteInitializationFailed,
@ -91,6 +95,24 @@ export function createDefaultReducer(): SocketIO.Reducer[] {
update: bindToReduxStore(movieUpdateList),
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",
any: bindToReduxStore(systemUpdateSettings),