Sfoglia il codice sorgente

fix: only ban if has user_id

poeti8 6 anni fa
parent
commit
dd510e3050
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      server/handlers/links.ts

+ 2 - 2
server/handlers/links.ts

@@ -173,12 +173,12 @@ export const ban: Handler = async (req, res) => {
   }
 
   // 5. Ban link owner
-  if (req.body.user) {
+  if (req.body.user && link.user_id) {
     tasks.push(query.user.update({ id: link.user_id }, update));
   }
 
   // 6. Ban all of owner's links
-  if (req.body.userLinks) {
+  if (req.body.userLinks && link.user_id) {
     tasks.push(query.link.update({ user_id: link.user_id }, update));
   }