Skip to content

Commit

Permalink
Merge pull request #38 from dshukertjr/fix/mention
Browse files Browse the repository at this point in the history
fix: mentions will load people in the comments first
  • Loading branch information
dshukertjr authored Aug 23, 2021
2 parents b42f8ca + 5dd6da3 commit 32bc91b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
9 changes: 9 additions & 0 deletions lib/cubits/comment/comment_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ class CommentCubit extends Cubit<CommentState> {
if (mentionedUserName == null) {
emit(CommentsLoaded(_comments));
return;
} else if (mentionedUserName == '@') {
final myUserId = _repository.userId;
final usersInComments = _comments
.where((comment) => comment.user.id != myUserId)
.map((comment) => comment.user)
.take(2)
.toList();
emit(CommentsLoaded(_comments, mentionSuggestions: usersInComments));
return;
}
emit(CommentsLoaded(_comments, isLoadingMentions: true));
final mentionSuggestions = await _repository.getMentions(mentionedUserName);
Expand Down
2 changes: 0 additions & 2 deletions lib/cubits/confirm_video/confirm_video_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import 'package:video_player/video_player.dart';

part 'confirm_video_state.dart';

// ignore_for_file: lines_longer_than_80_chars

class ConfirmVideoCubit extends Cubit<ConfirmVideoState> {
ConfirmVideoCubit({required Repository repository})
: _repository = repository,
Expand Down
4 changes: 2 additions & 2 deletions lib/repositories/repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ class Repository {
final res = await _supabaseClient
.from('users')
.select()
.like('name', '%$queryString%')
.ilike('name', '%$queryString%')
.limit(2)
.execute();
final error = res.error;
Expand Down Expand Up @@ -779,7 +779,7 @@ class Repository {
}
final mentionedUserName = mention.substring(1);
if (mentionedUserName.isEmpty) {
return null;
return '@';
}
return mentionedUserName;
}
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ packages:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
version: "2.0.7"
shared_preferences_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -664,7 +664,7 @@ packages:
name: shared_preferences_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.2"
shared_preferences_windows:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: spot
description: Find local video posts
version: 1.1.7+45
version: 1.1.8+46
publish_to: none

environment:
Expand Down

0 comments on commit 32bc91b

Please sign in to comment.