added client side checks on how long project or entity names can be

150 chars should be safely under the 1024 bytes mongo index limit
This commit is contained in:
Henry Oswald 2014-10-07 11:06:37 +01:00
parent b05c6bb001
commit 28b1e6bfe5
3 changed files with 10 additions and 6 deletions

View file

@ -272,9 +272,10 @@ define [
renameEntity: (entity, name, callback = (error) ->) ->
return if entity.name == name
entity.name = name
if name.length < 150
entity.name = name
return @ide.$http.post "/project/#{@ide.project_id}/#{entity.type}/#{entity.id}/rename", {
name: name,
name: entity.name,
_csrf: window.csrfToken
}

View file

@ -12,8 +12,10 @@ define [
$scope.$emit "project:rename:start"
$scope.finishRenaming = () ->
$scope.project.name = $scope.inputs.name
settings.saveProjectSettings({name: $scope.inputs.name})
newName = $scope.inputs.name
if newName.length < 150
$scope.project.name = newName
settings.saveProjectSettings({name: $scope.project.name})
$scope.state.renaming = false
ide.socket.on "projectNameUpdated", (name) ->

View file

@ -257,9 +257,10 @@ define [
window.location = "/project/#{project_id}"
$scope.renameProject = (project, newName) ->
project.name = newName
if newName.length < 150
project.name = newName
queuedHttp.post "/project/#{project.id}/rename", {
newProjectName: newName
newProjectName: project.name
_csrf: window.csrfToken
}