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
cb0d63b9
Commit
cb0d63b9
authored
Jul 26, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7319 from jvanbaarsen/small-eventcache-refactoring
Moved some behaviour to one place
parents
8734a9cd
16eea492
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
9 deletions
+9
-9
app/models/event.rb
app/models/event.rb
+6
-0
app/models/issue.rb
app/models/issue.rb
+1
-3
app/models/merge_request.rb
app/models/merge_request.rb
+1
-3
app/models/note.rb
app/models/note.rb
+1
-3
No files found.
app/models/event.rb
View file @
cb0d63b9
...
@@ -70,6 +70,12 @@ class Event < ActiveRecord::Base
...
@@ -70,6 +70,12 @@ class Event < ActiveRecord::Base
author_id:
user
.
id
author_id:
user
.
id
)
)
end
end
def
reset_event_cache_for
(
target
)
Event
.
where
(
target_id:
target
.
id
,
target_type:
target
.
class
.
to_s
).
order
(
'id DESC'
).
limit
(
100
).
update_all
(
updated_at:
Time
.
now
)
end
end
end
def
proper?
def
proper?
...
...
app/models/issue.rb
View file @
cb0d63b9
...
@@ -67,8 +67,6 @@ class Issue < ActiveRecord::Base
...
@@ -67,8 +67,6 @@ class Issue < ActiveRecord::Base
# Thus it will automatically generate a new fragment
# Thus it will automatically generate a new fragment
# when the event is updated because the key changes.
# when the event is updated because the key changes.
def
reset_events_cache
def
reset_events_cache
Event
.
where
(
target_id:
self
.
id
,
target_type:
'Issue'
).
Event
.
reset_event_cache_for
(
self
)
order
(
'id DESC'
).
limit
(
100
).
update_all
(
updated_at:
Time
.
now
)
end
end
end
end
app/models/merge_request.rb
View file @
cb0d63b9
...
@@ -287,9 +287,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -287,9 +287,7 @@ class MergeRequest < ActiveRecord::Base
# Thus it will automatically generate a new fragment
# Thus it will automatically generate a new fragment
# when the event is updated because the key changes.
# when the event is updated because the key changes.
def
reset_events_cache
def
reset_events_cache
Event
.
where
(
target_id:
self
.
id
,
target_type:
'MergeRequest'
).
Event
.
reset_event_cache_for
(
self
)
order
(
'id DESC'
).
limit
(
100
).
update_all
(
updated_at:
Time
.
now
)
end
end
def
merge_commit_message
def
merge_commit_message
...
...
app/models/note.rb
View file @
cb0d63b9
...
@@ -327,9 +327,7 @@ class Note < ActiveRecord::Base
...
@@ -327,9 +327,7 @@ class Note < ActiveRecord::Base
# Thus it will automatically generate a new fragment
# Thus it will automatically generate a new fragment
# when the event is updated because the key changes.
# when the event is updated because the key changes.
def
reset_events_cache
def
reset_events_cache
Event
.
where
(
target_id:
self
.
id
,
target_type:
'Note'
).
Event
.
reset_event_cache_for
(
self
)
order
(
'id DESC'
).
limit
(
100
).
update_all
(
updated_at:
Time
.
now
)
end
end
def
set_references
def
set_references
...
...
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