Skip to content

Commit f9b90f3

Browse files
committed
eliminate republish flag
1 parent 4027e1f commit f9b90f3

1 file changed

Lines changed: 12 additions & 23 deletions

File tree

apps/obsidian/src/utils/publishNode.ts

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -251,30 +251,23 @@ export const publishNode = async ({
251251
plugin,
252252
file,
253253
frontmatter,
254-
republish,
255254
}: {
256255
plugin: DiscourseGraphPlugin;
257256
file: TFile;
258257
frontmatter: FrontMatterCache;
259-
republish?: boolean;
260258
}): Promise<void> => {
261259
const client = await getLoggedInClient(plugin);
262260
if (!client) throw new Error("Cannot get client");
263261
const myGroups = new Set(await getAvailableGroupIds(client));
264262
if (myGroups.size === 0) throw new Error("Cannot get group");
265263
const existingPublish =
266264
(frontmatter.publishedToGroups as undefined | string[]) || [];
267-
if (!republish) await syncAllNodesAndRelations(plugin);
265+
// Hopefully temporary workaround for sync bug
266+
await syncAllNodesAndRelations(plugin);
268267
const commonGroups = existingPublish.filter((g) => myGroups.has(g));
269268
// temporary single-group assumption
270269
const myGroup = (commonGroups.length > 0 ? commonGroups : [...myGroups])[0]!;
271-
return await publishNodeToGroup({
272-
plugin,
273-
file,
274-
frontmatter,
275-
myGroup,
276-
republish,
277-
});
270+
return await publishNodeToGroup({ plugin, file, frontmatter, myGroup });
278271
};
279272

280273
export const ensurePublishedRelationsAccuracy = async ({
@@ -422,13 +415,11 @@ export const publishNodeToGroup = async ({
422415
file,
423416
frontmatter,
424417
myGroup,
425-
republish,
426418
}: {
427419
plugin: DiscourseGraphPlugin;
428420
file: TFile;
429421
frontmatter: FrontMatterCache;
430422
myGroup: string;
431-
republish?: boolean;
432423
}): Promise<void> => {
433424
const nodeId = frontmatter.nodeInstanceId as string | undefined;
434425
if (!nodeId) throw new Error("Please sync the node first");
@@ -475,8 +466,7 @@ export const publishNodeToGroup = async ({
475466
);
476467

477468
const skipPublishAccess =
478-
republish ||
479-
(existingPublish.includes(myGroup) && lastModified <= lastModifiedDb);
469+
existingPublish.includes(myGroup) && lastModified <= lastModifiedDb;
480470

481471
if (!skipPublishAccess) {
482472
const publishSpaceResponse = await client.from("SpaceAccess").upsert(
@@ -518,15 +508,14 @@ export const publishNodeToGroup = async ({
518508
});
519509
}
520510
}
521-
if (!republish)
522-
await syncPublishedNodeAssets({
523-
plugin,
524-
client,
525-
nodeId,
526-
spaceId,
527-
file,
528-
attachments,
529-
});
511+
await syncPublishedNodeAssets({
512+
plugin,
513+
client,
514+
nodeId,
515+
spaceId,
516+
file,
517+
attachments,
518+
});
530519
if (!existingPublish.includes(myGroup))
531520
await plugin.app.fileManager.processFrontMatter(
532521
file,

0 commit comments

Comments
 (0)