BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
1c040b3f
Commit
1c040b3f
authored
Nov 17, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
parents
6379978c
93262415
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletion
+29
-1
project_wiki.rb
app/models/project_wiki.rb
+10
-0
project_was_moved_email.text.erb
app/views/notify/project_was_moved_email.text.erb
+1
-1
project_wiki_spec.rb
spec/models/project_wiki_spec.rb
+18
-0
No files found.
app/models/project_wiki.rb
View file @
1c040b3f
...
@@ -86,6 +86,8 @@ class ProjectWiki
...
@@ -86,6 +86,8 @@ class ProjectWiki
commit
=
commit_details
(
:created
,
message
,
title
)
commit
=
commit_details
(
:created
,
message
,
title
)
wiki
.
write_page
(
title
,
format
,
content
,
commit
)
wiki
.
write_page
(
title
,
format
,
content
,
commit
)
update_project_activity
rescue
Gollum
::
DuplicatePageError
=>
e
rescue
Gollum
::
DuplicatePageError
=>
e
@error_message
=
"Duplicate page:
#{
e
.
message
}
"
@error_message
=
"Duplicate page:
#{
e
.
message
}
"
return
false
return
false
...
@@ -95,10 +97,14 @@ class ProjectWiki
...
@@ -95,10 +97,14 @@ class ProjectWiki
commit
=
commit_details
(
:updated
,
message
,
page
.
title
)
commit
=
commit_details
(
:updated
,
message
,
page
.
title
)
wiki
.
update_page
(
page
,
page
.
name
,
format
,
content
,
commit
)
wiki
.
update_page
(
page
,
page
.
name
,
format
,
content
,
commit
)
update_project_activity
end
end
def
delete_page
(
page
,
message
=
nil
)
def
delete_page
(
page
,
message
=
nil
)
wiki
.
delete_page
(
page
,
commit_details
(
:deleted
,
message
,
page
.
title
))
wiki
.
delete_page
(
page
,
commit_details
(
:deleted
,
message
,
page
.
title
))
update_project_activity
end
end
def
page_title_and_dir
(
title
)
def
page_title_and_dir
(
title
)
...
@@ -146,4 +152,8 @@ class ProjectWiki
...
@@ -146,4 +152,8 @@ class ProjectWiki
def
path_to_repo
def
path_to_repo
@path_to_repo
||=
File
.
join
(
Gitlab
.
config
.
gitlab_shell
.
repos_path
,
"
#{
path_with_namespace
}
.git"
)
@path_to_repo
||=
File
.
join
(
Gitlab
.
config
.
gitlab_shell
.
repos_path
,
"
#{
path_with_namespace
}
.git"
)
end
end
def
update_project_activity
@project
.
touch
(
:last_activity_at
)
end
end
end
app/views/notify/project_was_moved_email.text.erb
View file @
1c040b3f
Project
#{@old_path_with_namespace}
was moved to another location
Project
<%=
@old_path_with_namespace
%>
was moved to another location
The project is now located under
The project is now located under
<%=
namespace_project_url
(
@project
.
namespace
,
@project
)
%>
<%=
namespace_project_url
(
@project
.
namespace
,
@project
)
%>
...
...
spec/models/project_wiki_spec.rb
View file @
1c040b3f
...
@@ -184,6 +184,12 @@ describe ProjectWiki do
...
@@ -184,6 +184,12 @@ describe ProjectWiki do
subject
.
create_page
(
"test page"
,
"some content"
,
:markdown
,
"commit message"
)
subject
.
create_page
(
"test page"
,
"some content"
,
:markdown
,
"commit message"
)
expect
(
subject
.
pages
.
first
.
page
.
version
.
message
).
to
eq
(
"commit message"
)
expect
(
subject
.
pages
.
first
.
page
.
version
.
message
).
to
eq
(
"commit message"
)
end
end
it
'updates project activity'
do
expect
(
subject
).
to
receive
(
:update_project_activity
)
subject
.
create_page
(
'Test Page'
,
'This is content'
)
end
end
end
describe
"#update_page"
do
describe
"#update_page"
do
...
@@ -205,6 +211,12 @@ describe ProjectWiki do
...
@@ -205,6 +211,12 @@ describe ProjectWiki do
it
"sets the correct commit message"
do
it
"sets the correct commit message"
do
expect
(
@page
.
version
.
message
).
to
eq
(
"updated page"
)
expect
(
@page
.
version
.
message
).
to
eq
(
"updated page"
)
end
end
it
'updates project activity'
do
expect
(
subject
).
to
receive
(
:update_project_activity
)
subject
.
update_page
(
@gollum_page
,
'Yet more content'
,
:markdown
,
'Updated page again'
)
end
end
end
describe
"#delete_page"
do
describe
"#delete_page"
do
...
@@ -217,6 +229,12 @@ describe ProjectWiki do
...
@@ -217,6 +229,12 @@ describe ProjectWiki do
subject
.
delete_page
(
@page
)
subject
.
delete_page
(
@page
)
expect
(
subject
.
pages
.
count
).
to
eq
(
0
)
expect
(
subject
.
pages
.
count
).
to
eq
(
0
)
end
end
it
'updates project activity'
do
expect
(
subject
).
to
receive
(
:update_project_activity
)
subject
.
delete_page
(
@page
)
end
end
end
private
private
...
...
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