Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix updates to merge edits #399

Merged
2 commits merged into from
May 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -572,9 +606,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