Added avatar image upload

This commit is contained in:
Frederic Guillot
2016-03-26 14:43:41 -04:00
parent e71f37238c
commit 820c929ab3
31 changed files with 548 additions and 115 deletions

View File

@@ -283,12 +283,7 @@ class User extends Base
{
$this->prepare($values);
$result = $this->db->table(self::TABLE)->eq('id', $values['id'])->update($values);
// If the user is connected refresh his session
if ($this->userSession->getId() == $values['id']) {
$this->userSession->initialize($this->getById($this->userSession->getId()));
}
$this->userSession->refresh($values['id']);
return $result;
}
@@ -327,6 +322,9 @@ class User extends Base
{
return $this->db->transaction(function (Database $db) use ($user_id) {
// Remove Avatar
$this->avatarFile->remove($user_id);
// All assigned tasks are now unassigned (no foreign key)
if (! $db->table(Task::TABLE)->eq('owner_id', $user_id)->update(array('owner_id' => 0))) {
return false;