Merge branch 'soru/slug-suggestions' into 'main'

feat: Also suggest username completions based on their slugs

See merge request famedly/fluffychat!450
This commit is contained in:
Krille Fear 2021-07-22 07:27:26 +00:00
commit 2943a6c8b1
3 changed files with 6 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter/services.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:slugify/slugify.dart';
import 'avatar.dart';
import 'matrix.dart';
@ -110,7 +111,9 @@ class InputBar extends StatelessWidget {
final userSearch = userMatch[1].toLowerCase();
for (final user in room.getParticipants()) {
if ((user.displayName != null &&
user.displayName.toLowerCase().contains(userSearch)) ||
(user.displayName.toLowerCase().contains(userSearch) ||
slugify(user.displayName.toLowerCase())
.contains(userSearch))) ||
user.id.split(':')[0].toLowerCase().contains(userSearch)) {
ret.add({
'type': 'user',

View File

@ -1111,7 +1111,7 @@ packages:
source: sdk
version: "0.0.99"
slugify:
dependency: transitive
dependency: "direct main"
description:
name: slugify
url: "https://pub.dartlang.org"

View File

@ -64,6 +64,7 @@ dependencies:
scroll_to_index: ^2.0.0
sentry: ^5.1.0
share: ^2.0.4
slugify: ^2.0.0
swipe_to_action: ^0.2.0
uni_links: ^0.5.1
unifiedpush: ^1.0.6