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
Boxiang Sun
gitlab-ce
Commits
a93ccf07
Commit
a93ccf07
authored
Jan 10, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly cleaning up memoized values
parent
4f00a051
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
app/models/concerns/resolvable_discussion.rb
app/models/concerns/resolvable_discussion.rb
+5
-3
No files found.
app/models/concerns/resolvable_discussion.rb
View file @
a93ccf07
...
@@ -44,8 +44,10 @@ module ResolvableDiscussion
...
@@ -44,8 +44,10 @@ module ResolvableDiscussion
end
end
def
first_note
def
first_note
strong_memoize
(
:first_note
)
do
notes
.
first
notes
.
first
end
end
end
def
first_note_to_resolve
def
first_note_to_resolve
return
unless
resolvable?
return
unless
resolvable?
...
@@ -102,8 +104,8 @@ module ResolvableDiscussion
...
@@ -102,8 +104,8 @@ module ResolvableDiscussion
# Set the notes array to the updated notes
# Set the notes array to the updated notes
@notes
=
notes_relation
.
fresh
.
to_a
# rubocop:disable Gitlab/ModuleWithInstanceVariables
@notes
=
notes_relation
.
fresh
.
to_a
# rubocop:disable Gitlab/ModuleWithInstanceVariables
self
.
class
.
memoized_values
.
each
do
|
var
|
self
.
class
.
memoized_values
.
each
do
|
name
|
instance_variable_set
(
:"@
#{
var
}
"
,
nil
)
clear_memoization
(
name
)
end
end
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