Fix badges not being rendered on update

This commit is contained in:
Samuel Elliott 2018-04-27 17:39:00 +01:00
parent 244b7e5bd1
commit d42e8f66ca
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
1 changed files with 5 additions and 7 deletions

View File

@ -187,8 +187,8 @@ export default class extends Module {
const c = contributors.find(c => c.id === user.id);
if (!c) return;
const element = ReactHelpers.React.createElement('span', {
className: 'bd-profile-badges',
const element = ReactHelpers.React.createElement('div', {
className: 'bd-profile-badges-outer',
'data-userid': user.id
});
@ -216,7 +216,7 @@ export default class extends Module {
}
injectProfileBadges(element) {
for (const beo of element.getElementsByClassName('bd-profile-badges'))
for (const beo of element.getElementsByClassName('bd-profile-badges-outer'))
this.injectProfileBadge(beo);
}
@ -225,8 +225,6 @@ export default class extends Module {
root.removeChild(root.firstChild);
}
if (root.classList.contains('bd-has-badge')) return;
const { userid } = root.dataset;
if (!userid) return;
@ -236,8 +234,8 @@ export default class extends Module {
VueInjector.inject(root, {
components: { BdBadge },
data: { c },
template: '<BdBadge class="bd-has-badge" :developer="c.developer" :webdev="c.webdev" :contributor="c.contributor" />',
});
template: '<BdBadge :developer="c.developer" :webdev="c.webdev" :contributor="c.contributor" />',
}, DOM.createElement('span'));
}
}