From f11fe491349854526f8d13e8b62458baeb3b23b6 Mon Sep 17 00:00:00 2001 From: "Emma [it/its]@Rory&" Date: Fri, 9 Feb 2024 16:30:49 +0100 Subject: Consistently use EventId for event types --- .../Spec/State/Policy/PolicyRuleStateEventContent.cs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'LibMatrix.EventTypes/Spec/State/Policy') diff --git a/LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs b/LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs index 5cc5957..6006048 100644 --- a/LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs +++ b/LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs @@ -29,9 +29,7 @@ public class RoomPolicyRuleEventContent : PolicyRuleEventContent { } public abstract class PolicyRuleEventContent : EventContent { - public PolicyRuleEventContent() { - Console.WriteLine($"init policy {GetType().Name}"); - } + public PolicyRuleEventContent() => Console.WriteLine($"init policy {GetType().Name}"); private string? _reason; /// @@ -42,25 +40,23 @@ public abstract class PolicyRuleEventContent : EventContent { [FriendlyName(Name = "Entity")] public string? Entity { get; set; } - private bool init; + /// /// Reason this user is banned /// [JsonPropertyName("reason")] [FriendlyName(Name = "Reason")] public virtual string? Reason { - get { + get => // Console.WriteLine($"Read policy reason: {_reason}"); - return _reason; - } - set { + _reason; + set => // Console.WriteLine($"Set policy reason: {value}"); // if(init) - // Console.WriteLine(string.Join('\n', Environment.StackTrace.Split('\n')[..5])); + // Console.WriteLine(string.Join('\n', Environment.StackTrace.Split('\n')[..5])); // init = true; _reason = value; - } } /// @@ -86,7 +82,7 @@ public abstract class PolicyRuleEventContent : EventContent { public DateTime? ExpiryDateTime { get => Expiry == null ? null : DateTimeOffset.FromUnixTimeMilliseconds(Expiry.Value).DateTime; set { - if(value is not null) + if (value is not null) Expiry = ((DateTimeOffset)value).ToUnixTimeMilliseconds(); } } -- cgit 1.4.1