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
e616fbfd
Commit
e616fbfd
authored
Jun 24, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only return the address if incoming emails is enabled:
Feedback from:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3363#note_12669123
parent
918646f8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
project.rb
app/models/project.rb
+2
-0
project_spec.rb
spec/models/project_spec.rb
+16
-4
No files found.
app/models/project.rb
View file @
e616fbfd
...
...
@@ -529,9 +529,11 @@ class Project < ActiveRecord::Base
end
def
new_issue_address
(
author
)
if
Gitlab
::
IncomingEmail
.
enabled?
Gitlab
::
IncomingEmail
.
reply_address
(
"
#{
path_with_namespace
}
+
#{
author
.
authentication_token
}
"
)
end
end
def
build_commit_note
(
commit
)
notes
.
new
(
commit_id:
commit
.
id
,
noteable_type:
'Commit'
)
...
...
spec/models/project_spec.rb
View file @
e616fbfd
...
...
@@ -130,13 +130,14 @@ describe Project, models: true do
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
)
}
context
'incoming email enabled'
do
before
do
stub_incoming_email_setting
(
enabled:
true
,
address:
"p+%{key}@gl.ab"
)
end
it
'returns the address to create a new issue'
do
token
=
user
.
authentication_token
address
=
"p+
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
+
#{
token
}
@gl.ab"
...
...
@@ -145,6 +146,17 @@ describe Project, models: true do
end
end
context
'incoming email disabled'
do
before
do
stub_incoming_email_setting
(
enabled:
false
)
end
it
'returns nil'
do
expect
(
project
.
new_issue_address
(
user
)).
to
be_nil
end
end
end
describe
'last_activity methods'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:last_event
)
{
double
(
created_at:
Time
.
now
)
}
...
...
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