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