mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-02 14:56:20 +01:00
Act according to album content instead of the pref flag
This commit is contained in:
parent
f384c6483f
commit
35e49c2bfd
3 changed files with 4 additions and 11 deletions
|
@ -52,7 +52,7 @@ class AddToAlbum {
|
|||
);
|
||||
await UpdateAlbum(albumRepo)(account, newAlbum);
|
||||
|
||||
if (pref.isLabEnableSharedAlbumOr(false)) {
|
||||
if (album.shares?.isNotEmpty == true) {
|
||||
final newFiles =
|
||||
items.whereType<AlbumFileItem>().map((e) => e.file).toList();
|
||||
if (newFiles.isNotEmpty) {
|
||||
|
@ -65,9 +65,6 @@ class AddToAlbum {
|
|||
|
||||
Future<void> _shareFiles(
|
||||
Account account, Album album, List<File> files) async {
|
||||
if (album.shares?.isNotEmpty != true) {
|
||||
return;
|
||||
}
|
||||
final albumShares = (album.shares!.map((e) => e.userId).toList()
|
||||
..add(album.albumFile!.ownerId ?? account.username))
|
||||
.where((element) => element != account.username)
|
||||
|
|
|
@ -19,7 +19,7 @@ class RemoveAlbum {
|
|||
/// Remove an album
|
||||
Future<void> call(Account account, Album album) async {
|
||||
_log.info("[call] Remove album: $album");
|
||||
if (pref.isLabEnableSharedAlbumOr(false)) {
|
||||
if (album.shares?.isNotEmpty == true) {
|
||||
// remove shares from the album json. This should be the first so if this
|
||||
// fail the whole op can fail safely
|
||||
await UpdateAlbum(albumRepo)(
|
||||
|
@ -39,8 +39,7 @@ class RemoveAlbum {
|
|||
}
|
||||
|
||||
Future<void> _unshareFiles(Account account, Album album) async {
|
||||
if (album.shares?.isNotEmpty != true ||
|
||||
album.provider is! AlbumStaticProvider) {
|
||||
if (album.provider is! AlbumStaticProvider) {
|
||||
return;
|
||||
}
|
||||
final albumShares = (album.shares!.map((e) => e.userId).toList()
|
||||
|
|
|
@ -38,7 +38,7 @@ class RemoveFromAlbum {
|
|||
newAlbum = await _fixAlbumPostRemove(account, newAlbum, items);
|
||||
await UpdateAlbum(albumRepo)(account, newAlbum);
|
||||
|
||||
if (pref.isLabEnableSharedAlbumOr(false)) {
|
||||
if (album.shares?.isNotEmpty == true) {
|
||||
final removeFiles =
|
||||
items.whereType<AlbumFileItem>().map((e) => e.file).toList();
|
||||
if (removeFiles.isNotEmpty) {
|
||||
|
@ -89,9 +89,6 @@ class RemoveFromAlbum {
|
|||
|
||||
Future<void> _unshareFiles(
|
||||
Account account, Album album, List<File> files) async {
|
||||
if (album.shares?.isNotEmpty != true) {
|
||||
return;
|
||||
}
|
||||
final albumShares = (album.shares!.map((e) => e.userId).toList()
|
||||
..add(album.albumFile!.ownerId ?? account.username))
|
||||
.where((element) => element != account.username)
|
||||
|
|
Loading…
Reference in a new issue