mirror of https://github.com/lidarr/Lidarr
Fixed: Refresh album files after renaming
This commit is contained in:
parent
e6e50c8784
commit
edad5d0a74
|
@ -70,6 +70,12 @@ function createMapStateToProps() {
|
|||
isCommandExecuting(isSearchingCommand) &&
|
||||
isSearchingCommand.body.albumIds.indexOf(album.id) > -1
|
||||
);
|
||||
const isRenamingFiles = isCommandExecuting(findCommand(commands, { name: commandNames.RENAME_FILES, artistId: artist.id }));
|
||||
const isRenamingArtistCommand = findCommand(commands, { name: commandNames.RENAME_ARTIST });
|
||||
const isRenamingArtist = (
|
||||
isCommandExecuting(isRenamingArtistCommand) &&
|
||||
isRenamingArtistCommand.body.artistIds.indexOf(artist.id) > -1
|
||||
);
|
||||
|
||||
const isFetching = tracks.isFetching || isTrackFilesFetching;
|
||||
const isPopulated = tracks.isPopulated && isTrackFilesPopulated;
|
||||
|
@ -80,6 +86,8 @@ function createMapStateToProps() {
|
|||
shortDateFormat: uiSettings.shortDateFormat,
|
||||
artist,
|
||||
isSearching,
|
||||
isRenamingFiles,
|
||||
isRenamingArtist,
|
||||
isFetching,
|
||||
isPopulated,
|
||||
tracksError,
|
||||
|
@ -113,8 +121,27 @@ class AlbumDetailsConnector extends Component {
|
|||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if (!_.isEqual(getMonitoredReleases(prevProps), getMonitoredReleases(this.props)) ||
|
||||
(prevProps.anyReleaseOk === false && this.props.anyReleaseOk === true)) {
|
||||
const {
|
||||
id,
|
||||
anyReleaseOk,
|
||||
isRenamingFiles,
|
||||
isRenamingArtist
|
||||
} = this.props;
|
||||
|
||||
if (
|
||||
(prevProps.isRenamingFiles && !isRenamingFiles) ||
|
||||
(prevProps.isRenamingArtist && !isRenamingArtist) ||
|
||||
!_.isEqual(getMonitoredReleases(prevProps), getMonitoredReleases(this.props)) ||
|
||||
(prevProps.anyReleaseOk === false && anyReleaseOk === true)
|
||||
) {
|
||||
this.unpopulate();
|
||||
this.populate();
|
||||
}
|
||||
|
||||
// If the id has changed we need to clear the album
|
||||
// files and fetch from the server.
|
||||
|
||||
if (prevProps.id !== id) {
|
||||
this.unpopulate();
|
||||
this.populate();
|
||||
}
|
||||
|
@ -174,6 +201,8 @@ class AlbumDetailsConnector extends Component {
|
|||
AlbumDetailsConnector.propTypes = {
|
||||
id: PropTypes.number,
|
||||
anyReleaseOk: PropTypes.bool,
|
||||
isRenamingFiles: PropTypes.bool.isRequired,
|
||||
isRenamingArtist: PropTypes.bool.isRequired,
|
||||
isAlbumFetching: PropTypes.bool,
|
||||
isAlbumPopulated: PropTypes.bool,
|
||||
foreignAlbumId: PropTypes.string.isRequired,
|
||||
|
|
|
@ -107,7 +107,6 @@ function createMapStateToProps() {
|
|||
const isRefreshing = isArtistRefreshing || allArtistRefreshing;
|
||||
const isSearching = isCommandExecuting(findCommand(commands, { name: commandNames.ARTIST_SEARCH, artistId: artist.id }));
|
||||
const isRenamingFiles = isCommandExecuting(findCommand(commands, { name: commandNames.RENAME_FILES, artistId: artist.id }));
|
||||
|
||||
const isRenamingArtistCommand = findCommand(commands, { name: commandNames.RENAME_ARTIST });
|
||||
const isRenamingArtist = (
|
||||
isCommandExecuting(isRenamingArtistCommand) &&
|
||||
|
|
Loading…
Reference in New Issue