Skip to content
Snippets Groups Projects
Commit dd146a59 authored by Phil Hughes's avatar Phil Hughes
Browse files

Changed how the default avatar is set

parent 5996e8f9
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -59,7 +59,8 @@ $(() => {
issueLinkBase: $boardApp.dataset.issueLinkBase,
rootPath: $boardApp.dataset.rootPath,
bulkUpdatePath: $boardApp.dataset.bulkUpdatePath,
detailIssue: Store.detail
detailIssue: Store.detail,
defaultAvatar: $boardApp.dataset.defaultAvatar,
},
computed: {
detailIssueVisible () {
Loading
Loading
@@ -82,7 +83,7 @@ $(() => {
gl.boardService.all()
.then((resp) => {
resp.json().forEach((board) => {
const list = Store.addList(board);
const list = Store.addList(board, this.defaultAvatar);
 
if (list.type === 'closed') {
list.position = Infinity;
Loading
Loading
Loading
Loading
@@ -6,7 +6,7 @@
import Vue from 'vue';
 
class ListIssue {
constructor (obj) {
constructor (obj, defaultAvatar) {
this.globalId = obj.id;
this.id = obj.iid;
this.title = obj.title;
Loading
Loading
@@ -19,7 +19,7 @@ class ListIssue {
this.position = obj.relative_position || Infinity;
 
if (obj.assignee) {
this.assignee = new ListUser(obj.assignee);
this.assignee = new ListUser(obj.assignee, defaultAvatar);
}
 
if (obj.milestone) {
Loading
Loading
Loading
Loading
@@ -6,7 +6,7 @@ import queryData from '../utils/query_data';
const PER_PAGE = 20;
 
class List {
constructor (obj) {
constructor (obj, defaultAvatar) {
this.id = obj.id;
this._uid = this.guid();
this.position = obj.position;
Loading
Loading
@@ -18,6 +18,7 @@ class List {
this.loadingMore = false;
this.issues = [];
this.issuesSize = 0;
this.defaultAvatar = defaultAvatar;
 
if (obj.label) {
this.label = new ListLabel(obj.label);
Loading
Loading
@@ -106,7 +107,7 @@ class List {
 
createIssues (data) {
data.forEach((issueObj) => {
this.addIssue(new ListIssue(issueObj));
this.addIssue(new ListIssue(issueObj, this.defaultAvatar));
});
}
 
Loading
Loading
/* eslint-disable no-unused-vars */
import defaultAvatar from '../utils/default_avatar';
class ListUser {
constructor(user) {
constructor(user, defaultAvatar) {
this.id = user.id;
this.name = user.name;
this.username = user.username;
this.avatar = user.avatar_url || defaultAvatar();
this.avatar = user.avatar_url || defaultAvatar;
}
}
 
Loading
Loading
Loading
Loading
@@ -23,8 +23,8 @@ gl.issueBoards.BoardsStore = {
this.state.lists = [];
this.filter.path = gl.utils.getUrlParamsArray().join('&');
},
addList (listObj) {
const list = new List(listObj);
addList (listObj, defaultAvatar) {
const list = new List(listObj, defaultAvatar);
this.state.lists.push(list);
 
return list;
Loading
Loading
export default () => document.getElementById('board-app').dataset.defaultAvatar;
Loading
Loading
@@ -146,6 +146,27 @@ describe('Issue card component', () => {
).not.toBeNull();
});
});
describe('assignee default avatar', () => {
beforeEach((done) => {
component.issue.assignee = new ListUser({
id: 1,
name: 'testing 123',
username: 'test',
}, 'default_avatar');
Vue.nextTick(done);
});
it('displays defaults avatar if users avatar is null', () => {
expect(
component.$el.querySelector('.card-assignee img'),
).not.toBeNull();
expect(
component.$el.querySelector('.card-assignee img').getAttribute('src'),
).toBe('default_avatar');
});
});
});
 
describe('labels', () => {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment