Commit 6da80dbd authored by Clement Ho's avatar Clement Ho

[skip ci] more refactor

parent a252e26b
......@@ -2,11 +2,11 @@ import CollapsedAvatar from './avatar';
export default {
name: 'CollapsedAssignees',
data: {
data() {
return {
defaultRenderCount: 5,
defaultMaxCounter: 99,
}
};
},
props: {
users: {
......
......@@ -41,7 +41,6 @@ export default {
return {
store,
service,
loading: false,
};
},
computed: {
......@@ -62,13 +61,13 @@ export default {
this.saveUsers();
},
saveUsers() {
this.loading = true;
this.store.loading = true;
this.service.update(this.store.getUserIds())
.then((response) => {
this.loading = false;
this.store.loading = false;
this.store.saveUsers(response.data.assignees);
}).catch(() => {
this.loading = false;
this.store.loading = false;
return new Flash('An error occured while saving assignees', 'alert');
});
},
......@@ -84,12 +83,12 @@ export default {
<div>
<assignee-title
:numberOfAssignees="store.users.length"
:loading="loading"
:loading="store.loading"
:editable="store.editable"
/>
<collapsed-assignees :users="store.users"/>
<div class="value" v-if="!loading">
<div class="value" v-if="!store.loading">
<no-assignee v-if="numberOfAssignees === 0" />
<single-assignee
v-else-if="numberOfAssignees === 1"
......
......@@ -10,7 +10,6 @@ export default class SidebarAssigneesStore {
this.users = [];
this.loading = false;
this.editable = editable;
this.defaultRenderCount = 5;
assignees.forEach(a => this.addUser(this.destructUser(a)));
}
......@@ -24,8 +23,6 @@ export default class SidebarAssigneesStore {
username,
avatarUrl,
});
console.log(`addUser()`);
console.log(user);
}
addCurrentUser() {
......@@ -33,8 +30,6 @@ export default class SidebarAssigneesStore {
}
removeUser(id) {
console.log(`removeUser()`);
console.log(id);
this.users = this.users.filter(u => u.id !== id);
}
......@@ -43,12 +38,8 @@ export default class SidebarAssigneesStore {
}
getUserIds() {
console.log(`getUserIds`);
const ids = this.users.map(u => u.id);
if (ids.length > 0 && ids[0] == undefined) {
debugger
}
// If there are no ids, that means we have to unassign (which is id = 0)
return ids.length > 0 ? ids : [0];
}
......
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