Revision 442:753f1380d6bc vendor/plugins/acts_as_activity_provider/lib/.svn
| vendor/plugins/acts_as_activity_provider/lib/.svn/all-wcprops | ||
|---|---|---|
| 1 |
K 25 |
|
| 2 |
svn:wc:ra_dav:version-url |
|
| 3 |
V 83 |
|
| 4 |
/svn/!svn/ver/5878/branches/1.2-stable/vendor/plugins/acts_as_activity_provider/lib |
|
| 5 |
END |
|
| 6 |
acts_as_activity_provider.rb |
|
| 7 |
K 25 |
|
| 8 |
svn:wc:ra_dav:version-url |
|
| 9 |
V 112 |
|
| 10 |
/svn/!svn/ver/5878/branches/1.2-stable/vendor/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb |
|
| 11 |
END |
|
| vendor/plugins/acts_as_activity_provider/lib/.svn/entries | ||
|---|---|---|
| 1 | 1 |
10 |
| 2 | 2 |
|
| 3 | 3 |
dir |
| 4 |
4993
|
|
| 5 |
http://redmine.rubyforge.org/svn/trunk/vendor/plugins/acts_as_activity_provider/lib
|
|
| 4 |
6000
|
|
| 5 |
http://redmine.rubyforge.org/svn/branches/1.2-stable/vendor/plugins/acts_as_activity_provider/lib
|
|
| 6 | 6 |
http://redmine.rubyforge.org/svn |
| 7 | 7 |
|
| 8 | 8 |
|
| 9 | 9 |
|
| 10 |
2008-12-08T18:20:26.452857Z
|
|
| 11 |
2114
|
|
| 10 |
2011-04-05T12:52:20.839202Z
|
|
| 11 |
5325
|
|
| 12 | 12 |
jplang |
| 13 | 13 |
|
| 14 | 14 |
|
| ... | ... | |
| 32 | 32 |
|
| 33 | 33 |
|
| 34 | 34 |
|
| 35 |
2011-03-03T11:05:12.000000Z
|
|
| 36 |
21fbeb28c4ce556d2534306b96be9497
|
|
| 37 |
2008-12-08T18:20:26.452857Z
|
|
| 38 |
2114
|
|
| 35 |
2011-06-06T13:20:52.000000Z
|
|
| 36 |
59f4bcfa68e4f7d5f4d881d01a9ba8be
|
|
| 37 |
2011-04-05T12:52:20.839202Z
|
|
| 38 |
5325
|
|
| 39 | 39 |
jplang |
| 40 | 40 |
has-props |
| 41 | 41 |
|
| ... | ... | |
| 58 | 58 |
|
| 59 | 59 |
|
| 60 | 60 |
|
| 61 |
3534
|
|
| 61 |
3971
|
|
| 62 | 62 |
|
| vendor/plugins/acts_as_activity_provider/lib/.svn/text-base/acts_as_activity_provider.rb.svn-base | ||
|---|---|---|
| 36 | 36 |
# We store these options in activity_provider_options hash |
| 37 | 37 |
event_type = options.delete(:type) || self.name.underscore.pluralize |
| 38 | 38 |
|
| 39 |
options[:permission] = "view_#{self.name.underscore.pluralize}".to_sym unless options.has_key?(:permission)
|
|
| 40 | 39 |
options[:timestamp] ||= "#{table_name}.created_on"
|
| 41 | 40 |
options[:find_options] ||= {}
|
| 42 | 41 |
options[:author_key] = "#{table_name}.#{options[:author_key]}" if options[:author_key].is_a?(Symbol)
|
| ... | ... | |
| 60 | 59 |
if from && to |
| 61 | 60 |
cond.add(["#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to])
|
| 62 | 61 |
end |
| 62 |
|
|
| 63 | 63 |
if options[:author] |
| 64 | 64 |
return [] if provider_options[:author_key].nil? |
| 65 | 65 |
cond.add(["#{provider_options[:author_key]} = ?", options[:author].id])
|
| 66 | 66 |
end |
| 67 |
cond.add(Project.allowed_to_condition(user, provider_options[:permission], options)) if provider_options[:permission] |
|
| 68 |
scope_options[:conditions] = cond.conditions |
|
| 67 |
|
|
| 69 | 68 |
if options[:limit] |
| 70 | 69 |
# id and creation time should be in same order in most cases |
| 71 | 70 |
scope_options[:order] = "#{table_name}.id DESC"
|
| 72 | 71 |
scope_options[:limit] = options[:limit] |
| 73 | 72 |
end |
| 74 | 73 |
|
| 74 |
scope = self |
|
| 75 |
if provider_options.has_key?(:permission) |
|
| 76 |
cond.add(Project.allowed_to_condition(user, provider_options[:permission] || :view_project, options)) |
|
| 77 |
elsif respond_to?(:visible) |
|
| 78 |
scope = scope.visible(user, options) |
|
| 79 |
else |
|
| 80 |
ActiveSupport::Deprecation.warn "acts_as_activity_provider with implicit :permission option is deprecated. Add a visible scope to the #{self.name} model or use explicit :permission option."
|
|
| 81 |
cond.add(Project.allowed_to_condition(user, "view_#{self.name.underscore.pluralize}".to_sym, options))
|
|
| 82 |
end |
|
| 83 |
scope_options[:conditions] = cond.conditions |
|
| 84 |
|
|
| 75 | 85 |
with_scope(:find => scope_options) do |
| 76 |
find(:all, provider_options[:find_options].dup) |
|
| 86 |
scope.find(:all, provider_options[:find_options].dup)
|
|
| 77 | 87 |
end |
| 78 | 88 |
end |
| 79 | 89 |
end |
Also available in: Unified diff