Module: Redmine::Acts::ActivityProvider::InstanceMethods::ClassMethods
- Defined in:
- vendor/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb
Instance Method Summary
-
- (Object) find_events(event_type, user, from, to, options)
Returns events of type event_type visible by user that occured between from and to.
Instance Method Details
- (Object) find_events(event_type, user, from, to, options)
Returns events of type event_type visible by user that occured between from and to
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'vendor/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb', line 54 def find_events(event_type, user, from, to, ) = [event_type] raise "#{self.name} can not provide #{event_type} events." if .nil? = {} cond = ARCondition.new if from && to cond.add(["#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to]) end if [:author] return [] if [:author_key].nil? cond.add(["#{provider_options[:author_key]} = ?", [:author].id]) end cond.add(Project.allowed_to_condition(user, [:permission], )) if [:permission] [:conditions] = cond.conditions if [:limit] # id and creation time should be in same order in most cases [:order] = "#{table_name}.id DESC" [:limit] = [:limit] end with_scope(:find => ) do find(:all, [:find_options].dup) end end |