Skip to content

Commit

Permalink
Bug: 13884 Fix adding tags to new contacts.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Feb 27, 2015
1 parent 701ea44 commit b92f45c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions turba/lib/Driver.php
Expand Up @@ -905,15 +905,21 @@ public function add(array $attributes)
$key = $attributes['__key'] = $this->_makeKey($this->toDriverKeys($attributes));
$uid = $attributes['__uid'];

/* Remember any tags, since toDriverKeys will remove them.
(They are not stored in the Turba backend so have no mapping). */
$tags = isset($attributes['__tags'])
? $attributes['__tags']
: false;

$attributes = $this->toDriverKeys($attributes);

$this->_add($attributes, $this->toDriverKeys($this->getBlobs()), $this->toDriverKeys($this->getDateFields()));

/* Add tags. */
if (isset($attributes['__tags'])) {
if ($tags !== false) {
$GLOBALS['injector']->getInstance('Turba_Tagger')->tag(
$uid,
$attributes['__tags'],
$tags,
$GLOBALS['registry']->getAuth(),
'contact'
);
Expand Down

0 comments on commit b92f45c

Please sign in to comment.