mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 14:59:29 +01:00
Merge branch 'soru/join-rooms' into 'main'
fix: Joining room aliases not published into the room directory Closes #514 See merge request famedly/fluffychat!486
This commit is contained in:
commit
68a29007a6
@ -23,7 +23,6 @@ class SearchController extends State<Search> {
|
|||||||
String lastServer;
|
String lastServer;
|
||||||
Timer _coolDown;
|
Timer _coolDown;
|
||||||
String genericSearchTerm;
|
String genericSearchTerm;
|
||||||
String alias;
|
|
||||||
|
|
||||||
void search(String query) async {
|
void search(String query) async {
|
||||||
setState(() => null);
|
setState(() => null);
|
||||||
|
@ -32,21 +32,21 @@ class SearchView extends StatelessWidget {
|
|||||||
genericSearchTerm: controller.genericSearchTerm,
|
genericSearchTerm: controller.genericSearchTerm,
|
||||||
)
|
)
|
||||||
.catchError((error) {
|
.catchError((error) {
|
||||||
if (controller.alias == null) {
|
if (!(controller.genericSearchTerm?.isValidMatrixId ?? false)) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
return PublicRoomsResponse.fromJson({
|
return PublicRoomsResponse.fromJson({
|
||||||
'chunk': [],
|
'chunk': [],
|
||||||
});
|
});
|
||||||
}).then((PublicRoomsResponse res) {
|
}).then((PublicRoomsResponse res) {
|
||||||
if (controller.alias != null &&
|
if (controller.genericSearchTerm != null &&
|
||||||
!res.chunk.any((room) =>
|
!res.chunk.any((room) =>
|
||||||
(room.aliases?.contains(controller.alias) ?? false) ||
|
(room.aliases?.contains(controller.genericSearchTerm) ?? false) ||
|
||||||
room.canonicalAlias == controller.alias)) {
|
room.canonicalAlias == controller.genericSearchTerm)) {
|
||||||
// we have to tack on the original alias
|
// we have to tack on the original alias
|
||||||
res.chunk.add(PublicRoom.fromJson(<String, dynamic>{
|
res.chunk.add(PublicRoom.fromJson(<String, dynamic>{
|
||||||
'aliases': [controller.alias],
|
'aliases': [controller.genericSearchTerm],
|
||||||
'name': controller.alias,
|
'name': controller.genericSearchTerm,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
Reference in New Issue
Block a user