This instance will be upgraded to Heptapod 0.27.1 on 2021-12-08 at 22:00 UTC+1 (a few minutes of down time)

Commit 918646f8 authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files

Add Project#new_issue_address(author):

Which would return the email address for creating a new issue
by sending an email to that particular address.
parent 2b74fa8671d5
......@@ -528,6 +528,11 @@ def web_url_without_protocol
web_url.split('://')[1]
end
def new_issue_address(author)
Gitlab::IncomingEmail.reply_address(
"#{path_with_namespace}+#{author.authentication_token}")
end
def build_commit_note(commit)
notes.new(commit_id: commit.id, noteable_type: 'Commit')
end
......
......@@ -129,6 +129,22 @@
end
end
describe "#new_issue_address" do
before do
stub_incoming_email_setting(address: "p+%{key}@gl.ab")
end
let(:project) { create(:empty_project, path: "somewhere") }
let(:user) { create(:user) }
it 'returns the address to create a new issue' do
token = user.authentication_token
address = "p+#{project.namespace.path}/#{project.path}+#{token}@gl.ab"
expect(project.new_issue_address(user)).to eq(address)
end
end
describe 'last_activity methods' do
let(:project) { create(:project) }
let(:last_event) { double(created_at: Time.now) }
......
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