summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities.rb2
-rw-r--r--lib/api/groups.rb2
-rw-r--r--lib/api/helpers.rb4
-rw-r--r--lib/api/internal.rb2
4 files changed, 5 insertions, 5 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 8d0664386b4..7572104fc16 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -65,7 +65,7 @@ module API
end
class Group < Grape::Entity
- expose :id, :name, :path, :owner_id, :description
+ expose :id, :name, :path, :description
end
class GroupDetail < Group
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index 384a28e41f5..a92abd4b690 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -33,9 +33,9 @@ module API
attrs = attributes_for_keys [:name, :path, :description]
@group = Group.new(attrs)
- @group.owner = current_user
if @group.save
+ @group.add_owner(current_user)
present @group, with: Entities::Group
else
render_api_error!("Failed to save group #{@group.errors.messages}", 400)
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index a50ee4659a3..228a719fbdf 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -83,7 +83,7 @@ module API
end
def authenticate_by_gitlab_shell_token!
- unauthorized! unless secret_token == params['secret_token']
+ unauthorized! unless secret_token == params['secret_token'].try(:chomp)
end
def authenticated_as_admin!
@@ -236,7 +236,7 @@ module API
end
def secret_token
- File.read(Rails.root.join('.gitlab_shell_secret'))
+ File.read(Rails.root.join('.gitlab_shell_secret')).chomp
end
def handle_member_errors(errors)
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index b5542c1874b..ba3fe619b92 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -74,7 +74,7 @@ module API
if message = BroadcastMessage.current
present message, with: Entities::BroadcastMessage
else
- not_found!
+ {}
end
end
end