Commit 17faea01 authored by Brandon Labuschagne's avatar Brandon Labuschagne

Merge branch '245532-refactor-to-use-destructuring' into 'master'

Improve code base to reviewers and assignees partial

See merge request gitlab-org/gitlab!44488
parents 2d731e8d fb0be8ff
......@@ -37,17 +37,17 @@ export default class SidebarStore {
SidebarStore.singleton = this;
}
setAssigneeData(data) {
setAssigneeData({ assignees }) {
this.isFetching.assignees = false;
if (data.assignees) {
this.assignees = data.assignees;
if (assignees) {
this.assignees = assignees;
}
}
setReviewerData(data) {
setReviewerData({ reviewers }) {
this.isFetching.reviewers = false;
if (data.reviewers) {
this.reviewers = data.reviewers;
if (reviewers) {
this.reviewers = reviewers;
}
}
......@@ -91,22 +91,22 @@ export default class SidebarStore {
}
findAssignee(findAssignee) {
return this.assignees.find(assignee => assignee.id === findAssignee.id);
return this.assignees.find(({ id }) => id === findAssignee.id);
}
findReviewer(findReviewer) {
return this.reviewers.find(reviewer => reviewer.id === findReviewer.id);
return this.reviewers.find(({ id }) => id === findReviewer.id);
}
removeAssignee(removeAssignee) {
if (removeAssignee) {
this.assignees = this.assignees.filter(assignee => assignee.id !== removeAssignee.id);
removeAssignee(assignee) {
if (assignee) {
this.assignees = this.assignees.filter(({ id }) => id !== assignee.id);
}
}
removeReviewer(removeReviewer) {
if (removeReviewer) {
this.reviewers = this.reviewers.filter(reviewer => reviewer.id !== removeReviewer.id);
removeReviewer(reviewer) {
if (reviewer) {
this.reviewers = this.reviewers.filter(({ id }) => id !== reviewer.id);
}
}
......
......@@ -27,11 +27,11 @@
.block.todo.hide-expanded
= render "shared/issuable/sidebar_todo", issuable_sidebar: issuable_sidebar, is_collapsed: true
.block.assignee.qa-assignee-block
= render "shared/issuable/sidebar_assignees", issuable_sidebar: issuable_sidebar, assignees: assignees
= render "shared/issuable/sidebar_assignees", issuable_sidebar: issuable_sidebar, assignees: assignees, signed_in: signed_in
- if Feature.enabled?(:merge_request_reviewers, @project) && reviewers
.block.reviewer.qa-reviewer-block
= render "shared/issuable/sidebar_reviewers", issuable_sidebar: issuable_sidebar, reviewers: reviewers
= render "shared/issuable/sidebar_reviewers", issuable_sidebar: issuable_sidebar, reviewers: reviewers, signed_in: signed_in
= render_if_exists 'shared/issuable/sidebar_item_epic', issuable_sidebar: issuable_sidebar
......
- issuable_type = issuable_sidebar[:type]
- signed_in = !!issuable_sidebar.dig(:current_user, :id)
#js-vue-sidebar-assignees{ data: { field: issuable_type, signed_in: signed_in } }
.title.hide-collapsed
......
- issuable_type = issuable_sidebar[:type]
- signed_in = !!issuable_sidebar.dig(:current_user, :id)
#js-vue-sidebar-reviewers{ data: { field: issuable_type, signed_in: signed_in } }
.title.hide-collapsed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment