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
Boxiang Sun
gitlab-ce
Commits
e35fc8b9
Commit
e35fc8b9
authored
Sep 17, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use commit email for wiki actions
parent
3c5c658a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
app/models/project_wiki.rb
app/models/project_wiki.rb
+1
-1
spec/models/project_wiki_spec.rb
spec/models/project_wiki_spec.rb
+23
-3
No files found.
app/models/project_wiki.rb
View file @
e35fc8b9
...
@@ -188,7 +188,7 @@ class ProjectWiki
...
@@ -188,7 +188,7 @@ class ProjectWiki
Gitlab
::
Git
::
Wiki
::
CommitDetails
.
new
(
@user
.
id
,
Gitlab
::
Git
::
Wiki
::
CommitDetails
.
new
(
@user
.
id
,
@user
.
username
,
@user
.
username
,
@user
.
name
,
@user
.
name
,
@user
.
email
,
@user
.
commit_
email
,
commit_message
)
commit_message
)
end
end
...
...
spec/models/project_wiki_spec.rb
View file @
e35fc8b9
...
@@ -2,12 +2,13 @@
...
@@ -2,12 +2,13 @@
require
"spec_helper"
require
"spec_helper"
describe
ProjectWiki
do
describe
ProjectWiki
do
let
(
:project
)
{
create
(
:project
,
:wiki_repo
)
}
let
(
:user
)
{
create
(
:user
,
:commit_email
)
}
let
(
:project
)
{
create
(
:project
,
:wiki_repo
,
namespace:
user
.
namespace
)
}
let
(
:repository
)
{
project
.
repository
}
let
(
:repository
)
{
project
.
repository
}
let
(
:user
)
{
project
.
owner
}
let
(
:gitlab_shell
)
{
Gitlab
::
Shell
.
new
}
let
(
:gitlab_shell
)
{
Gitlab
::
Shell
.
new
}
let
(
:project_wiki
)
{
described_class
.
new
(
project
,
user
)
}
let
(
:project_wiki
)
{
described_class
.
new
(
project
,
user
)
}
let
(
:raw_repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
project
.
repository_storage
,
subject
.
disk_path
+
'.git'
,
'foo'
)
}
let
(
:raw_repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
project
.
repository_storage
,
subject
.
disk_path
+
'.git'
,
'foo'
)
}
let
(
:commit
)
{
project_wiki
.
repository
.
head_commit
}
subject
{
project_wiki
}
subject
{
project_wiki
}
...
@@ -276,6 +277,13 @@ describe ProjectWiki do
...
@@ -276,6 +277,13 @@ describe ProjectWiki do
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
'sets the correct commit email'
do
subject
.
create_page
(
'test page'
,
'content'
)
expect
(
commit
.
author_email
).
to
eq
(
user
.
commit_email
)
expect
(
commit
.
committer_email
).
to
eq
(
user
.
commit_email
)
end
it
'updates project activity'
do
it
'updates project activity'
do
subject
.
create_page
(
'Test Page'
,
'This is content'
)
subject
.
create_page
(
'Test Page'
,
'This is content'
)
...
@@ -320,6 +328,11 @@ describe ProjectWiki do
...
@@ -320,6 +328,11 @@ describe ProjectWiki do
expect
(
@page
.
version
.
message
).
to
eq
(
"updated page"
)
expect
(
@page
.
version
.
message
).
to
eq
(
"updated page"
)
end
end
it
'sets the correct commit email'
do
expect
(
commit
.
author_email
).
to
eq
(
user
.
commit_email
)
expect
(
commit
.
committer_email
).
to
eq
(
user
.
commit_email
)
end
it
'updates project activity'
do
it
'updates project activity'
do
subject
.
update_page
(
subject
.
update_page
(
@gitlab_git_wiki_page
,
@gitlab_git_wiki_page
,
...
@@ -347,6 +360,13 @@ describe ProjectWiki do
...
@@ -347,6 +360,13 @@ describe ProjectWiki do
expect
(
subject
.
pages
.
count
).
to
eq
(
0
)
expect
(
subject
.
pages
.
count
).
to
eq
(
0
)
end
end
it
'sets the correct commit email'
do
subject
.
delete_page
(
@page
)
expect
(
commit
.
author_email
).
to
eq
(
user
.
commit_email
)
expect
(
commit
.
committer_email
).
to
eq
(
user
.
commit_email
)
end
it
'updates project activity'
do
it
'updates project activity'
do
subject
.
delete_page
(
@page
)
subject
.
delete_page
(
@page
)
...
@@ -420,7 +440,7 @@ describe ProjectWiki do
...
@@ -420,7 +440,7 @@ describe ProjectWiki do
end
end
def
commit_details
def
commit_details
Gitlab
::
Git
::
Wiki
::
CommitDetails
.
new
(
user
.
id
,
user
.
username
,
user
.
name
,
user
.
email
,
"test commit"
)
Gitlab
::
Git
::
Wiki
::
CommitDetails
.
new
(
user
.
id
,
user
.
username
,
user
.
name
,
user
.
commit_
email
,
"test commit"
)
end
end
def
create_page
(
name
,
content
)
def
create_page
(
name
,
content
)
...
...
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