blob: c7bfd515f8549d11bef5a9c2dc64734efdcaabd3 (
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
|
@using LibMatrix
@using LibMatrix.EventTypes.Spec.State
@using LibMatrix.Responses
<h3>BaseTimelineItem</h3>
@code {
[Parameter]
public StateEventResponse Event { get; set; }
[Parameter]
public List<StateEventResponse> Events { get; set; }
[Parameter]
public AuthenticatedHomeserverGeneric Homeserver { get; set; }
public List<StateEventResponse> EventsBefore => Events.TakeWhile(e => e.EventId != Event.EventId).ToList();
public List<StateEventResponse> MatchingEventsBefore => EventsBefore.Where(x => x.Type == Event.Type && x.StateKey == Event.StateKey).ToList();
public StateEventResponse? PreviousState => MatchingEventsBefore.LastOrDefault();
public RoomMemberEventContent? CurrentSenderMemberEventContent => EventsBefore.LastOrDefault(x => x.Type == "m.room.member" && x.StateKey == Event.Sender)?
.TypedContent as RoomMemberEventContent;
public UserProfileResponse CurrentSenderProfile => new() { DisplayName = CurrentSenderMemberEventContent?.DisplayName, AvatarUrl = CurrentSenderMemberEventContent?.AvatarUrl };
public bool HasPreviousMessage => EventsBefore.Last() is { Type: "m.room.message" } response && response.Sender == Event.Sender;
}
|