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

belongsTo Relationship Fields Hidden Using filterFields Get Values Erased on Save #3568

Closed
jeffcates opened this issue May 31, 2018 · 16 comments

Comments

@jeffcates
Copy link

jeffcates commented May 31, 2018

Expected behavior

hiding a belongsTo relationship field to a user does not affect the fields value if the user edits the model

Actual behavior

belongsTo relationship fields get erased if hidden using filterFields and then the model is saved

Reproduce steps

create a model (M) with a belongsTo relationship field to another model
in filterFields function of model (M) show the field for User A and hide for User B
User A updates the relationship field and saves
User B then opens the model to view/edit other fields and clicks save
User A re-opens the model and the relationship field is now cleared / null

October build

Build 434

@LukeTowers
Copy link
Contributor

@jeffcates how are you hiding the fields?

@jeffcates
Copy link
Author

jeffcates commented May 31, 2018 via email

@jeffcates
Copy link
Author

Also - the same issue exists for the relationship field type (as a checklist) for many-to-many relationships when the field is disabled.

@LukeTowers
Copy link
Contributor

LukeTowers commented May 31, 2018

@jeffcates are you able to replicate this using the test plugin in a fresh install of OctoberCMS? Please make a PR to the test plugin to demonstrate it and then I'll be able to investigate.

@jeffcates
Copy link
Author

It's a new install, but not with your test plugin. I will check that out. Curious - is the test plugin on the marketplace?

@LukeTowers
Copy link
Contributor

@jeffcates no, it's just for developer reference and for maintainers to test issues / PRs on.

@jeffcates
Copy link
Author

jeffcates commented Jun 3, 2018 via email

@LukeTowers
Copy link
Contributor

@jeffcates just download it from https://github.com/octoberrain/oc-test-plugin and move it into plugins/october/test

@jeffcates
Copy link
Author

jeffcates commented Jun 4, 2018 via email

@LukeTowers
Copy link
Contributor

@jeffcates could you actually submit a PR with that code to the test plugin repo? I know it's a small example but I'm testing some tooling on our end created by @petehalverson that makes replicating issues much easier and having a PR submitted to the test plugin with the code that causes the issue makes life easier.

Also, re the test plugin being kind of hard to find: That is done on purpose. If you look, you'll find projects that have blatantly ripped off the media manager used in October, @daftspunk wants the test plugin to be hard to find by default to prevent drive-bys of people seeing what October can do and just copying it for their own systems instead of contributing back to the community.

I do agree that we need a kitchensink-esque plugin for demonstrating October's features and acting as a source of truth for the platform's features though, however I don't have the time to put something like together right now and the test plugin was initially designed for @daftspunk's personal use, not as that sort of tool.

@petehalverson
Copy link
Contributor

Tripped up on this today. Legit bug. I'll follow up when I have some time to stage the issue with the test plugin and come up with a PR.

@github-actions
Copy link

This issue will be closed and archived in 3 days, as there has been no activity in the last 30 days. If this issue is still relevant or you would like to see action on it, please respond and we will get the ball rolling.

@github-actions
Copy link

This issue will be closed and archived in 3 days, as there has been no activity in the last 30 days. If this issue is still relevant or you would like to see action on it, please respond and we will get the ball rolling.

@github-actions
Copy link

github-actions bot commented Jan 7, 2020

This issue will be closed and archived in 3 days, as there has been no activity in the last 30 days. If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue.

@github-actions
Copy link

github-actions bot commented May 3, 2020

This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days.
If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue.
If this issue is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.

@daftspunk
Copy link
Member

This bug only manifests with relations, it must be such an edge case that not enough noise was made about it. Either way, it has been fixed ready for the next release. Thanks for your patience @jeffcates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants