Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename conflicted not published folder/file on creating/uploading #186

Merged
merged 1 commit into from
Jul 21, 2023

Conversation

yurabakhtin
Copy link
Contributor

Issue: humhub/humhub#6433 (comment)

In the case of the File module you are right.
Probably we should change the handling here. So if a file is in status Pending/Soft Deletion and in the meantime a new file with the same filename is uploaded, we could also rename the deleted file e.g. from "test.doc" to "conflict[fileid]-test.doc". (Same for other modules)
This would also solves some other problems (e.g. OnlyOffice module ONLYOFFICE/onlyoffice-humhub#100)

Ok, as I understood we should modify core code, (not CFiles module):

  • If we new File is uploaded with same name and its ContentActiveRecord is soft deleted then we should rename to conflict[fileid]-test.doc, (fileid - is ID of the soft deleted File, right?)
  • otherwise do as now.

Should I create a separate issue for this or can I start to implement it here?

No. as I understood, the CFiles module has implemented a special handling here.
Specifically, when a file is marked as Deleted it get the status Published again if they have the same filename (CFiles.Title).

e.g. https://github.com/humhub/cfiles/blob/master/controllers/EditController.php#L52

Instead of restoring the file/folder here. We should rename the soft deleted file/folder and create a fresh record as normal.

@yurabakhtin yurabakhtin requested a review from luke- July 21, 2023 14:50
@luke- luke- merged commit 0d13933 into master Jul 21, 2023
1 of 5 checks passed
@luke- luke- deleted the fix/rename-conflicted-deleted branch July 21, 2023 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants