blob: 3b18b95aeeb18507a6533c2b4fc0fde3996e879b (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
@using ArcaneLibs.Extensions
@using LibMatrix.EventTypes.Spec.State
@using LibMatrix.Responses
@inherits BaseTimelineItem
@if (roomMemberData is not null) {
@switch (roomMemberData.Membership) {
case "ban":
<i>@Event.StateKey was banned</i>
break;
case "invite":
<i>@Event.StateKey was invited</i>
break;
case "join" when Event.ReplacesState is not null:
<i>@Event.StateKey changed their display name to @(roomMemberData.DisplayName ?? Event.Sender)</i>
break;
case "join":
@if (prevRoomMemberData is null) {
<i><InlineUserItem User="@(new UserProfileResponse() { DisplayName = roomMemberData.DisplayName, AvatarUrl = roomMemberData.AvatarUrl })" Homeserver="@Homeserver" UserId="@Event.StateKey"></InlineUserItem> joined</i>
}
else {
<i><InlineUserItem User="@(new UserProfileResponse() { DisplayName = prevRoomMemberData.DisplayName, AvatarUrl = prevRoomMemberData.AvatarUrl })" Homeserver="@Homeserver" UserId="@Event.StateKey"></InlineUserItem> changed their profile to <InlineUserItem User="@(new UserProfileResponse() { DisplayName = roomMemberData.DisplayName, AvatarUrl = roomMemberData.AvatarUrl })" Homeserver="@Homeserver" UserId="@Event.StateKey"></InlineUserItem></i>
}
break;
case "leave":
<i>@Event.StateKey left</i>
break;
case "knock":
<i>@Event.StateKey knocked</i>
break;
default:
<i>@Event.StateKey has an unknown state:</i>
<pre>
@Event.ToJson()
</pre>
break;
}
}
else {
<details>
<summary>Unknown membership event for @Event.StateKey</summary>
<pre>
@Event.ToJson()
</pre>
</details>
}
@code {
private RoomMemberEventContent? roomMemberData => Event.TypedContent as RoomMemberEventContent;
private RoomMemberEventContent? prevRoomMemberData => PreviousState?.TypedContent as RoomMemberEventContent;
}
|