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

Stop duplicate tags being created

GitOrigin-RevId: 7e2b4228dc6ec7ebc2a4e30e18a6d5dcbd5cb6c8
This commit is contained in:
Paulo Jorge Reis 2019-04-08 11:19:20 +01:00 committed by sharelatex
parent 9e63211a17
commit 144d936141

View file

@ -403,8 +403,14 @@ define(['base'], function(App) {
})
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)
}
})
}