mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-06-24 17:11:43 +00:00
fixed bug with role color
This commit is contained in:
parent
29be91c18a
commit
2c9fd82dce
2 changed files with 20 additions and 6 deletions
|
|
@ -60,10 +60,16 @@ export default {
|
||||||
if (!this.roles) return undefined;
|
if (!this.roles) return undefined;
|
||||||
|
|
||||||
let filter = this.roles.filter(r => this.member.roles.includes(r.id));
|
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() {
|
isAdmin() {
|
||||||
if (!this.roles) return false;
|
if (!this.roles) return false;
|
||||||
|
|
|
||||||
|
|
@ -337,11 +337,19 @@ export default {
|
||||||
roleColor() {
|
roleColor() {
|
||||||
if (!this.isServer) return undefined;
|
if (!this.isServer) return undefined;
|
||||||
if (!this.serverMember || !this.serverMember.roles) 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)
|
this.serverMember.roles.includes(r.id)
|
||||||
);
|
);
|
||||||
if (!filtered.length) return undefined;
|
if (filter.length) {
|
||||||
return filtered[0].color + " !important";
|
if (filter[0].color) {
|
||||||
|
return filter[0].color + " !important";
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return this.roles.find(r => r.default).color + " !important";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue