server icon indicating copy to clipboard operation
server copied to clipboard

Allow to name a version

Open artonge opened this issue 3 years ago • 11 comments

Done

  • [x] Add web UI to name and delete a version
  • [x] Create oc_files_versions table with id, file_id?, version_id, metadata metadata = JSON
  • [x] Update version lookup logic to:
    1. Look into DB
    2. If nothing, look into FS, then load all info in DB
  • [x] Add entry DB when creating new version
  • [x] Delete DB entries on file deletion
  • [x] Plug into DAV plugin
    • [x] Support getting the version label
    • [x] Support patching the version label
    • [x] Expose endpoint to delete a version
  • [x] Remove experimental flag on UI
  • [x] Check concurrence issue when initializing entries for a file in the DB - added unique index to prevent duplicate <fileId, timestamp> tuples
  • [x] Add version labeling capability
    • [x] Add config switch to disable capability
    • [x] Propagate capability to web UI
    • [x] Limit UI functionality
  • [x] Disable cleanup of named version in files_versions/lib/Storage.php
  • [x] Create new interface for nameable version backend
  • [x] Check that it does not explode with files_versions_S3 and groupfolders implementation as Carl raise some concerns

TODO

  • [ ] Write documentation about labeling and deleting version config switch

Follow up

  • [ ] Use COPY instead of MOVE when restoring version, so that it stays in the history (if not already the case)
  • [ ] Load versions sidebar tab when clicking on the tab
  • [ ] Save author of file creation and modification
  • [ ] Implement deletion and labeling in files_versions_S3 and groupfolders

Screenshots

Context Screenshot
List of version with the actions menu opened for the current version Screenshot from 2022-11-30 11-02-02
List of version with the actions menu opened for a previous version Screenshot from 2022-11-30 11-02-08
Name editor when the version do have a name Screenshot from 2022-11-16 14-52-17
Name editor when the version does not have a name Screenshot from 2022-11-16 14-52-08
Restore notification for un-named version Screenshot from 2022-11-30 11-03-46
Restore notification for named version Screenshot from 2022-11-30 11-03-30
Restore notification for initial version Screenshot from 2022-11-30 11-03-26

Screencast

Screencast from 2022-11-21 17-36-10.webm

Need https://github.com/nextcloud/server/pull/34769

artonge avatar Nov 14 '22 17:11 artonge

Checkout S3 [...] implementation as Carl raise some concerns

Yeah, since automatic expiration of versions is handled by the S3 platform itself, oc_files_versions will reference non-existing versions. Maybe there's a way to set a flag on objects on S3's side to avoid the expiration for the named versions?

tcitworld avatar Nov 14 '22 18:11 tcitworld

Checkout S3 and group folders implementation as Carl raise some concerns

cc @mejo- as I remember there also was a groupfolder-like version backend in collectives.

juliusknorr avatar Nov 14 '22 21:11 juliusknorr

regarding S3, this would only be handled in S3 if the app https://github.com/nextcloud/files_versions_s3 idea: we could disable the permanent version feature when this app is enabled to avoid unwanted side effects

PVince81 avatar Nov 15 '22 07:11 PVince81

we will also need to figure out how to backfill old versions that existed before this feature probably we just do it on-demand because scanning all files would take a while

on-demand would mean that if there are no entries in the table for a given file id, we check on disk and do a one-shot scan to populate the table for said file id

PVince81 avatar Nov 15 '22 07:11 PVince81

we will also need to figure out how to backfill old versions that existed before this feature

How about we keep the current logic and only use the table to store versions with a name ? Then we just populate the versions with their name.

Something like:

versions = existingLogicToGetVersionsFor(fileId)
namedVersions = newLogicToGetNamedVersionsFor(fileId) // so we just add this line
versions = merge(version, namedVersions) // and this line
return versions

In practice:

https://github.com/nextcloud/server/pull/35160/files#diff-e50e572ada0663901e21009299b02a8627937be7a783ff080c4e29ef550a997aR75-R86

artonge avatar Nov 15 '22 11:11 artonge

After discussion, let's load all data about a version on demand, ie. when the user opens the sidebar or during expiration. Need to check concurrence issue when initing entries for a file.

artonge avatar Nov 16 '22 16:11 artonge

Changed base to include https://github.com/nextcloud/server/pull/35080 as discussed

artonge avatar Nov 23 '22 13:11 artonge

  • [x] Server installation is failing. Apparently, having a hook that require $userFolder is not possible.

artonge avatar Nov 30 '22 16:11 artonge

  • [x] Unit tests are failing now because of hooks not being wired up correctly

artonge avatar Dec 01 '22 16:12 artonge

@skjnldsv I could need a review on the cypress part, to harmonize it with your initial work. I also tweaked the GH action file. Also, if you have time, a review on the front-end part is always welcome :)

artonge avatar Dec 22 '22 09:12 artonge

/rebase

artonge avatar Dec 27 '22 15:12 artonge

some points:

  • [x] frontend: undefined as name of the version when creating a new file,
  • [ ] backend: might be interesting to store in the table the fileId of the version/backup file

ArtificialOwl avatar Jan 19 '23 11:01 ArtificialOwl

/rebase

artonge avatar Jan 26 '23 10:01 artonge

hello @artonge Thank you so much for your work on this pull request! This ticket seems to have the tag 'pending documentation'. Is there any chance you could clarify what documentation is missing? Is this for admins or for app developers?

DaphneMuller avatar Feb 21 '23 13:02 DaphneMuller

Did the admin one, but forgot the user doc

Admin: https://github.com/nextcloud/documentation/pull/9618 User: https://github.com/nextcloud/documentation/pull/9649

artonge avatar Feb 21 '23 14:02 artonge