✨ 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:
@@ -74,6 +74,9 @@ export default {
|
|||||||
if (this.options.users.length > 100) return this.options.users.slice(0, 100);
|
if (this.options.users.length > 100) return this.options.users.slice(0, 100);
|
||||||
return this.options.users;
|
return this.options.users;
|
||||||
},
|
},
|
||||||
|
showEmpty() {
|
||||||
|
return !!this.options.showEmpty;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -119,6 +122,7 @@ export default {
|
|||||||
const newStatuses = {};
|
const newStatuses = {};
|
||||||
Object.values(statuses).forEach((status) => {
|
Object.values(statuses).forEach((status) => {
|
||||||
if (!this.users.includes(status.userId)) return;
|
if (!this.users.includes(status.userId)) return;
|
||||||
|
if (!status.message && !this.showEmpty) return;
|
||||||
newStatuses[status.userId] = status;
|
newStatuses[status.userId] = status;
|
||||||
});
|
});
|
||||||
this.statuses = newStatuses;
|
this.statuses = newStatuses;
|
||||||
@@ -126,7 +130,7 @@ export default {
|
|||||||
processStatus(response) {
|
processStatus(response) {
|
||||||
const raw = this.validateResponse(response);
|
const raw = this.validateResponse(response);
|
||||||
const status = Array.isArray(raw) && raw.length ? raw[0] : raw;
|
const status = Array.isArray(raw) && raw.length ? raw[0] : raw;
|
||||||
if (status) {
|
if (status && (status.message || this.showEmpty)) {
|
||||||
this.newStatuses[status.userId] = status;
|
this.newStatuses[status.userId] = status;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user