Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
ca29617d
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ca29617d
编写于
12月 16, 2013
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5843 from bke-drewb/fix/dashboard_event_updates
Fix dashboard event caching
上级
99490159
63723ef6
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
0 deletion
+47
-0
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-0
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+1
-0
app/controllers/projects/notes_controller.rb
app/controllers/projects/notes_controller.rb
+2
-0
app/models/issue.rb
app/models/issue.rb
+14
-0
app/models/merge_request.rb
app/models/merge_request.rb
+14
-0
app/models/note.rb
app/models/note.rb
+15
-0
未找到文件。
app/controllers/projects/issues_controller.rb
浏览文件 @
ca29617d
...
...
@@ -74,6 +74,7 @@ class Projects::IssuesController < Projects::ApplicationController
def
update
@issue
.
update_attributes
(
params
[
:issue
].
merge
(
author_id_of_changes:
current_user
.
id
))
@issue
.
reset_events_cache
respond_to
do
|
format
|
format
.
js
...
...
app/controllers/projects/merge_requests_controller.rb
浏览文件 @
ca29617d
...
...
@@ -97,6 +97,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
if
@merge_request
.
update_attributes
(
params
[
:merge_request
].
merge
(
author_id_of_changes:
current_user
.
id
))
@merge_request
.
reload_code
@merge_request
.
mark_as_unchecked
@merge_request
.
reset_events_cache
redirect_to
[
@merge_request
.
target_project
,
@merge_request
],
notice:
'Merge request was successfully updated.'
else
render
"edit"
...
...
app/controllers/projects/notes_controller.rb
浏览文件 @
ca29617d
...
...
@@ -39,6 +39,7 @@ class Projects::NotesController < Projects::ApplicationController
@note
=
@project
.
notes
.
find
(
params
[
:id
])
return
access_denied!
unless
can?
(
current_user
,
:admin_note
,
@note
)
@note
.
destroy
@note
.
reset_events_cache
respond_to
do
|
format
|
format
.
js
{
render
nothing:
true
}
...
...
@@ -50,6 +51,7 @@ class Projects::NotesController < Projects::ApplicationController
return
access_denied!
unless
can?
(
current_user
,
:admin_note
,
@note
)
@note
.
update_attributes
(
params
[
:note
])
@note
.
reset_events_cache
respond_to
do
|
format
|
format
.
js
do
...
...
app/models/issue.rb
浏览文件 @
ca29617d
...
...
@@ -64,4 +64,18 @@ class Issue < ActiveRecord::Base
def
gfm_reference
"issue #
#{
iid
}
"
end
# Reset issue events cache
#
# Since we do cache @event we need to reset cache in special cases:
# * when an issue is updated
# Events cache stored like events/23-20130109142513.
# The cache key includes updated_at timestamp.
# 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
)
end
end
app/models/merge_request.rb
浏览文件 @
ca29617d
...
...
@@ -305,6 +305,20 @@ class MergeRequest < ActiveRecord::Base
self
.
target_project
.
repository
.
branch_names
.
include?
(
self
.
target_branch
)
end
# Reset merge request events cache
#
# Since we do cache @event we need to reset cache in special cases:
# * when a merge request is updated
# Events cache stored like events/23-20130109142513.
# The cache key includes updated_at timestamp.
# 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
)
end
private
def
dump_commits
(
commits
)
...
...
app/models/note.rb
浏览文件 @
ca29617d
...
...
@@ -239,4 +239,19 @@ class Note < ActiveRecord::Base
def
noteable_type
=
(
sType
)
super
(
sType
.
to_s
.
classify
.
constantize
.
base_class
.
to_s
)
end
# Reset notes events cache
#
# Since we do cache @event we need to reset cache in special cases:
# * when a note is updated
# * when a note is removed
# Events cache stored like events/23-20130109142513.
# The cache key includes updated_at timestamp.
# 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
)
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录