Commit 818c0aeb authored by Mike Greiling's avatar Mike Greiling

Merge branch 'psi-boards-default-avatar' into 'master'

Remove some unneeded default_avatar complexity

See merge request gitlab-org/gitlab!26748
parents 0edd1b14 4d61a10b
......@@ -84,7 +84,6 @@ export default () => {
rootPath: $boardApp.dataset.rootPath,
bulkUpdatePath: $boardApp.dataset.bulkUpdatePath,
detailIssue: boardsStore.detail,
defaultAvatar: $boardApp.dataset.defaultAvatar,
},
computed: {
detailIssueVisible() {
......@@ -130,13 +129,10 @@ export default () => {
position = -1;
}
boardsStore.addList(
{
boardsStore.addList({
...listObj,
position,
},
this.defaultAvatar,
);
});
});
boardsStore.addBlankState();
......
export default class ListAssignee {
constructor(obj, defaultAvatar) {
constructor(obj) {
this.id = obj.id;
this.name = obj.name;
this.username = obj.username;
this.avatar = obj.avatar_url || obj.avatar || defaultAvatar;
this.avatar = obj.avatar_url || obj.avatar || gon.default_avatar_url;
this.path = obj.path;
this.state = obj.state;
this.webUrl = obj.web_url || obj.webUrl;
......
......@@ -10,7 +10,7 @@ import IssueProject from './project';
import boardsStore from '../stores/boards_store';
class ListIssue {
constructor(obj, defaultAvatar) {
constructor(obj) {
this.subscribed = obj.subscribed;
this.labels = [];
this.assignees = [];
......@@ -22,11 +22,11 @@ class ListIssue {
this.closed = obj.closed;
this.isLoading = {};
this.refreshData(obj, defaultAvatar);
this.refreshData(obj);
}
refreshData(obj, defaultAvatar) {
boardsStore.refreshIssueData(this, obj, defaultAvatar);
refreshData(obj) {
boardsStore.refreshIssueData(this, obj);
}
addLabel(label) {
......
......@@ -36,7 +36,7 @@ const TYPES = {
};
class List {
constructor(obj, defaultAvatar) {
constructor(obj) {
this.id = obj.id;
this._uid = this.guid();
this.position = obj.position;
......@@ -55,7 +55,6 @@ class List {
this.maxIssueCount = Object.hasOwnProperty.call(obj, 'max_issue_count')
? obj.max_issue_count
: 0;
this.defaultAvatar = defaultAvatar;
if (obj.label) {
this.label = new ListLabel(obj.label);
......@@ -156,7 +155,7 @@ class List {
createIssues(data) {
data.forEach(issueObj => {
this.addIssue(new ListIssue(issueObj, this.defaultAvatar));
this.addIssue(new ListIssue(issueObj));
});
}
......
......@@ -74,8 +74,8 @@ const boardsStore = {
showPage(page) {
this.state.currentPage = page;
},
addList(listObj, defaultAvatar) {
const list = new List(listObj, defaultAvatar);
addList(listObj) {
const list = new List(listObj);
this.state.lists = _.sortBy([...this.state.lists, list], 'position');
return list;
......@@ -602,7 +602,7 @@ const boardsStore = {
clearMultiSelect() {
this.multiSelect.list = [];
},
refreshIssueData(issue, obj, defaultAvatar) {
refreshIssueData(issue, obj) {
issue.id = obj.id;
issue.iid = obj.iid;
issue.title = obj.title;
......@@ -631,7 +631,7 @@ const boardsStore = {
}
if (obj.assignees) {
issue.assignees = obj.assignees.map(a => new ListAssignee(a, defaultAvatar));
issue.assignees = obj.assignees.map(a => new ListAssignee(a));
}
},
};
......
......@@ -15,7 +15,6 @@ module BoardsHelper
root_path: root_path,
full_path: full_path,
bulk_update_path: @bulk_issues_path,
default_avatar: image_path(default_avatar),
time_tracking_limit_to_hours: Gitlab::CurrentSettings.time_tracking_limit_to_hours.to_s,
recent_boards_endpoint: recent_boards_path
}
......
......@@ -2,8 +2,8 @@ import ListIssue from '~/boards/models/issue';
import IssueProject from '~/boards/models/project';
class ListIssueEE extends ListIssue {
constructor(obj, defaultAvatar) {
super(obj, defaultAvatar, {
constructor(obj) {
super(obj, {
IssueProject,
});
......
......@@ -155,18 +155,17 @@ describe('Issue card component', () => {
describe('assignee default avatar', () => {
beforeEach(done => {
global.gon.default_avatar_url = 'default_avatar';
wrapper.setProps({
issue: {
...wrapper.props('issue'),
assignees: [
new ListAssignee(
{
new ListAssignee({
id: 1,
name: 'testing 123',
username: 'test',
},
'default_avatar',
),
}),
],
},
});
......@@ -174,6 +173,10 @@ describe('Issue card component', () => {
wrapper.vm.$nextTick(done);
});
afterEach(() => {
global.gon.default_avatar_url = null;
});
it('displays defaults avatar if users avatar is null', () => {
expect(wrapper.find('.board-card-assignee img').exists()).toBe(true);
expect(wrapper.find('.board-card-assignee img').attributes('src')).toBe(
......
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