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
35ce7aae
Commit
35ce7aae
authored
Jul 25, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use sha1 of discussion ID.
parent
aa267678
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
+7
-7
app/helpers/notes_helper.rb
app/helpers/notes_helper.rb
+2
-2
app/models/diff_note.rb
app/models/diff_note.rb
+2
-2
app/models/legacy_diff_note.rb
app/models/legacy_diff_note.rb
+1
-1
app/models/note.rb
app/models/note.rb
+2
-2
No files found.
app/helpers/notes_helper.rb
View file @
35ce7aae
...
@@ -57,7 +57,7 @@ module NotesHelper
...
@@ -57,7 +57,7 @@ module NotesHelper
data
.
merge!
(
data
.
merge!
(
note_type:
LegacyDiffNote
.
name
,
note_type:
LegacyDiffNote
.
name
,
discussion_id:
discussion_id
discussion_id:
Digest
::
SHA1
.
hexdigest
(
discussion_id
)
)
)
else
else
discussion_id
=
DiffNote
.
build_discussion_id
(
discussion_id
=
DiffNote
.
build_discussion_id
(
...
@@ -69,7 +69,7 @@ module NotesHelper
...
@@ -69,7 +69,7 @@ module NotesHelper
data
.
merge!
(
data
.
merge!
(
position:
position
.
to_json
,
position:
position
.
to_json
,
note_type:
DiffNote
.
name
,
note_type:
DiffNote
.
name
,
discussion_id:
discussion_id
discussion_id:
Digest
::
SHA1
.
hexdigest
(
discussion_id
)
)
)
end
end
...
...
app/models/diff_note.rb
View file @
35ce7aae
...
@@ -34,11 +34,11 @@ class DiffNote < Note
...
@@ -34,11 +34,11 @@ class DiffNote < Note
end
end
def
discussion_id
def
discussion_id
@discussion_id
||=
self
.
class
.
build_discussion_id
(
noteable_type
,
noteable_id
||
commit_id
,
position
)
@discussion_id
||=
Digest
::
SHA1
.
hexdigest
(
self
.
class
.
build_discussion_id
(
noteable_type
,
noteable_id
||
commit_id
,
position
)
)
end
end
def
original_discussion_id
def
original_discussion_id
@original_discussion_id
||=
self
.
class
.
build_discussion_id
(
noteable_type
,
noteable_id
||
commit_id
,
original_position
)
@original_discussion_id
||=
Digest
::
SHA1
.
hexdigest
(
self
.
class
.
build_discussion_id
(
noteable_type
,
noteable_id
||
commit_id
,
original_position
)
)
end
end
def
position
=
(
new_position
)
def
position
=
(
new_position
)
...
...
app/models/legacy_diff_note.rb
View file @
35ce7aae
...
@@ -22,7 +22,7 @@ class LegacyDiffNote < Note
...
@@ -22,7 +22,7 @@ class LegacyDiffNote < Note
end
end
def
discussion_id
def
discussion_id
@discussion_id
||=
self
.
class
.
build_discussion_id
(
noteable_type
,
noteable_id
||
commit_id
,
line_code
)
@discussion_id
||=
Digest
::
SHA1
.
hexdigest
(
self
.
class
.
build_discussion_id
(
noteable_type
,
noteable_id
||
commit_id
,
line_code
)
)
end
end
def
diff_file_hash
def
diff_file_hash
...
...
app/models/note.rb
View file @
35ce7aae
...
@@ -145,9 +145,9 @@ class Note < ActiveRecord::Base
...
@@ -145,9 +145,9 @@ class Note < ActiveRecord::Base
def
discussion_id
def
discussion_id
@discussion_id
||=
@discussion_id
||=
if
for_merge_request?
if
for_merge_request?
[
:discussion
,
:note
,
id
].
join
(
"-"
)
Digest
::
SHA1
.
hexdigest
([
:discussion
,
:note
,
id
].
join
(
"-"
)
)
else
else
self
.
class
.
build_discussion_id
(
noteable_type
,
noteable_id
||
commit_id
)
Digest
::
SHA1
.
hexdigest
(
self
.
class
.
build_discussion_id
(
noteable_type
,
noteable_id
||
commit_id
)
)
end
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