Skip to content

✨(frontend) Duplicate a doc #1078

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

Merged
merged 4 commits into from
Jul 3, 2025
Merged

✨(frontend) Duplicate a doc #1078

merged 4 commits into from
Jul 3, 2025

Conversation

AntoLC
Copy link
Collaborator

@AntoLC AntoLC commented Jun 16, 2025

Purpose

Gives the possibility to duplicate a document.

Proposal

  • ♻️(frontend) Simplify AGPL export pattern
  • ✨(frontend) Duplicate a doc

Demo

Demo.duplicate.doc.-.Docs.webm

Edge case

We save before duplication to ensure the latest state is duplicated.

⚠️ Possible data lost:

  • if current user is reader, it will not save, so 1mn could be lost with duplication if editor are writing in the same moment.
  • if duplication is trigger from option document list, we cannot access the provider, so 1mn could be lost with duplication if editor are writing in the same moment.

@AntoLC AntoLC self-assigned this Jun 16, 2025
@AntoLC AntoLC added frontend feature add a new feature labels Jun 16, 2025
@AntoLC AntoLC force-pushed the feature/duplicate branch 7 times, most recently from e88db26 to b90a091 Compare June 17, 2025 10:12
@AntoLC AntoLC marked this pull request as ready for review June 17, 2025 10:15
@AntoLC AntoLC requested review from rvveber and PanchoutNathan June 17, 2025 10:18
@AntoLC AntoLC force-pushed the feature/duplicate branch 2 times, most recently from 855ad40 to 4e36ce7 Compare June 17, 2025 12:05
@AntoLC AntoLC linked an issue Jun 18, 2025 that may be closed by this pull request
@virgile-dev
Copy link
Collaborator

hey @AntoLC good job !
can you also duplicate from the document list ?
@rl-83 do you think we should have an option to duplicate without the rights ?

@AntoLC
Copy link
Collaborator Author

AntoLC commented Jun 24, 2025

can you also duplicate from the document list

Yes we can

@virgile-dev
Copy link
Collaborator

Hey @AntoLC @rl-83 talked with @sampaccoud about this.
It told me the back provides an option to duplicate with or without the rights.
The UI should should give the option to the user.

@virgile-dev
Copy link
Collaborator

virgile-dev commented Jun 25, 2025

Hey @AntoLC @rl-83 talked with @sampaccoud about this. It told me the back provides an option to duplicate with or without the rights. The UI should should give the option to the user.

By default we shouldn't copy the associated members and rights. Let's remove this from this PR. I've opened an issue to add the mentioned above

@AntoLC AntoLC force-pushed the feature/duplicate branch 3 times, most recently from 7cecebd to a6d538b Compare June 30, 2025 13:43
@AntoLC AntoLC requested a review from lunika June 30, 2025 13:45
Copy link
Member

@lunika lunika left a comment

Choose a reason for hiding this comment

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

Before duplicate a document, the content should be saved. The first test I made I created a new doc, I wrote content and I duplicate it. The duplicated document is empty because no save has occured. Without this save content can be lost.

await editor.click();
await editor.fill('Hello Duplicated World');

await page.reload();
Copy link
Member

Choose a reason for hiding this comment

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

This does not reflect what really happen when you work on a document. This reload I think trigger the save of the document content, this is why you have the same content at the end of this test

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It will now save if possible when duplication.

  • if reader, it will not save, so 1mn could be lost with duplication if editor are writing in the same moment.
  • if duplication is trigger from option document list, we cannot access the provider, so 1mn could be lost with duplication if editor are writing in the same moment.

We were maintaining two separate components
for AGPL and MIT license exports.
This commit consolidates the functionality into
a single component that handles both licenses,
simplifying the codebase and reducing duplication.
@AntoLC AntoLC force-pushed the feature/duplicate branch from 44089e4 to 57e1512 Compare July 2, 2025 13:53
@AntoLC AntoLC force-pushed the feature/duplicate branch from 57e1512 to 0871ee3 Compare July 2, 2025 13:54
@AntoLC AntoLC requested a review from lunika July 2, 2025 14:00
AntoLC and others added 3 commits July 3, 2025 11:23
We can duplicate a document from the
tool options.
The duplicate was also able for anonynous user if they can read it. We
have to restrict it to at least reader authenticated otherwise no access
will be created on the duplicated document.
Only admin or owner should be able to duplicate a document with existing
accesses.
@AntoLC AntoLC force-pushed the feature/duplicate branch from 0871ee3 to e148c23 Compare July 3, 2025 09:25
@AntoLC AntoLC merged commit e148c23 into main Jul 3, 2025
20 of 21 checks passed
@AntoLC AntoLC deleted the feature/duplicate branch July 3, 2025 09:53
@AntoLC AntoLC mentioned this pull request Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature add a new feature frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate docs
3 participants