Skip to content

Commit

Permalink
Fix sync "loop" of Kolab categories <-> Horde tags sync. Second part …
Browse files Browse the repository at this point in the history
…of #12770

Consider this scenario with a new, empty task list:

1. User inserts the first task. The task is tagged with "foobar".
   This tag is inserted into the tagging backend.
2. User creates another task with a foreign Kolab client.
   This task is tagged "Foobar" (noticed the capital 'F')
3. nag syncs in the foreign task. The Kolab sync tells
   the tagging backend to store the tag(s) for the new task object,
   it does a case insensitive search for an existing tag label.
   -> it picks the existing row id of "foobar".

The next time Nag_Task::synchronizeTags() runs, it notices
the tags given by the Kolab driver for the second task
differ from the tag backend ("Foobar" != "foobar")
    -> A sync is triggered.

Fix it by making the tag label comparison case insensitive.
A similar fix is already in place in kronolith.

Signed-off-by: Michael J Rubinsky <mrubinsk@horde.org>
  • Loading branch information
thomasjfox authored and mrubinsk committed Jun 2, 2015
1 parent 1f3bae7 commit d45e47a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nag/lib/Task.php
Expand Up @@ -949,8 +949,10 @@ public function loadTags()
public function synchronizeTags(array $tags)
{
if (isset($this->internaltags)) {
usort($tags, 'strcoll');
if (array_diff($this->internaltags, $tags)) {
$lower_internaltags = array_map('Horde_String::lower', $this->internaltags);
$lower_tags = array_map('Horde_String::lower', $tags);

if (array_diff($lower_internaltags, $lower_tags)) {
$GLOBALS['injector']->getInstance('Nag_Tagger')->replaceTags(
$this->uid,
$this->internaltags,
Expand Down

0 comments on commit d45e47a

Please sign in to comment.