Ensure retained status is keep to restore ephemeral status

pull/5331/head
GogoVega 2025-10-27 16:55:20 +01:00
parent 720a1ef532
commit ac2f0e8d98
No known key found for this signature in database
GPG Key ID: E1E048B63AC5AC2B
1 changed files with 6 additions and 1 deletions

View File

@ -56,9 +56,14 @@ function handleStatusEvent(event) {
let retain = true;
if (event.status.ephemeral === true) {
retain = false;
status._retainedStatus = retained["status/" + event.id] || {};
status._retainedStatus = retained["status/" + event.id];
}
publish("status/" + event.id, status, retain);
if (status._retainedStatus) {
// publish will delete the retained status if retain is false
// Need to keep this status to restore ephemeral statuses
retained["status/" + event.id] = status._retainedStatus;
}
}
}
function handleRuntimeEvent(event) {