Software /
code /
prosody
Comparison
plugins/mod_storage_internal.lua @ 10842:5a6ba2f38e2b
mod_storage_internal: Fix keeping old timestamp in archive map API
This led to a missing 'when' field on changed items, which would cause a
traceack.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 15 May 2020 20:55:22 +0200 |
parent | 10837:f23363380599 |
child | 10844:05f4386c846e |
comparison
equal
deleted
inserted
replaced
10841:22f783d80eec | 10842:5a6ba2f38e2b |
---|---|
232 for i = 1, #items do | 232 for i = 1, #items do |
233 local old_item = items[i]; | 233 local old_item = items[i]; |
234 if old_item.key == key then | 234 if old_item.key == key then |
235 local item = st.preserialize(st.clone(new_value)); | 235 local item = st.preserialize(st.clone(new_value)); |
236 | 236 |
237 local when = new_when or item.when or datetime.parse(item.attr.stamp); | 237 local when = new_when or old_item.when or datetime.parse(old_item.attr.stamp); |
238 item.key = key; | 238 item.key = key; |
239 item.when = when; | 239 item.when = when; |
240 item.with = new_with or old_item.with; | 240 item.with = new_with or old_item.with; |
241 item.attr.stamp = datetime.datetime(when); | 241 item.attr.stamp = datetime.datetime(when); |
242 item.attr.stamp_legacy = datetime.legacy(when); | 242 item.attr.stamp_legacy = datetime.legacy(when); |