Fix username in NC is case-insensitive

This commit is contained in:
Ming Ming 2021-09-05 19:13:07 +08:00
parent 1102ffd67c
commit 6fd9ad7bc4
2 changed files with 3 additions and 2 deletions

View file

@ -261,7 +261,7 @@ class ListAlbumBloc extends Bloc<ListAlbumBlocEvent, ListAlbumBlocState> {
final items = albums.map((e) {
final isSharedByMe = shares.any((element) =>
element.path.trimAny("/") == e.albumFile!.strippedPath);
final isSharedToMe = e.albumFile!.ownerId != ev.account.username;
final isSharedToMe = !e.albumFile!.isOwned(ev.account.username);
return ListAlbumBlocItem(e, isSharedByMe, isSharedToMe);
}).toList();

View file

@ -461,7 +461,8 @@ extension FileExtension on File {
}
}
bool isOwned(String username) => ownerId == null || ownerId == username;
bool isOwned(String username) =>
ownerId == null || ownerId?.toLowerCase() == username.toLowerCase();
static final _log = Logger("entity.file.FileExtension");
}