add support for publishing rooms to the room directory

Part of #134
This commit is contained in:
Henry Hiles 2026-11-03 17:50:26 -05:00
commit ecc4618ccd
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -10,6 +10,7 @@ import "package:nexus/controllers/power_level.dart";
import "package:nexus/controllers/power_levels_saving.dart";
import "package:nexus/controllers/room_image_packs.dart";
import "package:nexus/controllers/room_power_levels.dart";
import "package:nexus/controllers/room_published.dart";
import "package:nexus/controllers/rooms.dart";
import "package:nexus/controllers/space_edges.dart";
import "package:nexus/helpers/extensions/join_rule_name.dart";
@ -555,6 +556,39 @@ class RoomSettingsSectionsController(final String roomId)
: null,
),
),
.new(
title: "Publish to Room Directory",
description: "List the room in your homeserver's directory.",
icon: Icons.travel_explore,
builder: (title, description, icon) => HookConsumer(
builder: (context, ref, _) {
final saving = Saving.use();
final published = ref.watch(
RoomPublishedController.provider(roomId),
);
return SwitchListTile(
secondary: Icon(icon),
title: Text(title),
subtitle: Text(description),
value: published.value ?? false,
onChanged:
canSetAliases && published.hasValue && !saving.active
? (value) => saving.run(
() => ref
.read(
RoomPublishedController.provider(
roomId,
).notifier,
)
.set(value)
.onError(showError),
)
: null,
);
},
),
),
]),
),
.new(