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
Jérome Perrin
gitlab-ce
Commits
33778081
Commit
33778081
authored
Sep 20, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix reply by email for comments on a specific line in a diff/commit.
parent
11bbc06b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
7 deletions
+24
-7
app/mailers/emails/notes.rb
app/mailers/emails/notes.rb
+3
-3
app/models/sent_notification.rb
app/models/sent_notification.rb
+12
-2
db/migrate/20150920161119_add_line_code_to_sent_notification.rb
...rate/20150920161119_add_line_code_to_sent_notification.rb
+5
-0
db/schema.rb
db/schema.rb
+2
-1
lib/gitlab/email/receiver.rb
lib/gitlab/email/receiver.rb
+2
-1
No files found.
app/mailers/emails/notes.rb
View file @
33778081
...
...
@@ -12,7 +12,7 @@ module Emails
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@commit
.
title
}
(
#{
@commit
.
short_id
}
)"
))
SentNotification
.
record
(
@commit
,
recipient_id
,
reply_key
)
SentNotification
.
record
_note
(
@note
,
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
}
)"
))
SentNotification
.
record
(
@issu
e
,
recipient_id
,
reply_key
)
SentNotification
.
record
_note
(
@not
e
,
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
}
)"
))
SentNotification
.
record
(
@merge_request
,
recipient_id
,
reply_key
)
SentNotification
.
record
_note
(
@note
,
recipient_id
,
reply_key
)
end
end
end
app/models/sent_notification.rb
View file @
33778081
...
...
@@ -8,6 +8,7 @@
# noteable_type :string(255)
# recipient_id :integer
# commit_id :string(255)
# line_code :string(255)
# reply_key :string(255) not null
#
...
...
@@ -21,13 +22,14 @@ class SentNotification < ActiveRecord::Base
validates
:noteable_id
,
presence:
true
,
unless: :for_commit?
validates
:commit_id
,
presence:
true
,
if: :for_commit?
validates
:line_code
,
format:
{
with:
/\A[a-z0-9]+_\d+_\d+\Z/
},
allow_blank:
true
class
<<
self
def
for
(
reply_key
)
find_by
(
reply_key:
reply_key
)
end
def
record
(
noteable
,
recipient_id
,
reply_key
)
def
record
(
noteable
,
recipient_id
,
reply_key
,
params
=
{}
)
return
unless
reply_key
noteable_id
=
nil
...
...
@@ -38,7 +40,7 @@ class SentNotification < ActiveRecord::Base
noteable_id
=
noteable
.
id
end
create
(
params
.
reverse_merge!
(
project:
noteable
.
project
,
noteable_type:
noteable
.
class
.
name
,
noteable_id:
noteable_id
,
...
...
@@ -46,6 +48,14 @@ class SentNotification < ActiveRecord::Base
recipient_id:
recipient_id
,
reply_key:
reply_key
)
create
(
params
)
end
def
record_note
(
note
,
recipient_id
,
reply_key
,
params
=
{})
params
[
:line_code
]
=
note
.
line_code
record
(
note
.
noteable
,
recipient_id
,
reply_key
,
params
)
end
end
...
...
db/migrate/20150920161119_add_line_code_to_sent_notification.rb
0 → 100644
View file @
33778081
class
AddLineCodeToSentNotification
<
ActiveRecord
::
Migration
def
change
add_column
:sent_notifications
,
:line_code
,
:string
end
end
db/schema.rb
View file @
33778081
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20150920
010715
)
do
ActiveRecord
::
Schema
.
define
(
version:
20150920
161119
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -623,6 +623,7 @@ ActiveRecord::Schema.define(version: 20150920010715) do
t
.
integer
"recipient_id"
t
.
string
"commit_id"
t
.
string
"reply_key"
,
null:
false
t
.
string
"line_code"
end
add_index
"sent_notifications"
,
[
"reply_key"
],
name:
"index_sent_notifications_on_reply_key"
,
unique:
true
,
using: :btree
...
...
lib/gitlab/email/receiver.rb
View file @
33778081
...
...
@@ -98,7 +98,8 @@ module Gitlab
note:
reply
,
noteable_type:
sent_notification
.
noteable_type
,
noteable_id:
sent_notification
.
noteable_id
,
commit_id:
sent_notification
.
commit_id
commit_id:
sent_notification
.
commit_id
,
line_code:
sent_notification
.
line_code
).
execute
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