feat: Add support for isFederate option for rooms
This commit is contained in:
parent
c464032855
commit
b962e8288b
|
|
@ -790,6 +790,7 @@ class Client extends MatrixApi {
|
|||
HistoryVisibility? historyVisibility,
|
||||
bool waitForSync = true,
|
||||
bool groupCall = false,
|
||||
bool federated = true,
|
||||
Map<String, dynamic>? powerLevelContentOverride,
|
||||
}) async {
|
||||
enableEncryption ??=
|
||||
|
|
@ -824,6 +825,7 @@ class Client extends MatrixApi {
|
|||
}
|
||||
|
||||
final roomId = await createRoom(
|
||||
creationContent: federated ? null : {'m.federate': false},
|
||||
invite: invite,
|
||||
preset: preset,
|
||||
name: groupName,
|
||||
|
|
|
|||
|
|
@ -1347,6 +1347,10 @@ class Room {
|
|||
@Deprecated('Use fullyRead marker')
|
||||
String? get userFullyReadMarker => fullyRead;
|
||||
|
||||
bool get isFederated =>
|
||||
getState(EventTypes.RoomCreate)?.content.tryGet<bool>('m.federate') ??
|
||||
true;
|
||||
|
||||
/// Sets the position of the read marker for a given room, and optionally the
|
||||
/// read receipt's location.
|
||||
/// If you set `public` to false, only a private receipt will be sent. A private receipt is always sent if `mRead` is set. If no value is provided, the default from the `client` is used.
|
||||
|
|
|
|||
|
|
@ -778,6 +778,19 @@ void main() {
|
|||
expect(timeline.events.length, 17);
|
||||
});
|
||||
|
||||
test('isFederated', () {
|
||||
expect(room.isFederated, true);
|
||||
room.setState(
|
||||
StrippedStateEvent(
|
||||
type: EventTypes.RoomCreate,
|
||||
content: {'m.federate': false},
|
||||
senderId: room.client.userID!,
|
||||
stateKey: '',
|
||||
),
|
||||
);
|
||||
expect(room.isFederated, false);
|
||||
});
|
||||
|
||||
test('getUserByMXID', () async {
|
||||
final List<String> called = [];
|
||||
final List<String> called2 = [];
|
||||
|
|
|
|||
Loading…
Reference in New Issue