機能 #769 » 0002-activity-show_one.patch
core/plugin/activity/activity.rb | ||
---|---|---|
66 | 66 |
# ==== Return |
67 | 67 |
# 初めて表示するキーなら真 |
68 | 68 |
def show_once(event, *ids) |
69 |
@show_once ||= Hash.new{ |h, k| h[k] = [] } |
|
70 |
result = [] |
|
71 |
ids.each_with_index{ |id, index| |
|
72 |
storage = @show_once[event][index] ||= Set.new |
|
73 |
if storage.include? id |
|
74 |
result << true |
|
75 |
else |
|
76 |
storage << id |
|
77 |
result << false end } |
|
78 |
not result.all? end |
|
69 |
@show_once ||= Set.new |
|
70 |
result = @show_once.member?(ids) |
|
71 |
@show_once << ids |
|
72 |
!result end |
|
79 | 73 | |
80 | 74 |
# アクティビティの古い通知を一定時間後に消す |
81 | 75 |
def reset_activity(model) |