mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-24 18:38:48 +01:00
Convenient fn to check file owner
This commit is contained in:
parent
002ede3392
commit
dc5d6a4a8d
2 changed files with 4 additions and 4 deletions
|
@ -415,6 +415,8 @@ extension FileExtension on File {
|
|||
lastModified ??
|
||||
DateTime.now().toUtc();
|
||||
}
|
||||
|
||||
bool isOwned(String username) => ownerId == null || ownerId == username;
|
||||
}
|
||||
|
||||
class FileRepo {
|
||||
|
|
|
@ -586,8 +586,7 @@ class _AlbumViewerState extends State<AlbumViewer>
|
|||
zip([_getAlbumItemsOf(album), _getAlbumItemsOf(widget.album)]).map((e) {
|
||||
if (e[0] is AlbumFileItem) {
|
||||
final item = e[0] as AlbumFileItem;
|
||||
if (item.file.ownerId != null &&
|
||||
item.file.ownerId != widget.account.username) {
|
||||
if (!item.file.isOwned(widget.account.username)) {
|
||||
// don't propagate shared file not owned by this user, this is to
|
||||
// prevent multiple user having different properties to keep
|
||||
// overriding each others
|
||||
|
@ -623,8 +622,7 @@ class _AlbumViewerState extends State<AlbumViewer>
|
|||
final a = z[0], b = z[1];
|
||||
bool isEqual;
|
||||
if (a is AlbumFileItem && b is AlbumFileItem) {
|
||||
if (a.file.ownerId != null &&
|
||||
a.file.ownerId != widget.account.username) {
|
||||
if (!a.file.isOwned(widget.account.username)) {
|
||||
// ignore shared files
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue