Add unarchive quick action to projects list views

See Add archiving to quick actions in list views (#554023 - closed) for context

Add unarchive quick action on the new projects list views. Specifically:

  • Your works / Projects
  • Explore / Projects
  • Admin area / Projects
  • User profile / Projects

Vue Component: app/assets/javascripts/vue_shared/components/projects_list/project_list.vue

Note: We'll do this for pages that have been migrated to Vue, for other pages we will do this as part of the migration.

Design

image

Implementation Guide

1. Update GraphQL Fragment

Add userPermissions.archiveProject to the Projects GraphQL fragment.

2. Define Unarchive Action Constant

In the constants file:

  • Define ACTION_UNARCHIVE
  • Add it to BASE_OPTIONS

3. Update Project List Formatter

Modify the formatter to append ACTION_UNARCHIVE when:

  • project.userPermissions.archiveProject is true
  • project.archived is true

4. Create Unarchive API Function

Add unarchiveProject function to projects_api.js. Should send POST /projects/:id/unarchive.

5. Add onUnarchive Handler

Add onUnarchive handler in ProjectListItemActions that does the following:

  • Trigger the unarchiveProject function.
  • Emit a refetch event.
  • Render a toast/alert based on the results.
Edited by Shane Maglangit