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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
725891d8
Commit
725891d8
authored
Aug 12, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not display other behaviour if the email address does not exist
parent
d13d2452
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
app/controllers/public/unsubscribes_controller.rb
app/controllers/public/unsubscribes_controller.rb
+2
-2
spec/controllers/public/unsubscribes_controller_spec.rb
spec/controllers/public/unsubscribes_controller_spec.rb
+13
-0
No files found.
app/controllers/public/unsubscribes_controller.rb
View file @
725891d8
...
...
@@ -11,14 +11,14 @@ module Public
def
create
@user
=
get_user
@user
.
admin_unsubscribe!
@user
.
admin_unsubscribe!
if
@user
redirect_to
new_user_session_path
,
notice:
'You have been unsubscribed'
end
protected
def
get_user
@email
=
"
#{
params
[
:email
]
}
.
#{
params
[
:format
]
}
"
User
.
where
(
email:
@email
).
first
!
User
.
where
(
email:
@email
).
first
end
end
end
\ No newline at end of file
spec/controllers/public/unsubscribes_controller_spec.rb
View file @
725891d8
...
...
@@ -9,6 +9,12 @@ describe Public::UnsubscribesController do
assert_response
:success
end
it
"behaves the same if email address isn't known in the system"
do
get
:show
,
email:
'i@dont_exists'
,
format:
'com'
assert_response
:success
end
end
describe
"create"
do
...
...
@@ -17,5 +23,12 @@ describe Public::UnsubscribesController do
assert
user
.
reload
.
admin_email_unsubscribed_at
end
# Don't tell if the email does not exists
it
"behaves the same if email address isn't known in the system"
do
post
:create
,
email:
'i@dont_exists'
,
format:
'com'
assert_response
:redirect
end
end
end
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