mirror of
https://github.com/Lissy93/dashy.git
synced 2025-04-08 17:06:18 +02:00
✨ Add showEmpty option for NextcloudUserStatus widget
When a user status doesn't include a status message, it still may have a status emoji and it always has a status indicator (e.g. online). When {showEmpty=true} then statuses without a message are shown, otherwise hidden. Defaults to {false}.
This commit is contained in:
parent
821af62426
commit
e76f552830
@ -74,6 +74,9 @@ export default {
|
||||
if (this.options.users.length > 100) return this.options.users.slice(0, 100);
|
||||
return this.options.users;
|
||||
},
|
||||
showEmpty() {
|
||||
return !!this.options.showEmpty;
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -119,6 +122,7 @@ export default {
|
||||
const newStatuses = {};
|
||||
Object.values(statuses).forEach((status) => {
|
||||
if (!this.users.includes(status.userId)) return;
|
||||
if (!status.message && !this.showEmpty) return;
|
||||
newStatuses[status.userId] = status;
|
||||
});
|
||||
this.statuses = newStatuses;
|
||||
@ -126,7 +130,7 @@ export default {
|
||||
processStatus(response) {
|
||||
const raw = this.validateResponse(response);
|
||||
const status = Array.isArray(raw) && raw.length ? raw[0] : raw;
|
||||
if (status) {
|
||||
if (status && (status.message || this.showEmpty)) {
|
||||
this.newStatuses[status.userId] = status;
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user