@ -29,7 +29,7 @@ module Redmine
send :include , Redmine :: Acts :: ActivityProvider :: InstanceMethods
send :include , Redmine :: Acts :: ActivityProvider :: InstanceMethods
end
end
options . assert_valid_keys ( :type , :permission , :timestamp , :author_key , :find_options )
options . assert_valid_keys ( :type , :permission , :timestamp , :author_key , :find_options , :func )
self . activity_provider_options || = { }
self . activity_provider_options || = { }
# One model can provide different event types
# One model can provide different event types
@ -87,7 +87,6 @@ module Redmine
raise " #{ self . name } can not provide #{ event_type } events. " if provider_options . nil?
raise " #{ self . name } can not provide #{ event_type } events. " if provider_options . nil?
scope = self
scope = self
if from && to
if from && to
scope = scope . scoped ( :conditions = > [ " #{ provider_options [ :timestamp ] } BETWEEN ? AND ? " , from , to ] )
scope = scope . scoped ( :conditions = > [ " #{ provider_options [ :timestamp ] } BETWEEN ? AND ? " , from , to ] )
end
end
@ -102,16 +101,18 @@ module Redmine
scope = scope . scoped ( :order = > " #{ table_name } .id DESC " , :limit = > options [ :limit ] )
scope = scope . scoped ( :order = > " #{ table_name } .id DESC " , :limit = > options [ :limit ] )
end
end
user1 = User . find_by_admin ( true )
if provider_options . has_key? ( :permission )
if provider_options . has_key? ( :permission )
user1 = User . find_by_admin ( true )
scope = scope . scoped ( :conditions = > Project . allowed_to_condition ( user1 , provider_options [ :permission ] || :view_project , options ) )
scope = scope . scoped ( :conditions = > Project . allowed_to_condition ( user1 , provider_options [ :permission ] || :view_project , options ) )
elsif respond_to? ( :visible )
elsif respond_to? ( :visible )
scope = scope . visible ( user1 , options )
scope = scope . visible ( user1 , options )
elsif provider_options . has_key? ( :func ) && provider_options [ :func ] . eql? ( 'memos' )
scope = scope
else
else
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. "
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. "
# scope = scope
scope = scope . scoped ( :conditions = > Project . allowed_to_condition ( user1 , " view_ #{ self . name . underscore . pluralize } " . to_sym , options ) )
scope = scope . scoped ( :conditions = > Project . allowed_to_condition ( user1 , " view_ #{ self . name . underscore . pluralize } " . to_sym , options ) )
end
end
scope . all ( provider_options [ :find_options ] . dup )
scope . all ( provider_options [ :find_options ] . dup )
end
end