Commit e35fc8b9 authored by Nick Thomas's avatar Nick Thomas

Use commit email for wiki actions

parent 3c5c658a
...@@ -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
......
...@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment