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

Fixed issue where View Assigned Assets would crash if there are no custom fields for any assigned models #12132

Merged
merged 2 commits into from
Nov 16, 2022

Conversation

snipe
Copy link
Owner

@snipe snipe commented Nov 16, 2022

If none of a user's assigned assets have any custom fields, this will cause the View Assigned Assets page to crash. This fixes that regression.

@what-the-diff
Copy link

what-the-diff bot commented Nov 16, 2022

  • Added a new variable $field_array
  • Changed the foreach loop to check if asset->model has fieldset before checking for fields in it
  • Moved the code that adds custom fields into an array outside of both loops and added another condition to make sure they're allowed to see the value of this custom field

Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

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

LGTM!

Signed-off-by: snipe <snipe@snipe.net>
@snipe snipe merged commit cdcd19a into develop Nov 16, 2022
@snipe snipe deleted the fixes/view_assets_page_error_when_no_custom_fields branch November 16, 2022 17:49
@snipe snipe changed the title Handle use case where there are no custom fields for any assigned models Fixed issue where View Assigned Assets would crash if there are no custom fields for any assigned models Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants