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
Tatuya Kamada
gitlab-ce
Commits
992dbbd9
Commit
992dbbd9
authored
Aug 19, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move `sent_notification!` out of Notify.
parent
a8a861ae
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
35 deletions
+37
-35
app/mailers/emails/issues.rb
app/mailers/emails/issues.rb
+4
-4
app/mailers/emails/merge_requests.rb
app/mailers/emails/merge_requests.rb
+5
-5
app/mailers/emails/notes.rb
app/mailers/emails/notes.rb
+3
-3
app/mailers/notify.rb
app/mailers/notify.rb
+0
-21
app/models/sent_notification.rb
app/models/sent_notification.rb
+25
-2
No files found.
app/mailers/emails/issues.rb
View file @
992dbbd9
...
...
@@ -9,7 +9,7 @@ module Emails
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
))
sent_notification!
(
@issue
,
recipient_id
)
SentNotification
.
record
(
@issue
,
recipient_id
,
reply_key
)
end
def
reassigned_issue_email
(
recipient_id
,
issue_id
,
previous_assignee_id
,
updated_by_user_id
)
...
...
@@ -22,7 +22,7 @@ module Emails
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
))
sent_notification!
(
@issue
,
recipient_id
)
SentNotification
.
record
(
@issue
,
recipient_id
,
reply_key
)
end
def
closed_issue_email
(
recipient_id
,
issue_id
,
updated_by_user_id
)
...
...
@@ -35,7 +35,7 @@ module Emails
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
))
sent_notification!
(
@issue
,
recipient_id
)
SentNotification
.
record
(
@issue
,
recipient_id
,
reply_key
)
end
def
issue_status_changed_email
(
recipient_id
,
issue_id
,
status
,
updated_by_user_id
)
...
...
@@ -49,7 +49,7 @@ module Emails
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
))
sent_notification!
(
@issue
,
recipient_id
)
SentNotification
.
record
(
@issue
,
recipient_id
,
reply_key
)
end
end
end
app/mailers/emails/merge_requests.rb
View file @
992dbbd9
...
...
@@ -11,7 +11,7 @@ module Emails
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@merge_request
.
title
}
(#
#{
@merge_request
.
iid
}
)"
))
sent_notification!
(
@merge_request
,
recipient_id
)
SentNotification
.
record
(
@merge_request
,
recipient_id
,
reply_key
)
end
def
reassigned_merge_request_email
(
recipient_id
,
merge_request_id
,
previous_assignee_id
,
updated_by_user_id
)
...
...
@@ -26,7 +26,7 @@ module Emails
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@merge_request
.
title
}
(#
#{
@merge_request
.
iid
}
)"
))
sent_notification!
(
@merge_request
,
recipient_id
)
SentNotification
.
record
(
@merge_request
,
recipient_id
,
reply_key
)
end
def
closed_merge_request_email
(
recipient_id
,
merge_request_id
,
updated_by_user_id
)
...
...
@@ -41,7 +41,7 @@ module Emails
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@merge_request
.
title
}
(#
#{
@merge_request
.
iid
}
)"
))
sent_notification!
(
@merge_request
,
recipient_id
)
SentNotification
.
record
(
@merge_request
,
recipient_id
,
reply_key
)
end
def
merged_merge_request_email
(
recipient_id
,
merge_request_id
,
updated_by_user_id
)
...
...
@@ -55,7 +55,7 @@ module Emails
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@merge_request
.
title
}
(#
#{
@merge_request
.
iid
}
)"
))
sent_notification!
(
@merge_request
,
recipient_id
)
SentNotification
.
record
(
@merge_request
,
recipient_id
,
reply_key
)
end
def
merge_request_status_email
(
recipient_id
,
merge_request_id
,
status
,
updated_by_user_id
)
...
...
@@ -71,7 +71,7 @@ module Emails
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@merge_request
.
title
}
(#
#{
@merge_request
.
iid
}
)"
))
sent_notification!
(
@merge_request
,
recipient_id
)
SentNotification
.
record
(
@merge_request
,
recipient_id
,
reply_key
)
end
end
end
app/mailers/emails/notes.rb
View file @
992dbbd9
...
...
@@ -12,7 +12,7 @@ module Emails
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@commit
.
title
}
(
#{
@commit
.
short_id
}
)"
))
sent_notification!
(
@commit
,
recipient_id
)
SentNotification
.
record
(
@commit
,
recipient_id
,
reply_key
)
end
def
note_issue_email
(
recipient_id
,
note_id
)
...
...
@@ -27,7 +27,7 @@ module Emails
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
))
sent_notification!
(
@issue
,
recipient_id
)
SentNotification
.
record
(
@issue
,
recipient_id
,
reply_key
)
end
def
note_merge_request_email
(
recipient_id
,
note_id
)
...
...
@@ -43,7 +43,7 @@ module Emails
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@merge_request
.
title
}
(#
#{
@merge_request
.
iid
}
)"
))
sent_notification!
(
@merge_request
,
recipient_id
)
SentNotification
.
record
(
@merge_request
,
recipient_id
,
reply_key
)
end
end
end
app/mailers/notify.rb
View file @
992dbbd9
...
...
@@ -33,27 +33,6 @@ class Notify < BaseMailer
allowed_domains
end
def
sent_notification!
(
noteable
,
recipient_id
)
return
unless
reply_key
noteable_id
=
nil
commit_id
=
nil
if
noteable
.
is_a?
(
Commit
)
commit_id
=
noteable
.
id
else
noteable_id
=
noteable
.
id
end
SentNotification
.
create
(
project:
noteable
.
project
,
noteable_type:
noteable
.
class
.
name
,
noteable_id:
noteable_id
,
commit_id:
commit_id
,
recipient_id:
recipient_id
,
reply_key:
reply_key
)
end
private
def
can_send_from_user_email?
(
sender
)
...
...
app/models/sent_notification.rb
View file @
992dbbd9
...
...
@@ -9,10 +9,33 @@ class SentNotification < ActiveRecord::Base
validates
:noteable_id
,
presence:
true
,
unless: :for_commit?
validates
:commit_id
,
presence:
true
,
if: :for_commit?
def
self
.
for
(
reply_key
)
class
<<
self
def
for
(
reply_key
)
find_by
(
reply_key:
reply_key
)
end
def
record
(
noteable
,
recipient_id
,
reply_key
)
return
unless
reply_key
noteable_id
=
nil
commit_id
=
nil
if
noteable
.
is_a?
(
Commit
)
commit_id
=
noteable
.
id
else
noteable_id
=
noteable
.
id
end
create
(
project:
noteable
.
project
,
noteable_type:
noteable
.
class
.
name
,
noteable_id:
noteable_id
,
commit_id:
commit_id
,
recipient_id:
recipient_id
,
reply_key:
reply_key
)
end
end
def
for_commit?
noteable_type
==
"Commit"
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