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

Fix campaign categories being overwritten by different agencies #465

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

EarthlingDavey
Copy link
Contributor

Fix campaign categories being overwritten by users from different agencies.

Add a function called has_attached_terms_not_in_context to catch if a post has a category attached that does not relate to current agency context.

Add a property called run_has_attached_terms_not_in_context to enable this on a taxonomy basis. Currently enabled for Campaign_Category, could also be enabled for other taxonomies that extend Content_Category e.g. News_Category.

Resolves: https://dsdmoj.atlassian.net/jira/software/c/projects/CDPT/boards/1154?selectedIssue=CDPT-1253

…ncies

Add a function called has_attached_terms_not_in_context to catch if a post has a category attached that does not relate to current Agengy context.

Add a property called run_has_attached_terms_not_in_context to enable this on a taxonomy basis. Currently enabled for Campaign_Category, could also be enabled for other taxonomies that extend Content_Category e.g. News_Category.

Resolves: https://dsdmoj.atlassian.net/jira/software/c/projects/CDPT/boards/1154?selectedIssue=CDPT-1253
@EarthlingDavey EarthlingDavey requested a review from a team as a code owner January 26, 2024 13:18
@EarthlingDavey EarthlingDavey changed the base branch from main to develop January 26, 2024 13:19
@EarthlingDavey EarthlingDavey changed the base branch from develop to main January 26, 2024 13:24
@EarthlingDavey
Copy link
Contributor Author

To reproduce the bug:

As HQ, go to a blog post that has another agency, the campaign categories available to the other agency must be less than for HQ e.g. locally http://intranet.docker/wp/wp-admin/post.php?post=473157&action=edit

Check a Campaign Category that is available to HQ but not OPG, e.g. 'Be open to Innovation updates'. Save the page.

Switch agency to OPG and edit the same page. Check any Campaign Category , verify that the campaign category from the previous step is not shown in the list 'Be open to Innovation updates'. Save the page.

Switch back to HQ, you will see that 'Be open to Innovation updates' has been unchecked.

To reproduce the fix:

Run steps 1 & 2, at step 3 you should see that the side box for campaign category is not shown on the right hand side.

@wilson1000-MoJ
Copy link
Contributor

Looks good @EarthlingDavey 👍🏽

@EarthlingDavey EarthlingDavey merged commit 2fae755 into main Jan 29, 2024
4 checks passed
@EarthlingDavey EarthlingDavey deleted the fix-campaign-categories-overwrite-bug branch January 29, 2024 20:31
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

Successfully merging this pull request may close these issues.

2 participants