Commit 22fc4863 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'ide-project-avatar-identicon' into 'master'

Changes empty project avatar to identicon in the IDE

Closes #44298

See merge request gitlab-org/gitlab-ce!17899
parents bba6676c 6202657e
<script> <script>
import projectAvatarImage from '~/vue_shared/components/project_avatar/image.vue'; import ProjectAvatarImage from '~/vue_shared/components/project_avatar/image.vue';
import branchesTree from './ide_project_branches_tree.vue'; import Identicon from '../../vue_shared/components/identicon.vue';
import externalLinks from './ide_external_links.vue'; import BranchesTree from './ide_project_branches_tree.vue';
import ExternalLinks from './ide_external_links.vue';
export default { export default {
components: { components: {
branchesTree, BranchesTree,
externalLinks, ExternalLinks,
projectAvatarImage, ProjectAvatarImage,
Identicon,
}, },
props: { props: {
project: { project: {
...@@ -25,7 +27,10 @@ export default { ...@@ -25,7 +27,10 @@ export default {
:title="project.name" :title="project.name"
:href="project.web_url" :href="project.web_url"
> >
<div class="avatar-container s40 project-avatar"> <div
v-if="project.avatar_url"
class="avatar-container s40 project-avatar"
>
<project-avatar-image <project-avatar-image
class="avatar-container project-avatar" class="avatar-container project-avatar"
:link-href="project.path" :link-href="project.path"
...@@ -34,6 +39,12 @@ export default { ...@@ -34,6 +39,12 @@ export default {
:img-size="40" :img-size="40"
/> />
</div> </div>
<identicon
v-else
size-class="s40"
:entity-id="project.id"
:entity-name="project.name"
/>
<div class="sidebar-context-title"> <div class="sidebar-context-title">
{{ project.name }} {{ project.name }}
</div> </div>
......
---
title: Make project avatar in IDE consistent with the rest of GitLab
merge_request:
author:
type: changed
import Vue from 'vue';
import ProjectTree from '~/ide/components/ide_project_tree.vue';
import createComponent from 'spec/helpers/vue_mount_component_helper';
describe('IDE project tree', () => {
const Component = Vue.extend(ProjectTree);
let vm;
beforeEach(() => {
vm = createComponent(Component, {
project: {
id: 1,
name: 'test',
web_url: gl.TEST_HOST,
avatar_url: '',
branches: [],
},
});
});
afterEach(() => {
vm.$destroy();
});
it('renders identicon when projct has no avatar', () => {
expect(vm.$el.querySelector('.identicon')).not.toBeNull();
});
it('renders avatar image if project has avatar', done => {
vm.project.avatar_url = gl.TEST_HOST;
vm.$nextTick(() => {
expect(vm.$el.querySelector('.identicon')).toBeNull();
expect(vm.$el.querySelector('img.avatar')).not.toBeNull();
done();
});
});
});
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