mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-01-11 10:12:49 +01:00
chore: FIx first story invite
This commit is contained in:
parent
eeb545e24a
commit
fb48da8e0e
@ -31,11 +31,16 @@ class _InviteStoryPageState extends State<InviteStoryPage> {
|
||||
context: context,
|
||||
future: () async {
|
||||
final client = Matrix.of(context).client;
|
||||
final room = await client.getStoriesRoom(context);
|
||||
var room = await client.getStoriesRoom(context);
|
||||
final inviteList = _invite.toList();
|
||||
if (room == null) {
|
||||
await client.createStoriesRoom(_invite.toList());
|
||||
} else {
|
||||
for (final userId in _invite) {
|
||||
room = await client.createStoriesRoom(inviteList.take(10).toList());
|
||||
if (inviteList.length > 10) {
|
||||
inviteList.removeRange(0, 10);
|
||||
} else {
|
||||
inviteList.clear();
|
||||
}
|
||||
for (final userId in inviteList) {
|
||||
room.invite(userId);
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ extension ClientStoriesExtension on Client {
|
||||
{'users': users},
|
||||
);
|
||||
|
||||
Future<void> createStoriesRoom([List<String>? invite]) async {
|
||||
Future<Room> createStoriesRoom([List<String>? invite]) async {
|
||||
final roomId = await createRoom(
|
||||
creationContent: {"type": "msc3588.stories.stories-room"},
|
||||
preset: CreateRoomPreset.privateChat,
|
||||
@ -68,6 +68,7 @@ extension ClientStoriesExtension on Client {
|
||||
await onSync.stream
|
||||
.firstWhere((sync) => sync.rooms?.join?.containsKey(roomId) ?? false);
|
||||
}
|
||||
return getRoomById(roomId)!;
|
||||
}
|
||||
|
||||
Future<Room?> getStoriesRoom(BuildContext context) async {
|
||||
|
Loading…
Reference in New Issue
Block a user