fix showing custom domain on the table when an link is edited.

closes #899
This commit is contained in:
Pouria Ezzati 2025-04-24 13:27:54 +03:30
parent f172884387
commit c2f6c7fc20

View File

@ -42,6 +42,11 @@ function normalizeMatch(match) {
delete newMatch.user_id;
}
if (newMatch.id) {
newMatch["links.id"] = newMatch.id;
delete newMatch.id;
}
if (newMatch.uuid) {
newMatch["links.uuid"] = newMatch.uuid;
delete newMatch.uuid;
@ -273,8 +278,11 @@ async function update(match, update) {
.where(match)
.update({ ...update, updated_at: utils.dateToUTC(new Date()) });
const updated_links = await knex("links").select('*').where(match);
const updated_links = await knex("links")
.select(selectable)
.where(normalizeMatch(match))
.leftJoin("domains", "links.domain_id", "domains.id");
if (env.REDIS_ENABLED) {
links.forEach(redis.remove.link);
updated_links.forEach(redis.remove.link);