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
Kazuhiko Shiozaki
gitlab-ce
Commits
59934458
Commit
59934458
authored
Apr 02, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove EmailsObserver
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
3faa14e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
app/models/email.rb
app/models/email.rb
+8
-3
app/observers/email_observer.rb
app/observers/email_observer.rb
+0
-5
No files found.
app/models/email.rb
View file @
59934458
...
...
@@ -13,14 +13,15 @@ class Email < ActiveRecord::Base
# Relations
#
belongs_to
:user
#
# Validations
#
validates
:user_id
,
presence:
true
validates
:email
,
presence:
true
,
email:
{
strict_mode:
true
},
uniqueness:
true
validate
:unique_email
,
if:
->
(
email
)
{
email
.
email_changed?
}
after_create
:notify
before_validation
:cleanup_email
def
cleanup_email
...
...
@@ -30,4 +31,8 @@ class Email < ActiveRecord::Base
def
unique_email
self
.
errors
.
add
(
:email
,
'has already been taken'
)
if
User
.
exists?
(
email:
self
.
email
)
end
end
\ No newline at end of file
def
notify
NotificationService
.
new
.
new_email
(
self
)
end
end
app/observers/email_observer.rb
deleted
100644 → 0
View file @
3faa14e7
class
EmailObserver
<
BaseObserver
def
after_create
(
email
)
notification
.
new_email
(
email
)
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