mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-24 22:42:33 +01:00
fix: mxid validation
This commit is contained in:
parent
81e706aaf5
commit
25da65f366
@ -99,11 +99,10 @@ class _InvitationSelectionState extends State<InvitationSelection> {
|
|||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
foundProfiles = List<Profile>.from(response.results);
|
foundProfiles = List<Profile>.from(response.results);
|
||||||
if ('@$text'.isValidMatrixId &&
|
if (text.isValidMatrixId &&
|
||||||
foundProfiles.indexWhere((profile) => '@$text' == profile.userId) ==
|
foundProfiles.indexWhere((profile) => text == profile.userId) == -1) {
|
||||||
-1) {
|
|
||||||
setState(() => foundProfiles = [
|
setState(() => foundProfiles = [
|
||||||
Profile.fromJson({'user_id': '@$text'}),
|
Profile.fromJson({'user_id': text}),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
final participants = room
|
final participants = room
|
||||||
|
@ -51,11 +51,14 @@ class _NewPrivateChatState extends State<NewPrivateChat> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void searchUserWithCoolDown(BuildContext context, String text) async {
|
void searchUserWithCoolDown(BuildContext context) async {
|
||||||
|
if (controller.text.startsWith('@')) {
|
||||||
|
controller.text = controller.text.substring(1);
|
||||||
|
}
|
||||||
coolDown?.cancel();
|
coolDown?.cancel();
|
||||||
coolDown = Timer(
|
coolDown = Timer(
|
||||||
Duration(seconds: 1),
|
Duration(seconds: 1),
|
||||||
() => searchUser(context, text),
|
() => searchUser(context, controller.text),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,8 +102,7 @@ class _NewPrivateChatState extends State<NewPrivateChat> {
|
|||||||
controller: controller,
|
controller: controller,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
onChanged: (String text) =>
|
onChanged: (String text) => searchUserWithCoolDown(context),
|
||||||
searchUserWithCoolDown(context, text),
|
|
||||||
textInputAction: TextInputAction.go,
|
textInputAction: TextInputAction.go,
|
||||||
onFieldSubmitted: (s) => submitAction(context),
|
onFieldSubmitted: (s) => submitAction(context),
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user