Bug 441846 - Tags duplicated with copy&paste an event
Summary: Tags duplicated with copy&paste an event
Status: RESOLVED FIXED
Alias: None
Product: korganizer
Classification: Applications
Component: agendaview (weekview) (show other bugs)
Version: 5.18.1
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-01 07:38 UTC by Max
Modified: 2021-10-06 06:46 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
KO state after cold start (248.66 KB, image/png)
2021-10-03 03:11 UTC, Max
Details
Tag Editor state after cold start (265.89 KB, image/png)
2021-10-03 03:13 UTC, Max
Details
Tag Editor state after open an event dialog (294.75 KB, image/png)
2021-10-03 03:15 UTC, Max
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Max 2021-09-01 07:38:45 UTC
SUMMARY
Duplicated tags appear in Tag Editor after I've copied and pasted an event with assigned tag.

After that events with duplicated tag don't colored with tag's color in agenda view. Them colored with calendar color

STEPS TO REPRODUCE
1. Check only one tag in Tag Manager (ex. "01")
2. Create event
3. Assign tag "01" to the event
4. Copy event with tag and past one in calendar
5. Check Tag Manager. There should be two tags "01"

OBSERVED RESULT


EXPECTED RESULT
Only one tag after copy&paste event

SOFTWARE/OS VERSIONS
Operating System: Gentoo Linux
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
KDE Grear: 21.08.0
Kernel Version: 5.10.60-gentoo-dist (64-bit)
Graphics Platform: X11

Korganizer: 5.18
Comment 1 gjditchfield 2021-09-01 18:16:06 UTC
My tests duplicated a tag, but only a type-2 "GENERIC" tag, and only duplicated it once.
Comment 2 Max 2021-09-07 09:43:11 UTC
In due rolling down to KO 5.17.3 now I can't test KO 5.18.1

With tag "05-АДМ" it gave up to 5 duplicated tags (dup tag) in Tag Editor
The  "02-ГРЖ" tag generated one dup tag
Perhaps it's depended on locale (used ru_RU)
Comment 3 Bug Janitor Service 2021-09-30 01:05:33 UTC
A possibly relevant merge request was started @ https://invent.kde.org/pim/incidenceeditor/-/merge_requests/22
Comment 4 Alexandre Bonneau 2021-09-30 06:57:06 UTC
I use Korganizer...a LOT. This is my main work tool to manage my time.
As such, I use Korganizer not once or twice a day, but constantly during my day.

In my experience, copy/pasting events (which I do pretty often) does not lead to tag duplication. (I could not tell for tasks, since I almost never copy-paste those)
However, if I try to use the tag manager, then tags are created left and right.
Same if you use the tag color configuration window.
I think copy/pasting is not the problem, the tag manager and tag color configuration window are.
Comment 5 gjditchfield 2021-09-30 20:13:02 UTC
(In reply to Alexandre Bonneau from comment #4)

To be clear, pasting an event that has a tag is a reproducible way to create the merge request's precondition, but the actual duplication is the fault of the incidence editor.

You can watch the problem in akonadiconsole:

1) Create a new event, give it a new unique tag, and save it.  akonadiconsole's Browser tab shows the unique tag; double-click it, and a dialog appears saying that it is a PLAIN tag. On akonadiconsole's DB Browser tab, the pimitemtagrelation table has 1 row relating the new event and tag.

2) Copy the event and paste it.  akonadiconsole still shows 1 tag with the unique name, but pimitemtagrelation has 0 rows relating the tag to the pasted event.

3) Edit the pasted event.  As soon as the editor opens, akonadiconsole shows 2 tags with the (formerly unique) name; double-click the new one, and a dialog appears saying that it is a GENERIC tag.

If there is a sequence of operations that duplicates tags without opening the editor ... that is a different bug.
Comment 6 gjditchfield 2021-10-02 01:04:33 UTC
Git commit 5bf2e967dcd709658a2fae58cfaecb5a04693b2f by Glen Ditchfield, on behalf of Glen Ditchfield.
Committed on 30/09/2021 at 01:05.
Pushed by gditchfield into branch 'release/21.08'.

Do not create duplicate tags

If an event with categories is cut & pasted, the pasted event has the
same categories as the original but does not have the same tag-item
relationships in Akonadi.  (This is not the only way that categories
and tags go out of sync.)

When the incidence editor opens the pasted event, it creates new GENERIC
tags for the categories, duplicating the existing tag.  Then it inserts
the tag in the editor, thus making it dirty and causing unnecessary
"Do you really want to cancel?" dialogs.

This patch creates PLAIN tags, merges them with existing tags, and
does not dirty the editor.

M  +11   -5    src/incidencecategories.cpp

https://invent.kde.org/pim/incidenceeditor/commit/5bf2e967dcd709658a2fae58cfaecb5a04693b2f
Comment 7 Max 2021-10-03 03:11:53 UTC
Created attachment 142107 [details]
KO state after cold start

KO state after cold start
Comment 8 Max 2021-10-03 03:13:24 UTC
Created attachment 142108 [details]
Tag Editor state after cold start

Tag Editor state after cold start
Comment 9 Max 2021-10-03 03:15:03 UTC
Created attachment 142109 [details]
Tag Editor state after open an event dialog

Tag Editor state after open an event dialog
Comment 10 Max 2021-10-03 03:20:55 UTC
Korganizer is my main planner app.
With Manjaro updated up to KO 5.18.1 and kde-frameworks 5.86 the duplication appears on opening any events details dialog. 

The screenshots demonstrate changing of tag editor state after cold start and opening event dialog
Comment 11 Max 2021-10-06 06:46:23 UTC
(In reply to gjditchfield from comment #6)
> 
> This patch creates PLAIN tags, merges them with existing tags, and
> does not dirty the editor.
> 
> M  +11   -5    src/incidencecategories.cpp
> 
> https://invent.kde.org/pim/incidenceeditor/commit/
> 5bf2e967dcd709658a2fae58cfaecb5a04693b2f

Today I've updated Akonadi to 20.8.2 and Korganizer to 15.18.2. It looks like all works as expected. Thank you very much.