Skip to content

Synchronize operation on live photo files - #41765

Merged
artonge merged 1 commit into
masterfrom
artonge/feat/sync_live_photos
Nov 30, 2023
Merged

Synchronize operation on live photo files#41765
artonge merged 1 commit into
masterfrom
artonge/feat/sync_live_photos

Conversation

@artonge

@artongeartonge commented Nov 27, 2023

Copy link
Copy Markdown
Collaborator

This PR adds automatic management of live photos. This means that both file of a live photo will be kept in sync, if they are renamed, moved, or deleted.

A few extra changes were needed:

  • I create a BeforeNodeRestoredEvent event to react to restore action from the trashbin
  • I created NodeRestoredEvent, for completeness.
  • Both are emitted from apps/files_trashbin/lib/Trashbin.php
  • I added an abortOperation method in both BeforeNodeDeletedEvent and BeforeNodeRenamedEvent to allow an event listener to abort the operation.

@artongeartonge changed the title WIPSynchronize operation on live photo filesNov 27, 2023
@artongeartonge self-assigned this Nov 27, 2023
@artongeartonge added this to the Nextcloud 28 milestone Nov 27, 2023
@artongeartonge added 2. developing Work in progress feature: files php Pull requests that update Php code labels Nov 27, 2023
@artonge

Copy link
Copy Markdown
CollaboratorAuthor

/backport to stable28

Comment threadapps/files/lib/Listener/SyncLivePhotosListener.php Fixed
@blizzzblizzz mentioned this pull request Nov 28, 2023
3 tasks
@artonge
artongeforce-pushed the artonge/feat/sync_live_photos branch from 56e501c to 3c03c96CompareNovember 29, 2023 17:02
@artonge
artonge marked this pull request as ready for review November 29, 2023 17:05
Comment threadapps/files/lib/Listener/SyncLivePhotosListener.php Fixed
Comment threadapps/files/lib/Listener/SyncLivePhotosListener.php Fixed
Comment threadapps/files/lib/Listener/SyncLivePhotosListener.php Fixed
Comment threadapps/files_trashbin/lib/Events/BeforeNodeRestored.php Fixed
$view->chroot($fakeRoot);
\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename),
'trashPath' => Filesystem::normalizePath($file)]);
\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => $targetPath, 'trashPath' => $sourcePath]);

Check notice

Code scanning / Psalm

DeprecatedMethod

The method OCP\Util::emitHook has been marked as deprecated
Comment threadapps/files_trashbin/lib/Trashbin.php Fixed
Comment threadapps/files_trashbin/lib/Trashbin.php Fixed
@artonge
artongeforce-pushed the artonge/feat/sync_live_photos branch 3 times, most recently from de8842d to fe81619CompareNovember 29, 2023 17:28
Comment threadapps/files_trashbin/lib/Events/BeforeNodeRestored.php Fixed
Comment threadlib/public/Files/Events/Node/BeforeNodeDeletedEvent.php Fixed
Comment threadlib/public/Files/Events/Node/BeforeNodeRenamedEvent.php Fixed
Comment threadapps/files/lib/Listener/SyncLivePhotosListener.php Fixed
Comment threadapps/files/lib/Listener/SyncLivePhotosListener.php Fixed
Comment threadapps/files_trashbin/lib/Trashbin.php Fixed
Comment threadapps/files_trashbin/lib/Trashbin.php Fixed
Comment threadapps/files_trashbin/lib/Trashbin.php Fixed
@artonge
artongeforce-pushed the artonge/feat/sync_live_photos branch from fe81619 to 8e45909CompareNovember 29, 2023 17:31
Comment threadapps/dav/lib/Connector/Sabre/FilesPlugin.php
@artonge
artongeforce-pushed the artonge/feat/sync_live_photos branch 5 times, most recently from 35bf478 to 0f5b386CompareNovember 29, 2023 18:05
Signed-off-by: Louis Chemineau <louis@chmn.me>
@artonge
artongeforce-pushed the artonge/feat/sync_live_photos branch from 0f5b386 to 2f6a4bfCompareNovember 29, 2023 18:07
@artongeartonge added the pending documentation This pull request needs an associated documentation update label Nov 29, 2023
Comment threadapps/files/lib/Listener/SyncLivePhotosListener.php
Comment threadapps/files/lib/Listener/SyncLivePhotosListener.php

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add cypress tests

@artongeartongeNov 30, 2023

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validate logic with what's expected by the user, and add it as a comment

@ArtificialOwlArtificialOwl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐘

@artonge
artonge merged commit bdc7c64 into masterNov 30, 2023
@artonge
artonge deleted the artonge/feat/sync_live_photos branch November 30, 2023 09:33
@blizzzblizzz modified the milestones: Nextcloud 28, Nextcloud 29Nov 30, 2023
@blizzz

Copy link
Copy Markdown
Member

fixed milestone. master is 29.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developingWork in progressfeature: filespending documentationThis pull request needs an associated documentation updatephpPull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🖼️🔄️ Synchronization of the two files

5 participants

@artonge@blizzz@ArtificialOwl@AndyScherzinger@github-advanced-security