fix: dont allow modification of album order
This commit is contained in:
@@ -172,7 +172,8 @@ class _RemoteAlbumPageState extends ConsumerState<RemoteAlbumPage> {
|
|||||||
Future<void> showOptionSheet(BuildContext context) async {
|
Future<void> showOptionSheet(BuildContext context) async {
|
||||||
final user = ref.watch(currentUserProvider);
|
final user = ref.watch(currentUserProvider);
|
||||||
final isOwner = user != null ? user.id == _album.ownerId : false;
|
final isOwner = user != null ? user.id == _album.ownerId : false;
|
||||||
final canEdit = await ref.read(remoteAlbumUserRoleProvider((_album.id, user!.id)).future) == AlbumUserRole.editor;
|
final canAddPhotos =
|
||||||
|
await ref.read(remoteAlbumUserRoleProvider((_album.id, user!.id)).future) == AlbumUserRole.editor;
|
||||||
|
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -194,16 +195,18 @@ class _RemoteAlbumPageState extends ConsumerState<RemoteAlbumPage> {
|
|||||||
context.pop();
|
context.pop();
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
onAddPhotos: isOwner || canEdit
|
onAddPhotos: isOwner || canAddPhotos
|
||||||
? () async {
|
? () async {
|
||||||
await addAssets(context);
|
await addAssets(context);
|
||||||
context.pop();
|
context.pop();
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
onToggleAlbumOrder: () async {
|
onToggleAlbumOrder: isOwner
|
||||||
await toggleAlbumOrder();
|
? () async {
|
||||||
context.pop();
|
await toggleAlbumOrder();
|
||||||
},
|
context.pop();
|
||||||
|
}
|
||||||
|
: null,
|
||||||
onEditAlbum: isOwner
|
onEditAlbum: isOwner
|
||||||
? () async {
|
? () async {
|
||||||
context.pop();
|
context.pop();
|
||||||
@@ -227,6 +230,9 @@ class _RemoteAlbumPageState extends ConsumerState<RemoteAlbumPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final user = ref.watch(currentUserProvider);
|
||||||
|
final isOwner = user != null ? user.id == _album.ownerId : false;
|
||||||
|
|
||||||
return PopScope(
|
return PopScope(
|
||||||
onPopInvokedWithResult: (didPop, _) {
|
onPopInvokedWithResult: (didPop, _) {
|
||||||
if (didPop) {
|
if (didPop) {
|
||||||
@@ -250,7 +256,7 @@ class _RemoteAlbumPageState extends ConsumerState<RemoteAlbumPage> {
|
|||||||
appBar: RemoteAlbumSliverAppBar(
|
appBar: RemoteAlbumSliverAppBar(
|
||||||
icon: Icons.photo_album_outlined,
|
icon: Icons.photo_album_outlined,
|
||||||
onShowOptions: () => showOptionSheet(context),
|
onShowOptions: () => showOptionSheet(context),
|
||||||
onToggleAlbumOrder: () => toggleAlbumOrder(),
|
onToggleAlbumOrder: isOwner ? () => toggleAlbumOrder() : null,
|
||||||
onEditTitle: () => showEditTitleAndDescription(context),
|
onEditTitle: () => showEditTitleAndDescription(context),
|
||||||
onActivity: () => showActivity(context),
|
onActivity: () => showActivity(context),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user