v3: add backlinks between dumps (via either dump url or dump target url mentioned through dump description and dump comments)
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 43s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 43s
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
THUMBNAILS_DIR,
|
||||
} from "../config.ts";
|
||||
import { linkAttachments } from "./attachment-service.ts";
|
||||
import { relinkBacklinks } from "./backlink-service.ts";
|
||||
|
||||
function isAllowedMime(mime: string): boolean {
|
||||
return DUMP_ALLOWED_MIME_PREFIXES.some((p) => mime.startsWith(p)) ||
|
||||
@@ -102,6 +103,7 @@ export async function createUrlDump(
|
||||
notifyMentions(userId, request.comment, "dump", dumpId, title);
|
||||
linkAttachments(request.comment, dumpId);
|
||||
}
|
||||
relinkBacklinks("dump_comment", dumpId, dumpId, request.comment ?? "");
|
||||
return dump;
|
||||
}
|
||||
|
||||
@@ -183,6 +185,7 @@ export async function createFileDump(
|
||||
notifyMentions(userId, comment, "dump", dumpId, finalTitle);
|
||||
linkAttachments(comment, dumpId);
|
||||
}
|
||||
relinkBacklinks("dump_comment", dumpId, dumpId, comment ?? "");
|
||||
return dump;
|
||||
}
|
||||
|
||||
@@ -326,6 +329,7 @@ export async function updateDump(
|
||||
);
|
||||
linkAttachments(updatedDump.comment, dumpId);
|
||||
}
|
||||
relinkBacklinks("dump_comment", dumpId, dumpId, updatedDump.comment ?? "");
|
||||
return updatedDump;
|
||||
}
|
||||
|
||||
@@ -393,6 +397,7 @@ export async function updateDump(
|
||||
);
|
||||
linkAttachments(updatedDump.comment, dumpId);
|
||||
}
|
||||
relinkBacklinks("dump_comment", dumpId, dumpId, updatedDump.comment ?? "");
|
||||
return updatedDump;
|
||||
}
|
||||
|
||||
@@ -457,6 +462,7 @@ export async function replaceFileDump(
|
||||
notifyMentions(dump.userId, comment, "dump", dumpId, finalTitle);
|
||||
linkAttachments(comment, dumpId);
|
||||
}
|
||||
relinkBacklinks("dump_comment", dumpId, dumpId, comment ?? "");
|
||||
return {
|
||||
...dump,
|
||||
title: finalTitle,
|
||||
|
||||
Reference in New Issue
Block a user