Skip to content

Commit

Permalink
fix(annotation): do not export creator when user does not fill in cre…
Browse files Browse the repository at this point in the history
…ator name in settings
  • Loading branch information
panaC committed Feb 6, 2025
1 parent 085c374 commit 37a3d81
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/renderer/reader/components/ReaderMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ export const computeProgression = (spineItemLinks: Link[], locator: Locator) =>
return percent;
};

const getUuidFromUrn = (v: string | undefined) => `${v?.startsWith("urn:uuid:") ? v.split("urn:uuid:")[1] : v}`;
const getUuidFromUrn = (v: string | undefined): string => v?.startsWith("urn:uuid:") ? v.split("urn:uuid:")[1] : v || "";

const AnnotationCard: React.FC<{ timestamp: number, annotation: IAnnotationState, isEdited: boolean, triggerEdition: (v: boolean) => void, setTagFilter: (v: string) => void, setCreatorFilter: (v: string) => void } & Pick<IReaderMenuProps, "goToLocator">> = (props) => {

Expand Down Expand Up @@ -1168,7 +1168,11 @@ const AnnotationList: React.FC<{ annotationUUIDFocused: string, resetAnnotationU
const annotations = annotationListFiltered.map(([, anno]) => {
const { creator } = anno;
if (getUuidFromUrn(creator?.id) === getUuidFromUrn(creatorMyself.id)) {
return { ...anno, creator: { ...creatorMyself, id: "urn:uuid:" + creatorMyself.id } };
if (!creatorMyself.name) {
return { ...anno, creator: undefined };
} else {
return { ...anno, creator: { ...creatorMyself, id: "urn:uuid:" + creatorMyself.id } };
}
}
return anno;
});
Expand Down

0 comments on commit 37a3d81

Please sign in to comment.