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

Improvements to setOptions calls and afterFind hook #25

Conversation

ndianabasi
Copy link
Contributor

@ndianabasi ndianabasi commented Feb 24, 2023

Proposed changes

This PR fixes two critical issues observed while using this add-on.

  1. The options set with setOptions on runtime are not remembered through the lifecycle of persistence operation. For example: column.setOptions({folder: '123/abc'}) does not always work. After being set on the Attachment class' options object, the new option does not reflect when the decorator carries out persistence of the file.
  2. When this add-on is used together with similar add-on (such as Adonis Responsive Attachment) within the same model, when the model hooks are executed, the attachment instance of other add-ons is passed into this add-on which leads to error as the methods of the other add-on's instance might not be available.

Types of changes

What types of changes does your code introduce?

Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@stale
Copy link

stale bot commented Apr 25, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Abandoned Dropped and not into consideration label Apr 25, 2023
@stale stale bot removed the Status: Abandoned Dropped and not into consideration label Apr 30, 2023
@RomainLanz RomainLanz added the Status: Review Needed Review from the core team is required before moving forward label Apr 30, 2023
@stale
Copy link

stale bot commented Aug 12, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Abandoned Dropped and not into consideration label Aug 12, 2023
@stale stale bot closed this Sep 17, 2023
@RomainLanz RomainLanz removed the Status: Abandoned Dropped and not into consideration label Sep 18, 2023
@RomainLanz RomainLanz reopened this Sep 18, 2023
@RomainLanz
Copy link
Member

Hey @ndianabasi! 👋🏻

It seems we have a typing issue about options being private in the Attachment class, but you set it public in the declaration.

It currently works because the TypeScript private operator is not doing anything at runtime, but a truly private field would make the code break.

Could you please change that and add some tests to ensure your changes work as expected?

@ndianabasi
Copy link
Contributor Author

Thanks for the response @RomainLanz. I've forked this repo and made all fixes I needed. Also gives me latitude to introduce features I need as well. Thanks for all you do!

Copy link

stale bot commented Dec 15, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Abandoned Dropped and not into consideration label Dec 15, 2023
@ndianabasi ndianabasi closed this Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Abandoned Dropped and not into consideration Status: Review Needed Review from the core team is required before moving forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants