about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineRoomNameItem.razor
blob: eeec3de7483f3aab7251edb1d708642abfaf2f7a (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
27
@using ArcaneLibs.Extensions
@using LibMatrix.EventTypes.Spec.State
@using LibMatrix.Responses
@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;
}