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

Deleting a User that had Reviews prevents Component from loading #651

Open
freddyfeelgood opened this issue Jan 24, 2025 · 0 comments
Open

Comments

@freddyfeelgood
Copy link
Contributor

If a user had created Review items on any controls in a component, then that user account gets deleted, the Reviews still exist with a null user id, and this prevents the Component from loading.

Recommended fix would be one of the following:

  • When user is deleted, either assign the project admin user id to the review records, or prompt for a user to assign them to (especially if the project admin is the user being deleted - not sure what other issues that would produce)
  • Leave the user id null, but in the Component load, check for the null user id on the Review, and add a label, like "Unknown User" or something similar, allowing the Component to load.

In the short term, to fix this manually in our local database, we did the following:

  • Get a list of problem records (project, component, component release/version):

select distinct p.name, c.name, c.id as component_id, 'v' || c.version || 'r' || c.release as release from projects p, components c, base_rules r where r.component_id = c.id and c.project_id = p.id and r.id in (select distinct rule_id from reviews where user_id is null) order by c.id;

  • Figure out which user ids you want to place on which components by querying the users table.

  • Update the Reviews records with appropriate user ids:

update reviews set user_id = YYY where user_id is null and rule_id in (select id from base_rules where component_id in (ZZZ));

Replacing "YYY" and "ZZZ" appropriately. That will replace all rules under a given component where the user id is null - if needing to do it per rule, other more granular queries would be needed.

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

No branches or pull requests

1 participant