Browse Source

Merge pull request #1691 from sharelatex/cmg-tag-duplicates

Stop duplicate tags being created

GitOrigin-RevId: 7e2b4228dc6ec7ebc2a4e30e18a6d5dcbd5cb6c8
Paulo Jorge Reis 7 years ago
parent
commit
144d936141
1 changed files with 8 additions and 2 deletions
  1. 8 2
      services/web/public/src/main/project-list/project-list.js

+ 8 - 2
services/web/public/src/main/project-list/project-list.js

@@ -403,8 +403,14 @@ define(['base'], function(App) {
       })
       })
 
 
       return modalInstance.result.then(function(tag) {
       return modalInstance.result.then(function(tag) {
-        $scope.tags.push(tag)
-        return $scope.addSelectedProjectsToTag(tag)
+        const tagIsDuplicate = $scope.tags.find(function(existingTag) {
+          return tag.name === existingTag.name
+        })
+
+        if (!tagIsDuplicate) {
+          $scope.tags.push(tag)
+          return $scope.addSelectedProjectsToTag(tag)
+        }
       })
       })
     }
     }