Refactor shared logic to base component
What does this MR do and why?
Related to #378677 (closed)
In &9056 we are migrating the user profile from HAML/jQuery to Vue. This is a large migration so we are splitting it up into many sections.
There are many contribution events that we will need to support. These are documented in https://docs.gitlab.com/ee/user/profile/contributions_calendar.html#user-contribution-events. As of now we have added support for approved
, expired
, joined
, and left
events. See !122676 (closed) for how every event will be implemented (not including this refactor). I am currently cherry-picking events from that MR into individual MRs to make them smaller and easier to review.
All event components use the contribution_event_base.vue
component. Previously this base component was only responsible for rendering the user avatar and each individual event component was responsible for rendering the message. I realized that all of the events except pushed
and private
are going to follow the same message format. This means that we can abstract a lot of the message logic to contribution_event_base.vue
. For the two events that do not follow this message format we can still allow them to use the default slot to render the message.
UX note: There is currently an incorrect bottom border in the tabs. This is due to a recent change in !118597 (merged). We will be removing the tabs and moving the navigation into the new sidebar in #389842. By removing the tabs we will be able to fix this bug and because this is behind a feature flag I am going to leave it as-is for now.
Screenshots or screen recordings
No visual changes, developer facing
How to set up and validate locally
- Open the rails console
bin/rails console
- Enable the
profile_tabs_vue
feature flagFeature.enable(:profile_tabs_vue)
- Go to a project and make note of the ID (shown on the overview page)
- Run the following commands to create contribution events
user = User.find(1)
project = Project.find(<project ID from previous step>)
merge_request = MergeRequest.first
FactoryBot.create(:event, :expired, project: project, author: user)
FactoryBot.create(:event, :joined, project: project, author: user)
FactoryBot.create(:event, :left, project: project, author: user)
FactoryBot.create(:event, :approved, author: user, project: merge_request.project, target: merge_request)
- Navigate to your profile
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.