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

Add ability to delete a project from the featured_projects table #56532

Merged
merged 6 commits into from
Feb 14, 2024

Conversation

fisher-alice
Copy link
Contributor

@fisher-alice fisher-alice commented Feb 13, 2024

This PR allows an admin user to delete a project from the featured_projects table displayed at 'projects/featured' (must have project validator permission to have access to this page). Currently there are 232 featured projects, and 550 projects in the ‘Archive of Previously Featured Projects’.

Many of the projects are no longer available (project deleted) and some of them were added unintentionally. There are currently too many to be able to manage effectively for an admin user.

Note that deleting a project from the featured_projects does NOT delete the project itself, and it is possible to re-add it to the featured_projects table.

Updates include:

  • adding a 'delete' route for featured projects
  • adding the 'Remove' option for projects listed in the 'Archive of previously featured projects' table at 'project/featured'.
  • Deletes the record when button is clicked.

This is part 1 of 2 steps described here.

Screencast video AFTER update: Note that button now displays 'Remove' instead of 'Delete' based on this feedback.

delete-featured-project.mp4

Links

jira

Testing story

I tested locally, and I also checked the featured_projects table using mysql-client-dashboard-reader to confirm the entry was removed from the table.

Deployment strategy

Follow-up work

Follow-up work includes adding a confirmation modal when an admin users clicks on the 'Delete' button to delete a featured project. https://codedotorg.atlassian.net/browse/LABS-507
Asked @samantha-code about this and she prefers no confirmation dialog for 'Delete/Remove' button.

Privacy

Security

Caching

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@fisher-alice fisher-alice marked this pull request as ready for review February 13, 2024 17:50
@fisher-alice fisher-alice requested a review from a team February 13, 2024 17:50
Copy link
Contributor

@sanchitmalhotra126 sanchitmalhotra126 left a comment

Choose a reason for hiding this comment

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

LGTM! I'm wondering if "Delete" feels a bit too intense since this doesn't actually delete the project from our system? But so long as users know what's happening it's probably fine

@@ -151,6 +151,17 @@ const feature = (channel, publishedAt) => {
.fail(handleFeatureFailure);
};

const onDelete = channel => {
var url = `/featured_projects/${channel}`;
$.ajax({
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can we use fetch here? looks like we have other usages of $.ajax in this file though so also okay if you want to keep it consistent (and we can upgrade this file up later as a follow-up)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! I'll wait till #56555 is merged since the authenticity token was required when fetch was used.

@@ -151,6 +151,17 @@ const feature = (channel, publishedAt) => {
.fail(handleFeatureFailure);
};

const onDelete = channel => {
var url = `/featured_projects/${channel}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit const

@fisher-alice
Copy link
Contributor Author

LGTM! I'm wondering if "Delete" feels a bit too intense since this doesn't actually delete the project from our system? But so long as users know what's happening it's probably fine

Good point! I asked @samantha-code about this and she said 'Remove' sounds good. Thanks!

@fisher-alice fisher-alice merged commit fc37230 into staging Feb 14, 2024
2 checks passed
@fisher-alice fisher-alice deleted the alice/delete-featured-project branch February 14, 2024 15:01
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.

None yet

2 participants