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

Owner field on assets/logs shows blocked users as options #831

Open
mstenta opened this issue Apr 23, 2024 · 3 comments
Open

Owner field on assets/logs shows blocked users as options #831

mstenta opened this issue Apr 23, 2024 · 3 comments
Labels

Comments

@mstenta
Copy link
Member

mstenta commented Apr 23, 2024

When editing an asset or log, the "Owner" field displays a list of users to select from. It includes users that are "blocked".

Originally reported here: https://farmos.discourse.group/t/odd-behavior-with-users-admin/1985

@mstenta mstenta added the bug label Apr 23, 2024
@mstenta
Copy link
Member Author

mstenta commented Apr 23, 2024

Now that I think about this a bit more... it's kind of tricky.

If we filter out blocked users from the list of options, we introduce a potential issue. Imagine having a user who has worked on the farm for a while, and has created lots of logs, all of which are "Owned" by them. If you went back to edit one of these logs, and we filtered them out of the "Owner" list, then once you saved the log it would remove them as the owner. That's not desirable behavior, because it would happen without you noticing, and there would be no way to edit the log without losing that piece of information.

This reminds me of a more general issue that I opened a while back: https://www.drupal.org/project/farm/issues/3253581

Not exactly the same, but perhaps there could be a shared solution... 🤔

I'm imagining some logic that adds previously saved values to the list of options on a log-by-log basis. So for example, maybe we hide "blocked" users from this list by default. But, if you edit a log that has a blocked user selected, then it adds that user to the list of available options displayed in the form - only on that log. So when you save the log, it preserves that data.

@botlfarm
Copy link
Contributor

I guess I can see a few use cases where having access to the whole list of users is useful, but for my situation we have 2 main users and 2 very occasional users (1-2 times a year). I also have a lot of auditors that are set up as 'viewer'. These auditors never get add to logs and are just their to view the records. These are the ones that really clutter things up when trying to find an active user for me. So maybe it makes sense to hide blocked viewers form the log owners list?

@mstenta
Copy link
Member Author

mstenta commented Apr 23, 2024

Ah yea interesting idea @botlfarm! Maybe we need some farmOS settings for the Owner module, which allows one to change how this list gets filtered, so it could potentially be by role as well. 🤔

Or... maybe a multi-select list is just too limited and we should consider a different approach altogether. For example, we use the Entity Browser module for the "Asset" reference field on logs. Although @paul121 and I have been talking about another idea as well... sort of a mix between an autocomplete (for finding and selecting entities) and checkboxes (for seeing what has been selected, and unselecting them). That could work well for this too, perhaps.

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

No branches or pull requests

2 participants