about summary refs log tree commit diff
path: root/MatrixUtils.Web/Shared/TimelineComponents/TimelineCanonicalAliasItem.razor
blob: 12134326cc58ee08b44954f58715134c9b72c565 (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 alias to "@currentEventContent.Alias"</i>
    }
    else {
        <i><InlineUserItem User="@CurrentSenderProfile" Homeserver="@Homeserver" UserId="@Event.StateKey"></InlineUserItem> changed the room name from "@previousEventContent.Alias" to "@currentEventContent.Alias"</i>
    }
}
else {
    <details>
        <summary>Unknown event @Event.Type (@Event.StateKey)</summary>
        <pre>
            @Event.ToJson()
        </pre>
    </details>
}

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

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