Commit d05c72c3 authored by Clement Ho's avatar Clement Ho

[skip ci] rename user to assignee

parent 10d74f0a
...@@ -12,7 +12,7 @@ require('./models/issue'); ...@@ -12,7 +12,7 @@ require('./models/issue');
require('./models/label'); require('./models/label');
require('./models/list'); require('./models/list');
require('./models/milestone'); require('./models/milestone');
require('./models/user'); require('./models/assignee');
require('./stores/boards_store'); require('./stores/boards_store');
require('./stores/modal_store'); require('./stores/modal_store');
require('./services/board_service'); require('./services/board_service');
......
...@@ -70,19 +70,19 @@ require('./sidebar/remove_issue'); ...@@ -70,19 +70,19 @@ require('./sidebar/remove_issue');
// Notify gl dropdown that we are now assigning to current user // Notify gl dropdown that we are now assigning to current user
this.$refs.assigneeBlock.dispatchEvent(new Event('assignYourself')); this.$refs.assigneeBlock.dispatchEvent(new Event('assignYourself'));
this.addUser(this.currentUser.id); this.addAssignee(this.currentUser);
this.saveUsers(); this.saveAssignees();
}, },
removeUser (u) { removeAssignee (a) {
gl.issueBoards.BoardsStore.detail.issue.removeUser(u); gl.issueBoards.BoardsStore.detail.issue.removeAssignee(a);
}, },
addUser (u) { addAssignee (a) {
gl.issueBoards.BoardsStore.detail.issue.addUser(u); gl.issueBoards.BoardsStore.detail.issue.addAssignee(a);
}, },
removeAllUsers () { removeAllAssignees () {
gl.issueBoards.BoardsStore.detail.issue.removeAllUsers(); gl.issueBoards.BoardsStore.detail.issue.removeAllAssignees();
}, },
saveUsers () { saveAssignees () {
this.loadingAssignees = true; this.loadingAssignees = true;
gl.issueBoards.BoardsStore.detail.issue.update(this.endpoint) gl.issueBoards.BoardsStore.detail.issue.update(this.endpoint)
...@@ -103,16 +103,16 @@ require('./sidebar/remove_issue'); ...@@ -103,16 +103,16 @@ require('./sidebar/remove_issue');
}, },
created () { created () {
// Get events from glDropdown // Get events from glDropdown
eventHub.$on('sidebar.removeUser', this.removeUser); eventHub.$on('sidebar.removeAssignee', this.removeAssignee);
eventHub.$on('sidebar.addUser', this.addUser); eventHub.$on('sidebar.addAssignee', this.addAssignee);
eventHub.$on('sidebar.removeAllUsers', this.removeAllUsers); eventHub.$on('sidebar.removeAllAssignees', this.removeAllAssignees);
eventHub.$on('sidebar.saveUsers', this.saveUsers); eventHub.$on('sidebar.saveAssignees', this.saveAssignees);
}, },
beforeDestroy() { beforeDestroy() {
eventHub.$off('sidebar.removeUser', this.removeUser); eventHub.$off('sidebar.removeAssignee', this.removeAssignee);
eventHub.$off('sidebar.addUser', this.addUser); eventHub.$off('sidebar.addAssignee', this.addAssignee);
eventHub.$off('sidebar.removeAllUsers', this.removeAllUsers); eventHub.$off('sidebar.removeAllAssignees', this.removeAllAssignees);
eventHub.$off('sidebar.saveUsers', this.saveUsers); eventHub.$off('sidebar.saveAssignees', this.saveAssignees);
}, },
mounted () { mounted () {
new IssuableContext(this.currentUser); new IssuableContext(this.currentUser);
......
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
class ListUser { class ListAssignee {
constructor(user) { constructor(user) {
this.id = user.id; this.id = user.id;
this.name = user.name; this.name = user.name;
...@@ -9,4 +9,4 @@ class ListUser { ...@@ -9,4 +9,4 @@ class ListUser {
} }
} }
window.ListUser = ListUser; window.ListAssignee = ListAssignee;
/* eslint-disable no-unused-vars, space-before-function-paren, arrow-body-style, arrow-parens, comma-dangle, max-len */ /* eslint-disable no-unused-vars, space-before-function-paren, arrow-body-style, arrow-parens, comma-dangle, max-len */
/* global ListLabel */ /* global ListLabel */
/* global ListMilestone */ /* global ListMilestone */
/* global ListUser */ /* global ListAssignee */
import Vue from 'vue'; import Vue from 'vue';
...@@ -31,7 +31,7 @@ class ListIssue { ...@@ -31,7 +31,7 @@ class ListIssue {
} }
processAssignees(assignees) { processAssignees(assignees) {
this.assignees = assignees.map(a => new ListUser(a)); this.assignees = assignees.map(a => new ListAssignee(a));
} }
addLabel (label) { addLabel (label) {
...@@ -54,23 +54,23 @@ class ListIssue { ...@@ -54,23 +54,23 @@ class ListIssue {
labels.forEach(this.removeLabel.bind(this)); labels.forEach(this.removeLabel.bind(this));
} }
addUser (user) { addAssignee (assignee) {
if (!this.findUser(user)) { if (!this.findAssignee(assignee)) {
this.assignees.push(new ListUser(user)); this.assignees.push(new ListAssignee(assignee));
} }
} }
findUser (user) { findAssignee (findAssignee) {
return this.assignees.filter(assignee => assignee.id === user.id)[0]; return this.assignees.filter(assignee => assignee.id === findAssignee.id)[0];
} }
removeUser (user) { removeAssignee (removeAssignee) {
if (user) { if (assignee) {
this.assignees = this.assignees.filter(assignee => assignee.id !== user.id); this.assignees = this.assignees.filter(assignee => assignee.id !== removeAssignee.id);
} }
} }
removeAllUsers () { removeAllAssignees () {
this.assignees = []; this.assignees = [];
} }
......
/* eslint-disable func-names, space-before-function-paren, one-var, no-var, prefer-rest-params, wrap-iife, quotes, max-len, one-var-declaration-per-line, vars-on-top, prefer-arrow-callback, consistent-return, comma-dangle, object-shorthand, no-shadow, no-unused-vars, no-else-return, no-self-compare, prefer-template, no-unused-expressions, no-lonely-if, yoda, prefer-spread, no-void, camelcase, no-param-reassign */ /* eslint-disable func-names, space-before-function-paren, one-var, no-var, prefer-rest-params, wrap-iife, quotes, max-len, one-var-declaration-per-line, vars-on-top, prefer-arrow-callback, consistent-return, comma-dangle, object-shorthand, no-shadow, no-unused-vars, no-else-return, no-self-compare, prefer-template, no-unused-expressions, no-lonely-if, yoda, prefer-spread, no-void, camelcase, no-param-reassign */
/* global Issuable */ /* global Issuable */
/* global ListUser */
import eventHub from './sidebar/event_hub'; import eventHub from './sidebar/event_hub';
...@@ -257,7 +256,7 @@ import eventHub from './sidebar/event_hub'; ...@@ -257,7 +256,7 @@ import eventHub from './sidebar/event_hub';
defaultLabel: defaultLabel, defaultLabel: defaultLabel,
hidden: function(e) { hidden: function(e) {
if ($dropdown.hasClass('js-multiselect')) { if ($dropdown.hasClass('js-multiselect')) {
eventHub.$emit('sidebar.saveUsers'); eventHub.$emit('sidebar.saveAssignees');
} }
$selectbox.hide(); $selectbox.hide();
...@@ -290,7 +289,7 @@ import eventHub from './sidebar/event_hub'; ...@@ -290,7 +289,7 @@ import eventHub from './sidebar/event_hub';
.find(`input[name='${$dropdown.data('field-name')}'][value=${firstSelectedId}]`); .find(`input[name='${$dropdown.data('field-name')}'][value=${firstSelectedId}]`);
firstSelected.remove(); firstSelected.remove();
eventHub.$emit('sidebar.removeUser', { eventHub.$emit('sidebar.removeAssignee', {
id: firstSelectedId, id: firstSelectedId,
}); });
} }
...@@ -302,10 +301,10 @@ import eventHub from './sidebar/event_hub'; ...@@ -302,10 +301,10 @@ import eventHub from './sidebar/event_hub';
const id = parseInt(element.value, 10); const id = parseInt(element.value, 10);
element.remove(); element.remove();
}); });
eventHub.$emit('sidebar.removeAllUsers'); eventHub.$emit('sidebar.removeAllAssignees');
} else if (isActive) { } else if (isActive) {
// user selected // user selected
eventHub.$emit('sidebar.addUser', user); eventHub.$emit('sidebar.addAssignee', user);
// 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')
...@@ -321,7 +320,7 @@ import eventHub from './sidebar/event_hub'; ...@@ -321,7 +320,7 @@ import eventHub from './sidebar/event_hub';
} }
// User unselected // User unselected
eventHub.$emit('sidebar.removeUser', user); eventHub.$emit('sidebar.removeAssignee', user);
} }
} }
......
/* global ListUser */ /* global ListAssignee */
/* global ListLabel */ /* global ListLabel */
/* global listObj */ /* global listObj */
/* global ListIssue */ /* global ListIssue */
...@@ -14,7 +14,7 @@ require('~/boards/components/issue_card_inner'); ...@@ -14,7 +14,7 @@ require('~/boards/components/issue_card_inner');
require('./mock_data'); require('./mock_data');
describe('Issue card component', () => { describe('Issue card component', () => {
const user = new ListUser({ const user = new ListAssignee({
id: 1, id: 1,
name: 'testing 123', name: 'testing 123',
username: 'test', username: 'test',
......
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