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
534419ba
Commit
534419ba
authored
Aug 31, 2021
by
Patrick Bajao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error when displaying discussions with note without an author
parent
44480a4c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
app/models/note.rb
app/models/note.rb
+1
-1
spec/models/note_spec.rb
spec/models/note_spec.rb
+8
-0
No files found.
app/models/note.rb
View file @
534419ba
...
...
@@ -582,7 +582,7 @@ class Note < ApplicationRecord
end
def
post_processed_cache_key
cache_key_items
=
[
cache_key
,
author
.
cache_key
]
cache_key_items
=
[
cache_key
,
author
&
.
cache_key
]
cache_key_items
<<
Digest
::
SHA1
.
hexdigest
(
redacted_note_html
)
if
redacted_note_html
.
present?
cache_key_items
.
join
(
':'
)
...
...
spec/models/note_spec.rb
View file @
534419ba
...
...
@@ -1576,6 +1576,14 @@ RSpec.describe Note do
expect
(
note
.
post_processed_cache_key
).
to
eq
(
"
#{
note
.
cache_key
}
:
#{
note
.
author
.
cache_key
}
"
)
end
context
'when note has no author'
do
let
(
:note
)
{
build
(
:note
,
author:
nil
)
}
it
'returns cache key only'
do
expect
(
note
.
post_processed_cache_key
).
to
eq
(
"
#{
note
.
cache_key
}
:"
)
end
end
context
'when note has redacted_note_html'
do
let
(
:redacted_note_html
)
{
'redacted note html'
}
...
...
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