Skip to content

Commit

Permalink
Fix updates to merge edits (stashapp#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
InfiniteStash authored and feederbox826 committed Nov 15, 2023
1 parent 526e652 commit f13f70b
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 4 deletions.
42 changes: 40 additions & 2 deletions frontend/src/graphql/definitions/EditUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,40 @@ import { TargetTypeEnum, OperationEnum, VoteStatusEnum, GenderEnum, HairColorEnu
// GraphQL query operation: EditUpdate
// ====================================================

export interface EditUpdate_findEdit_merge_sources_Tag {
__typename: "Tag";
id: string;
}

export interface EditUpdate_findEdit_merge_sources_Performer {
__typename: "Performer";
id: string;
}

export interface EditUpdate_findEdit_merge_sources_Studio {
__typename: "Studio";
id: string;
}

export interface EditUpdate_findEdit_merge_sources_Scene {
__typename: "Scene";
id: string;
}

export type EditUpdate_findEdit_merge_sources = EditUpdate_findEdit_merge_sources_Tag | EditUpdate_findEdit_merge_sources_Performer | EditUpdate_findEdit_merge_sources_Studio | EditUpdate_findEdit_merge_sources_Scene;

export interface EditUpdate_findEdit_options {
__typename: "PerformerEditOptions";
/**
* Set performer alias on scenes without alias to old name if name is changed
*/
set_modify_aliases: boolean;
/**
* Set performer alias on scenes attached to merge sources to old name
*/
set_merge_aliases: boolean;
}

export interface EditUpdate_findEdit_user {
__typename: "User";
id: string;
Expand Down Expand Up @@ -579,9 +613,13 @@ export interface EditUpdate_findEdit {
*/
vote_count: number;
/**
* Is the edit considered destructive.
* Objects to merge with the target. Only applicable to merges
*/
merge_sources: EditUpdate_findEdit_merge_sources[];
/**
* Entity specific options
*/
destructive: boolean;
options: EditUpdate_findEdit_options | null;
user: EditUpdate_findEdit_user | null;
/**
* Object being edited - null if creating a new object
Expand Down
19 changes: 18 additions & 1 deletion frontend/src/graphql/queries/EditUpdate.gql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,24 @@ query EditUpdate($id: ID!) {
created
updated
vote_count
destructive
merge_sources {
... on Tag {
id
}
... on Performer {
id
}
... on Studio {
id
}
... on Scene {
id
}
}
options {
set_modify_aliases
set_merge_aliases
}
user {
id
name
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/pages/performers/PerformerEditUpdate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export const PerformerEditUpdate: FC<{ edit: Edit }> = ({ edit }) => {

const doUpdate = (
updateData: PerformerEditDetailsInput,
editNote: string
editNote: string,
setModifyAliases: boolean
) => {
if (!isPerformerDetails(edit.details)) return;

Expand All @@ -44,6 +45,11 @@ export const PerformerEditUpdate: FC<{ edit: Edit }> = ({ edit }) => {
id: edit.target?.id,
operation: edit.operation,
comment: editNote,
merge_source_ids: edit.merge_sources.map((s) => s.id),
},
options: {
set_modify_aliases: setModifyAliases,
set_merge_aliases: edit.options?.set_merge_aliases,
},
details,
},
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/studios/StudioEditUpdate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const StudioEditUpdate: FC<{ edit: Edit }> = ({ edit }) => {
id: edit.target?.id,
operation: edit.operation,
comment: editNote,
merge_source_ids: edit.merge_sources.map((s) => s.id),
},
details: updateData,
},
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/tags/TagEditUpdate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const TagEditUpdate: FC<{ edit: Edit }> = ({ edit }) => {
id: edit.target?.id,
operation: edit.operation,
comment: editNote,
merge_source_ids: edit.merge_sources.map((s) => s.id),
},
details: updateData,
},
Expand Down

0 comments on commit f13f70b

Please sign in to comment.