summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-03-14 15:55:05 +0000
committerRobert Speicher <robert@gitlab.com>2016-03-14 15:55:05 +0000
commit1421fa962ef9aaae6b5756054644606f3543ccce (patch)
treee20f0a7fa7310b164d45b6df3a809e8dec8ad12a
parent9c3643046b40e66a7754aabe2513ccdee292a4ef (diff)
parentbefa7a9c170327ecc4ce698f416450dc3542942c (diff)
downloadgitlab-ce-1421fa962ef9aaae6b5756054644606f3543ccce.tar.gz
Merge branch 'rs-snippet-expires-api' into 'master'
Don't remove `ProjectSnippet#expires_at` from API See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3103 This partially reverts commit 836d5930332797192094ce4a3c8083e96f7e8c53. See merge request !3144
-rw-r--r--doc/api/notes.md1
-rw-r--r--doc/api/project_snippets.md1
-rw-r--r--doc/web_hooks/web_hooks.md1
-rw-r--r--lib/api/entities.rb3
-rw-r--r--spec/requests/api/project_snippets_spec.rb18
5 files changed, 24 insertions, 0 deletions
diff --git a/doc/api/notes.md b/doc/api/notes.md
index 85d4f0bafa2..d4d63e825ab 100644
--- a/doc/api/notes.md
+++ b/doc/api/notes.md
@@ -145,6 +145,7 @@ Parameters:
"state": "active",
"created_at": "2013-09-30T13:46:01Z"
},
+ "expires_at": null,
"updated_at": "2013-10-02T07:34:20Z",
"created_at": "2013-10-02T07:34:20Z"
}
diff --git a/doc/api/project_snippets.md b/doc/api/project_snippets.md
index fb802102e3a..a7acf37b5bc 100644
--- a/doc/api/project_snippets.md
+++ b/doc/api/project_snippets.md
@@ -51,6 +51,7 @@ Parameters:
"state": "active",
"created_at": "2012-05-23T08:00:58Z"
},
+ "expires_at": null,
"updated_at": "2012-06-28T10:52:04Z",
"created_at": "2012-06-28T10:52:04Z"
}
diff --git a/doc/web_hooks/web_hooks.md b/doc/web_hooks/web_hooks.md
index 87049427139..afdf1a682e2 100644
--- a/doc/web_hooks/web_hooks.md
+++ b/doc/web_hooks/web_hooks.md
@@ -582,6 +582,7 @@ X-Gitlab-Event: Note Hook
"created_at": "2015-04-09 02:40:38 UTC",
"updated_at": "2015-04-09 02:40:38 UTC",
"file_name": "test.rb",
+ "expires_at": null,
"type": "ProjectSnippet",
"visibility_level": 0
}
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 5b5b8bd044b..b49af093a14 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -144,6 +144,9 @@ module API
expose :id, :title, :file_name
expose :author, using: Entities::UserBasic
expose :updated_at, :created_at
+
+ # TODO (rspeicher): Deprecated; remove in 9.0
+ expose(:expires_at) { |snippet| nil }
end
class ProjectEntity < Grape::Entity
diff --git a/spec/requests/api/project_snippets_spec.rb b/spec/requests/api/project_snippets_spec.rb
new file mode 100644
index 00000000000..3722ddf5a33
--- /dev/null
+++ b/spec/requests/api/project_snippets_spec.rb
@@ -0,0 +1,18 @@
+require 'rails_helper'
+
+describe API::API, api: true do
+ include ApiHelpers
+
+ describe 'GET /projects/:project_id/snippets/:id' do
+ # TODO (rspeicher): Deprecated; remove in 9.0
+ it 'always exposes expires_at as nil' do
+ admin = create(:admin)
+ snippet = create(:project_snippet, author: admin)
+
+ get api("/projects/#{snippet.project.id}/snippets/#{snippet.id}", admin)
+
+ expect(json_response).to have_key('expires_at')
+ expect(json_response['expires_at']).to be_nil
+ end
+ end
+end