Parcourir la source

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

closes #899
Pouria Ezzati il y a 8 mois
Parent
commit
c2f6c7fc20
1 fichiers modifiés avec 10 ajouts et 2 suppressions
  1. 10 2
      server/queries/link.queries.js

+ 10 - 2
server/queries/link.queries.js

@@ -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);