Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle errors when attaching files #4125

Merged
merged 3 commits into from
May 15, 2020
Merged

Handle errors when attaching files #4125

merged 3 commits into from
May 15, 2020

Conversation

cjcolvar
Copy link
Member

@cjcolvar cjcolvar commented May 11, 2020

Fixes #4113, finishes #4093, and fixes issues with failing CI builds due to tests added in #4104.

cjcolvar added 3 commits May 11, 2020 12:29
encoder class to avoid issue of #descendants iterating over all
instatiated objects and possibly returning classes that are not longer
declared as constants.  This is probably an edge-case which only affects
tests but this new approach may also be faster.

Also declare classes as anonymous classes and stub constants within
test.
Comment on lines 24 to 28
def find_encoder_class(klass_name)
ActiveEncode::Base.descendants.find { |c| c.name == klass_name }
return nil if klass_name.blank? || !Object.const_defined?(klass_name)
klass = Object.const_get(klass_name)
return klass if klass.ancestors.include?(ActiveEncode::Base)
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a lot of duplicated code (not just this method) between this proxy and the model, is there a way to dry it out using mixin or something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, this is probably a good time to clean it up.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked but couldn't come up with any good alternative to this duplication right now. I think the proper solution is the separation of the UI from the model by true presenters powered only by solr documents instead of speedy_af proxies powered by both solr and fedora, but that is considerable more work to go through the UI and make sure that we are using the presenter only. It is a larger refactor that probably shouldn't hold up this PR. Maybe there could be changes made to speedy_af that could move us in that direction without having to do quite as large a refactor? But this effort might not really be worth it given the eventual move to avalon-bundle.

@cjcolvar cjcolvar merged commit 259e547 into develop May 15, 2020
@cjcolvar cjcolvar deleted the supp_files_redux branch May 15, 2020 13:39
@joncameron joncameron mentioned this pull request Jun 9, 2020
22 tasks
@Dananji Dananji mentioned this pull request Oct 14, 2020
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants