summaryrefslogtreecommitdiff
path: root/lib/api/helpers
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-04-24 13:59:00 +0100
committerSean McGivern <sean@gitlab.com>2018-04-24 13:59:00 +0100
commit6a88ffb412430820e23f19c7c32049abe1a019c3 (patch)
treefc99c7049b7dc4be4ac2f24a38a78026476f3da9 /lib/api/helpers
parentdb3774376aafbdea8db6840c88bd6d875cb9bac3 (diff)
parenta544f6ec58ba5f9cfbff6b59b50bc92bc2274bdb (diff)
downloadgitlab-ce-6a88ffb412430820e23f19c7c32049abe1a019c3.tar.gz
Merge branch 'master' into matbaj/gitlab-ce-add-inherit-command
Diffstat (limited to 'lib/api/helpers')
-rw-r--r--lib/api/helpers/notes_helpers.rb4
-rw-r--r--lib/api/helpers/project_snapshots_helpers.rb25
2 files changed, 28 insertions, 1 deletions
diff --git a/lib/api/helpers/notes_helpers.rb b/lib/api/helpers/notes_helpers.rb
index cd91df1ecd8..b74b8149834 100644
--- a/lib/api/helpers/notes_helpers.rb
+++ b/lib/api/helpers/notes_helpers.rb
@@ -64,8 +64,10 @@ module API
authorize! :create_note, noteable
parent = noteable_parent(noteable)
+
if opts[:created_at]
- opts.delete(:created_at) unless current_user.admin? || parent.owner == current_user
+ opts.delete(:created_at) unless
+ current_user.admin? || parent.owned_by?(current_user)
end
project = parent if parent.is_a?(Project)
diff --git a/lib/api/helpers/project_snapshots_helpers.rb b/lib/api/helpers/project_snapshots_helpers.rb
new file mode 100644
index 00000000000..94798a8cb51
--- /dev/null
+++ b/lib/api/helpers/project_snapshots_helpers.rb
@@ -0,0 +1,25 @@
+module API
+ module Helpers
+ module ProjectSnapshotsHelpers
+ def authorize_read_git_snapshot!
+ authenticated_with_full_private_access!
+ end
+
+ def send_git_snapshot(repository)
+ header(*Gitlab::Workhorse.send_git_snapshot(repository))
+ end
+
+ def snapshot_project
+ user_project
+ end
+
+ def snapshot_repository
+ if to_boolean(params[:wiki])
+ snapshot_project.wiki.repository
+ else
+ snapshot_project.repository
+ end
+ end
+ end
+ end
+end