about summary refs log tree commit diff
path: root/MatrixUtils.Web/Shared/TimelineComponents/TimelineRoomNameItem.razor
blob: 63594a9f8a5b7c17e12ec21878f2a5b97494d21e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
@using ArcaneLibs.Extensions
@using LibMatrix.EventTypes.Spec.State
@inherits BaseTimelineItem

@if (currentEventContent is not null) {
    @if (previousEventContent is null) {
        <i><InlineUserItem User="@CurrentSenderProfile" Homeserver="@Homeserver" UserId="@Event.StateKey"></InlineUserItem> set the room name to "@currentEventContent.Name"</i>
    }
    else {
        <i><InlineUserItem User="@CurrentSenderProfile" Homeserver="@Homeserver" UserId="@Event.StateKey"></InlineUserItem> changed the room name from "@previousEventContent.Name" to "@currentEventContent.Name"</i>
    }
}
else {
    <details>
        <summary>Unknown event @Event.Type (@Event.StateKey)</summary>
        <pre>
            @Event.ToJson()
        </pre>
    </details>
}

@code {
    private RoomNameEventContent? previousEventContent => PreviousState?.TypedContent as RoomNameEventContent;

    private RoomNameEventContent? currentEventContent => Event.TypedContent as RoomNameEventContent;
}