Refactor HideFromUser to use init and enhance DeepClone with optional hide state adjustment

This commit is contained in:
Thorsten Sommer 2025-07-10 20:49:28 +02:00
parent 32757989e8
commit 93650c9d7c
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -28,14 +28,14 @@ public class ContentBlock
/// <summary>
/// Should the content block be hidden from the user?
/// </summary>
public bool HideFromUser { get; set; }
public bool HideFromUser { get; init; }
public ContentBlock DeepClone() => new()
public ContentBlock DeepClone(bool changeHideState = false, bool hideFromUser = true) => new()
{
Time = this.Time,
ContentType = this.ContentType,
Content = this.Content?.DeepClone(),
Role = this.Role,
HideFromUser = this.HideFromUser,
HideFromUser = changeHideState ? hideFromUser : this.HideFromUser,
};
}