Skip to content

Commit

Permalink
Fix - save public list order changes on publish (#3022)
Browse files Browse the repository at this point in the history
Co-authored-by: miko <[email protected]>
  • Loading branch information
keikari and miko authored Nov 10, 2023
1 parent e97c8e8 commit f2eec14
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions ui/redux/selectors/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ export const selectHasPrivateCollectionForId = (state: State, id: string) => {

if (COLLECTIONS_CONSTS.BUILTIN_PLAYLISTS.includes(id)) return true;

if (selectCollectionHasEditsForId(state, id)) {
if (selectCollectionHasEditsForId(state, id) || selectCollectionHasUnsavedEditsForId(state, id)) {
const urlParams = new URLSearchParams(window.location.search);
const isOnPublicView = urlParams.get(COLLECTION_PAGE.QUERIES.VIEW) === COLLECTION_PAGE.VIEWS.PUBLIC;
if (!isOnPublicView) return true;
Expand All @@ -368,7 +368,11 @@ export const selectHasPrivateCollectionForId = (state: State, id: string) => {

// Is private === only private (doesn't include public with private edits)
export const selectIsCollectionPrivateForId = (state: State, id: string) =>
Boolean(selectHasPrivateCollectionForId(state, id) && !selectCollectionHasEditsForId(state, id));
Boolean(
selectHasPrivateCollectionForId(state, id) &&
!selectCollectionHasEditsForId(state, id) &&
!selectCollectionHasUnsavedEditsForId(state, id)
);

export const selectClaimIdsForCollectionId = createSelector(
selectHasPrivateCollectionForId,
Expand Down
4 changes: 3 additions & 1 deletion ui/redux/selectors/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
selectClaimIdsForCollectionId,
selectIsCollectionPrivateForId,
selectCollectionHasEditsForId,
selectCollectionHasUnsavedEditsForId,
selectCollectionTitleForId,
} from 'redux/selectors/collections';
import { selectActiveChannelClaimId, selectIncognito } from 'redux/selectors/app';
Expand Down Expand Up @@ -276,8 +277,9 @@ export const selectCollectionClaimUploadParamsForId = (state: State, collectionI
};

const hasEdits = selectCollectionHasEditsForId(state, collectionId);
const hasUnSavedEdits = selectCollectionHasUnsavedEditsForId(state, collectionId);

if (hasEdits) {
if (hasEdits || hasUnSavedEdits) {
// $FlowFixMe please
Object.assign(collectionClaimUploadParams, privateCollectionParams);
}
Expand Down

0 comments on commit f2eec14

Please sign in to comment.