Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
aaaed331
Commit
aaaed331
authored
May 13, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix hook data for Wiki Page event
Added "wiki" section and removed "repository"
parent
ef4fedc1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
10 deletions
+37
-10
app/models/project_wiki.rb
app/models/project_wiki.rb
+14
-0
app/services/wiki_pages/base_service.rb
app/services/wiki_pages/base_service.rb
+2
-3
doc/web_hooks/web_hooks.md
doc/web_hooks/web_hooks.md
+8
-7
spec/models/project_wiki_spec.rb
spec/models/project_wiki_spec.rb
+13
-0
No files found.
app/models/project_wiki.rb
View file @
aaaed331
...
...
@@ -27,6 +27,10 @@ class ProjectWiki
@project
.
path_with_namespace
+
".wiki"
end
def
web_url
Gitlab
::
Routing
.
url_helpers
.
namespace_project_wiki_url
(
@project
.
namespace
,
@project
,
:home
)
end
def
url_to_repo
gitlab_shell
.
url_to_repo
(
path_with_namespace
)
end
...
...
@@ -142,6 +146,16 @@ class ProjectWiki
wiki
end
def
hook_attrs
{
web_url:
web_url
,
git_ssh_url:
ssh_url_to_repo
,
git_http_url:
http_url_to_repo
,
path_with_namespace:
path_with_namespace
,
default_branch:
default_branch
,
}
end
private
def
init_repo
(
path_with_namespace
)
...
...
app/services/wiki_pages/base_service.rb
View file @
aaaed331
...
...
@@ -6,9 +6,8 @@ module WikiPages
object_kind:
page
.
class
.
name
.
underscore
,
user:
current_user
.
hook_attrs
,
project:
@project
.
hook_attrs
,
object_attributes:
page
.
hook_attrs
,
# DEPRECATED
repository:
@project
.
hook_attrs
.
slice
(
:name
,
:url
,
:description
,
:homepage
)
wiki:
@project
.
wiki
.
hook_attrs
,
object_attributes:
page
.
hook_attrs
}
page_url
=
Gitlab
::
UrlBuilder
.
build
(
page
)
...
...
doc/web_hooks/web_hooks.md
View file @
aaaed331
...
...
@@ -720,7 +720,7 @@ X-Gitlab-Event: Wiki Page Hook
"description"
:
"This is awesome"
,
"web_url"
:
"http://example.com/root/awesome-project"
,
"avatar_url"
:
null
,
"git_ssh_url"
:
"git@example.com:root/
test
-project.git"
,
"git_ssh_url"
:
"git@example.com:root/
awesome
-project.git"
,
"git_http_url"
:
"http://example.com/root/awesome-project.git"
,
"namespace"
:
"root"
,
"visibility_level"
:
0
,
...
...
@@ -731,6 +731,13 @@ X-Gitlab-Event: Wiki Page Hook
"ssh_url"
:
"git@example.com:root/awesome-project.git"
,
"http_url"
:
"http://example.com/root/awesome-project.git"
},
"wiki"
:
{
"web_url"
:
"http://example.com/root/awesome-project/wikis/home"
,
"git_ssh_url"
:
"git@example.com:root/awesome-project.wiki.git"
,
"git_http_url"
:
"http://example.com/root/awesome-project.wiki.git"
,
"path_with_namespace"
:
"root/awesome-project.wiki"
,
"default_branch"
:
"master"
},
"object_attributes"
:
{
"title"
:
"Awesome"
,
"content"
:
"awesome content goes here"
,
...
...
@@ -739,12 +746,6 @@ X-Gitlab-Event: Wiki Page Hook
"slug"
:
"awesome"
,
"url"
:
"http://example.com/root/awesome-project/wikis/awesome"
,
"action"
:
"create"
},
"repository"
:
{
"name"
:
"awesome-project"
,
"url"
:
"git@example.com:root/awesome-project.git"
,
"description"
:
"test"
,
"homepage"
:
"http://example.com/root/awesome-project"
}
}
```
...
...
spec/models/project_wiki_spec.rb
View file @
aaaed331
...
...
@@ -16,6 +16,12 @@ describe ProjectWiki, models: true do
end
end
describe
'#web_url'
do
it
'returns the full web URL to the wiki'
do
expect
(
subject
.
web_url
).
to
eq
(
"
#{
Gitlab
.
config
.
gitlab
.
url
}
/
#{
project
.
path_with_namespace
}
/wikis/home"
)
end
end
describe
"#url_to_repo"
do
it
"returns the correct ssh url to the repo"
do
expect
(
subject
.
url_to_repo
).
to
eq
(
gitlab_shell
.
url_to_repo
(
subject
.
path_with_namespace
))
...
...
@@ -257,6 +263,13 @@ describe ProjectWiki, models: true do
end
end
describe
'#hook_attrs'
do
it
'returns a hash with values'
do
expect
(
subject
.
hook_attrs
).
to
be_a
Hash
expect
(
subject
.
hook_attrs
.
keys
).
to
contain_exactly
(
:web_url
,
:git_ssh_url
,
:git_http_url
,
:path_with_namespace
,
:default_branch
)
end
end
private
def
create_temp_repo
(
path
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment