forked from Henry-Hiles/nexus
Working mentions
This commit is contained in:
parent
75be47554f
commit
6cc5971919
2 changed files with 11 additions and 6 deletions
|
|
@ -86,7 +86,8 @@ class RoomChatController extends AsyncNotifier<ChatController> {
|
||||||
await client.getRoomState(
|
await client.getRoomState(
|
||||||
GetRoomStateRequest(
|
GetRoomStateRequest(
|
||||||
roomId: roomId,
|
roomId: roomId,
|
||||||
fetchMembers: room.metadata?.hasMemberList == false,
|
fetchMembers: true,
|
||||||
|
includeMembers: false,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -182,9 +183,7 @@ class RoomChatController extends AsyncNotifier<ChatController> {
|
||||||
|
|
||||||
taggedMessage = taggedMessage.replaceAllMapped(
|
taggedMessage = taggedMessage.replaceAllMapped(
|
||||||
pattern,
|
pattern,
|
||||||
(match) => match.group(
|
(match) => match.group(1)!,
|
||||||
1,
|
|
||||||
)!, // TODO: Return an HTML or Markdown link from here, not plaintext
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -192,7 +191,13 @@ class RoomChatController extends AsyncNotifier<ChatController> {
|
||||||
client.sendMessage(
|
client.sendMessage(
|
||||||
SendMessageRequest(
|
SendMessageRequest(
|
||||||
roomId: roomId,
|
roomId: roomId,
|
||||||
mentions: Mentions(), // TODO: Add parsed mentions
|
mentions: Mentions(
|
||||||
|
userIds: [
|
||||||
|
if (relation != null && relationType == RelationType.reply)
|
||||||
|
relation.authorId,
|
||||||
|
].toIList(),
|
||||||
|
room: taggedMessage.contains("@room"),
|
||||||
|
),
|
||||||
text: taggedMessage,
|
text: taggedMessage,
|
||||||
relation: relation == null
|
relation: relation == null
|
||||||
? null
|
? null
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ class MentionOverlay extends ConsumerWidget {
|
||||||
member.authorId,
|
member.authorId,
|
||||||
),
|
),
|
||||||
onTap: () => addTag(
|
onTap: () => addTag(
|
||||||
id: member.authorId,
|
id: "[@${member.content["displayname"]}](https://matrix.to/#/${member.authorId})",
|
||||||
name: member.authorId
|
name: member.authorId
|
||||||
.substring(1)
|
.substring(1)
|
||||||
.split(":")
|
.split(":")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue