Skip to content

fix: allways allow duplicaiton - #8689

Open
SebastianKrupinski wants to merge 2 commits into
mainfrom
fix/always-allow-duplication
Open

fix: allways allow duplicaiton#8689
SebastianKrupinski wants to merge 2 commits into
mainfrom
fix/always-allow-duplication

Conversation

@SebastianKrupinski

@SebastianKrupinski SebastianKrupinski commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Resolves: Allow to copy events #8608
  • Removed the isReadOnly (User should be able to duplicate any event, this is no different then exporting then importing)
  • Removed the canCreateRecurrenceException (This is used to control changing recurring events, so it makes no sense on duplication)
  • Fixed broken copy logic in copyCalendarObjectInstanceIntoEventComponent

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread src/views/EditSimple.vue
Comment thread src/views/EditFull.vue Outdated
Comment thread src/views/EditFull.vue Outdated
@odzhychko odzhychko added Feature: Editor enhancement New feature request labels Aug 6, 2026
@odzhychko

Copy link
Copy Markdown
Contributor

Found #8421 that implements duplication for read-only events.

@SebastianKrupinski
SebastianKrupinski force-pushed the fix/always-allow-duplication branch 3 times, most recently from 8e27ba0 to b7c80d9 Compare August 10, 2026 17:36

@odzhychko odzhychko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copying now works as expected.
And thx for fixing what I broke in #8606 🤦

In some case the duplicate action is displayed event though duplication is not possible.

Comment thread src/mixins/EditorMixin.js
Comment thread src/mixins/EditorMixin.js Outdated
if (event.key === 'd' && event.ctrlKey === true) {
event.preventDefault()
if (!this.isNew && !this.isReadOnly && !this.canCreateRecurrenceException) {
if (!this.isNew && !this.canCreateRecurrenceException) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue: Inconsistent/outdated check for !this.canCreateRecurrenceException.

Overview of current checks:

  • EditorMixin.keyboardDuplicateEvent: !this.isNew && !this.canCreateRecurrenceException
  • EditFull.vue: !isNew (checked on action)
  • EditSimple.vue: !isNew (checked on action container)

Might worth introducing EditorMixin.canDuplicate to avoid accidental drift.

Comment thread src/views/EditFull.vue Outdated
{{ $t('calendar', 'Export') }}
</NcActionLink>
<NcActionButton v-if="!canCreateRecurrenceException && !isReadOnly && !isNew" @click="duplicateEvent()">
<NcActionButton v-if="!isNew" @click="duplicateEvent()">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue: Duplicate action is available in embedded view (apps/calendar/embed/...) and has no effect.

Comment thread src/views/EditFull.vue Outdated
{{ $t('calendar', 'Export') }}
</NcActionLink>
<NcActionButton v-if="!canCreateRecurrenceException && !isReadOnly && !isNew" @click="duplicateEvent()">
<NcActionButton v-if="!isNew" @click="duplicateEvent()">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue: Duplicate action is available in public view (/apps/calendar/p/...) and has no effect.

Comment thread src/mixins/EditorMixin.js
const calendarId = this.isReadOnly
? (this.calendarsStore.sortedCalendars[0]?.id ?? null)
: (this.calendarObject?.calendarId ?? null)
await this.calendarObjectInstanceStore.duplicateCalendarObjectInstance({ calendarId })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue: We should abort (with a warning), if calendarId === null aka. no writable target calendar exists.

Or maybe even dont show that duplicate action to the user, if no writable target calendar exists.

Could be part ofEditorMixin.canDuplicate (suggested in https://github.com/nextcloud/calendar/pull/8689/changes#r3754176914)

Such a check would automatically resolve:

timezoneId: oldEventComponent.startDate.timezoneId,
isAllDay: oldEventComponent.isAllDay(),
calendarId: this.calendarObject?.calendarId ?? null,
calendarId: calendarId ?? this.calendarObject?.calendarId ?? null,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: this.calendarObject?.calendarId might be of a read only calendar. Let's make calendarId mandatory.

Relates to https://github.com/nextcloud/calendar/pull/8689/changes#r3754267389

Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
@SebastianKrupinski
SebastianKrupinski force-pushed the fix/always-allow-duplication branch from b7c80d9 to e18d3fb Compare August 12, 2026 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews enhancement New feature request Feature: Editor

Projects

Status: 🏗️ In progress

Development

Successfully merging this pull request may close these issues.

Allow to copy events

2 participants