fixed bug with role color

This commit is contained in:
supertiger1234 2020-01-25 17:32:53 +00:00
parent 29be91c18a
commit 2c9fd82dce
2 changed files with 20 additions and 6 deletions

View file

@ -60,10 +60,16 @@ export default {
if (!this.roles) return undefined;
let filter = this.roles.filter(r => this.member.roles.includes(r.id));
if (!filter.length) {
filter = [this.roles.find(r => r.default)];
if (filter.length) {
if (filter[0].color) {
return filter[0].color + " !important";
} else {
return undefined;
}
} else {
return this.roles.find(r => r.default).color + " !important";
}
return filter[0].color + " !important";
},
isAdmin() {
if (!this.roles) return false;

View file

@ -337,11 +337,19 @@ export default {
roleColor() {
if (!this.isServer) return undefined;
if (!this.serverMember || !this.serverMember.roles) return undefined;
const filtered = this.roles.filter(r =>
const filter = this.roles.filter(r =>
this.serverMember.roles.includes(r.id)
);
if (!filtered.length) return undefined;
return filtered[0].color + " !important";
if (filter.length) {
if (filter[0].color) {
return filter[0].color + " !important";
} else {
return undefined;
}
} else {
return this.roles.find(r => r.default).color + " !important";
}
}
}
};