Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/Umbraco.Core/Services/DictionaryItemService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,25 @@ public async Task<Attempt<IDictionaryItem, DictionaryItemOperationStatus>> Creat
/// <inheritdoc />
public async Task<Attempt<IDictionaryItem, DictionaryItemOperationStatus>> UpdateAsync(
IDictionaryItem dictionaryItem, Guid userKey)
=> await SaveAsync(
{
// Create and update dates aren't tracked for dictionary items. They exist on IDictionaryItem due to the
// inheritance from IEntity, but we don't store them.
// However we have logic in ServerEventSender that will provide SignalR events for created and update operations,
// where these dates are used to distinguish between the two (whether or not the entity has an identity cannot
// be used here, as these events fire after persistence when the identity is known for both creates and updates).
// So ensure we set something that can be distinguished here.
if (dictionaryItem.CreateDate == default)
{
dictionaryItem.CreateDate = DateTime.MinValue;
}

if (dictionaryItem.UpdateDate == default)
{
// TODO (V17): To align with updates of system dates, this needs to change to DateTime.UtcNow.
dictionaryItem.UpdateDate = DateTime.Now;
}

return await SaveAsync(
dictionaryItem,
() =>
{
Expand All @@ -174,6 +192,7 @@ public async Task<Attempt<IDictionaryItem, DictionaryItemOperationStatus>> Updat
AuditType.Save,
"Update DictionaryItem",
userKey);
}

/// <inheritdoc />
public async Task<Attempt<IDictionaryItem?, DictionaryItemOperationStatus>> DeleteAsync(Guid id, Guid userKey)
Expand Down