Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
694a1d120468
Commit
16eea492
authored
Jul 16, 2014
by
Jeroen van Baarsen
Browse files
Moved some behaviour to one place
Signed-off-by:
Jeroen van Baarsen
<
jeroenvanbaarsen@gmail.com
>
parent
d104f303f9ee
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/models/event.rb
View file @
694a1d12
...
...
@@ -70,6 +70,12 @@ def create_ref_event(project, user, ref, action = 'add', prefix = 'refs/heads')
author_id:
user
.
id
)
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
def
proper?
...
...
app/models/issue.rb
View file @
694a1d12
...
...
@@ -67,8 +67,6 @@ def gfm_reference
# Thus it will automatically generate a new fragment
# when the event is updated because the key changes.
def
reset_events_cache
Event
.
where
(
target_id:
self
.
id
,
target_type:
'Issue'
).
order
(
'id DESC'
).
limit
(
100
).
update_all
(
updated_at:
Time
.
now
)
Event
.
reset_event_cache_for
(
self
)
end
end
app/models/merge_request.rb
View file @
694a1d12
...
...
@@ -287,9 +287,7 @@ def target_branch_exists?
# Thus it will automatically generate a new fragment
# when the event is updated because the key changes.
def
reset_events_cache
Event
.
where
(
target_id:
self
.
id
,
target_type:
'MergeRequest'
).
order
(
'id DESC'
).
limit
(
100
).
update_all
(
updated_at:
Time
.
now
)
Event
.
reset_event_cache_for
(
self
)
end
def
merge_commit_message
...
...
app/models/note.rb
View file @
694a1d12
...
...
@@ -327,9 +327,7 @@ def noteable_type=(sType)
# Thus it will automatically generate a new fragment
# when the event is updated because the key changes.
def
reset_events_cache
Event
.
where
(
target_id:
self
.
id
,
target_type:
'Note'
).
order
(
'id DESC'
).
limit
(
100
).
update_all
(
updated_at:
Time
.
now
)
Event
.
reset_event_cache_for
(
self
)
end
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