Commit a69fd293 authored by Clement Ho's avatar Clement Ho

[skip ci] refactor function parameters

parent bb29b79c
...@@ -279,7 +279,12 @@ import Vue from 'vue'; ...@@ -279,7 +279,12 @@ import Vue from 'vue';
}); });
} else if (isActive) { } else if (isActive) {
// user selected // user selected
gl.sidebarAssigneesOptions.assignees.addUser(user.id, user.name, user.username, user.avatar_url); gl.sidebarAssigneesOptions.assignees.addUser({
id: user.id,
name: user.name,
username: user.username,
avatarUrl: user.avatar_url
});
// Remove unassigned selection (if it was previously selected) // Remove unassigned selection (if it was previously selected)
const unassignedSelected = $dropdown.closest('.selectbox') const unassignedSelected = $dropdown.closest('.selectbox')
......
...@@ -12,7 +12,9 @@ export default class SidebarAssigneesStore { ...@@ -12,7 +12,9 @@ export default class SidebarAssigneesStore {
this.editable = editable; this.editable = editable;
} }
addUser(id, name = '', username = '', avatarUrl = '', saved = false) { addUser(user, saved = false) {
const { id, name, username, avatarUrl } = user;
this.users.push({ this.users.push({
id, id,
name, name,
......
...@@ -217,7 +217,12 @@ ...@@ -217,7 +217,12 @@
- issuable.assignees.each do |assignee| - issuable.assignees.each do |assignee|
:javascript :javascript
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
gl.sidebarAssigneesOptions.assignees.addUser(parseInt("#{assignee.id}", 10), "#{assignee.name}", "#{assignee.username}", "#{assignee.avatar_url}", true); gl.sidebarAssigneesOptions.assignees.addUser({
id: parseInt("#{assignee.id}", 10),
name: "#{assignee.name}",
username: "#{assignee.username}",
avatarUrl: "#{assignee.avatar_url}"
}, true);
}); });
:javascript :javascript
......
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