Skip to content

Commit

Permalink
Deprecate PowerConverter based to_polymorphic_type
Browse files Browse the repository at this point in the history
This was very sparsely used. Instead of porting it elsewhere, just cast the one
caller individually.

If folks are using this downstream (I'd guess they aren't) we could consider
putting this mapper at the top `Hyrax` level, or somewhere similar.
  • Loading branch information
Tom Johnson committed Oct 18, 2019
1 parent 2af8639 commit e8f4f94
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/conversions/power_converters/polymorphic_type.rb
@@ -1,4 +1,5 @@
PowerConverter.define_conversion_for(:polymorphic_type) do |input|
Deprecation.warn('PowerConverter is deprecated. Use `.base_class` instead')
if input.respond_to?(:base_class)
input.base_class
elsif input.is_a?(ActiveRecord::Base)
Expand Down
2 changes: 1 addition & 1 deletion app/models/sipity/workflow_action.rb
Expand Up @@ -34,7 +34,7 @@ def self.name_for(input, &block)
when Sipity::WorkflowAction
input.name
end
Sipity.handle_conversion(result, &block)
Sipity.handle_conversion(input, result, :to_sipity_action_name, &block)
end
end
end
2 changes: 1 addition & 1 deletion app/services/hyrax/workflow/permission_query.rb
Expand Up @@ -242,7 +242,7 @@ def scope_entities_for_the_user(user:)
def scope_users_for_entity_and_roles(entity:, roles:)
entity = Sipity::Entity(entity)
role_ids = Array.wrap(roles).map { |role| Sipity::Role(role).id }
user_polymorphic_type = PowerConverter.convert_to_polymorphic_type(::User)
user_polymorphic_type = ::User.base_class

user_table = ::User.arel_table
agent_table = Sipity::Agent.arel_table
Expand Down

0 comments on commit e8f4f94

Please sign in to comment.