Skip to content

Commit

Permalink
Bug: 14112 Remove tags when deleting objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Sep 16, 2015
1 parent da5e575 commit 1b3e4ed
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
7 changes: 7 additions & 0 deletions mnemo/lib/Driver.php
Expand Up @@ -261,7 +261,12 @@ public function delete($noteId)
array('action' => 'delete'), true);
} catch (Horde_Exception $e) {
}

// Remove tags
$GLOBALS['injector']->getInstance('Mnemo_Tagger')
->replaceTags($uid, array(), $GLOBALS['registry']->getAuth(), 'note')
}

}

/**
Expand Down Expand Up @@ -291,6 +296,8 @@ public function deleteAll()
'mnemo:' . $this->_notepad . ':' . $uid,
array('action' => 'delete'),
true);
$injector->getInstance('Mnemo_Tagger')
->replaceTags($uid, array(), $GLOBALS['registry']->getAuth(), 'note');
}
} catch (Horde_Exception $e) {
}
Expand Down
9 changes: 8 additions & 1 deletion nag/lib/Driver.php
Expand Up @@ -400,6 +400,10 @@ public function delete($taskId)
$task = $this->get($taskId);
$delete = $this->_delete($taskId);

/* Remove tags */
$task->tags = array();
$this->_updateTags($task);

/* Log the deletion of this item in the history log. */
if (!empty($task->uid)) {
try {
Expand Down Expand Up @@ -444,14 +448,17 @@ public function deleteAll()
{
$ids = $this->_deleteAll();

// Update History.
// Update History and Tagger
$history = $GLOBALS['injector']->getInstance('Horde_History');
try {
foreach ($ids as $id) {
$history->log(
'nag:' . $this->_tasklist . ':' . $id,
array('action' => 'delete'),
true);

$GLOBALS['injector']->getInstance('Nag_Tagger')
->replaceTags($id, array(), $GLOBALS['registry']->getAuth(), 'task');
}
} catch (Exception $e) {
Horde::log($e, 'ERR');
Expand Down
10 changes: 9 additions & 1 deletion turba/lib/Driver.php
Expand Up @@ -1065,6 +1065,10 @@ public function delete($object_id)
}
} catch (Horde_Exception $e) {
}

/* Remove tags */
$GLOBALS['injector']->getInstance('Turba_Tagger')
->replaceTags($object->getValue('__uid'), array(), $this->getContactOwner(), 'contact');
}

/**
Expand All @@ -1085,7 +1089,7 @@ public function deleteAll($sourceName = null)

$ids = $this->_deleteAll($sourceName);

// Update Horde_History
// Update Horde_History and Tagger
$history = $GLOBALS['injector']->getInstance('Horde_History');
try {
foreach ($ids as $id) {
Expand All @@ -1095,6 +1099,10 @@ public function deleteAll($sourceName = null)
// Turba_Object#getGuid
$guid = 'turba:' . $this->getName() . ':' . $id;
$history->log($guid, array('action' => 'delete'), true);

// Remove tags.
$GLOBALS['injector']->getInstance('Turba_Tagger')
->replaceTags($id, array(), $this->getContactOwner(), 'contact');
}
} catch (Exception $e) {
Horde::log($e, 'ERR');
Expand Down

0 comments on commit 1b3e4ed

Please sign in to comment.