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 / ProjectsExplore / ProjectsAdmin area / ProjectsUser 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
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.archiveProjectis true -
project.archivedis 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
unarchiveProjectfunction. - Emit a
refetchevent. - Render a toast/alert based on the results.
Edited by Shane Maglangit
