Browse Source

refactor: chech limit position

poeti8 6 years ago
parent
commit
bd28c26239
1 changed files with 2 additions and 2 deletions
  1. 2 2
      server/controllers/linkController.ts

+ 2 - 2
server/controllers/linkController.ts

@@ -160,7 +160,7 @@ export const goToLink: Handler = async (req, res, next) => {
     if (!isMatch) {
       return res.status(401).json({ error: "Password is not correct" });
     }
-    if (link.visit_count < getStatsLimit() && link.user_id && !isBot) {
+    if (link.user_id && !isBot && link.visit_count < getStatsLimit()) {
       visitQueue.add({
         headers: req.headers,
         realIP: req.realIP,
@@ -172,7 +172,7 @@ export const goToLink: Handler = async (req, res, next) => {
     return res.status(200).json({ target: link.target });
   }
 
-  if (link.visit_count < getStatsLimit() && link.user_id && !isBot) {
+  if (link.user_id && !isBot && link.visit_count < getStatsLimit()) {
     visitQueue.add({
       headers: req.headers,
       realIP: req.realIP,