Fixed PHP warning when removing a user with no Avatar image
This commit is contained in:
@@ -27,6 +27,7 @@ Improvements:
|
|||||||
|
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
|
|
||||||
|
* Fixed PHP warning when removing a user with no Avatar image
|
||||||
* Fixed improper Markdown escaping for some tooltips
|
* Fixed improper Markdown escaping for some tooltips
|
||||||
* Closing all tasks by column, also update closed tasks
|
* Closing all tasks by column, also update closed tasks
|
||||||
* Fixed wrong task link generation within Markdown text
|
* Fixed wrong task link generation within Markdown text
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class AvatarFile extends Base
|
|||||||
$this->checkCSRFParam();
|
$this->checkCSRFParam();
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
$this->avatarFile->remove($user['id']);
|
$this->avatarFile->remove($user['id']);
|
||||||
|
$this->userSession->refresh($user['id']);
|
||||||
$this->response->redirect($this->helper->url->to('AvatarFile', 'show', array('user_id' => $user['id'])));
|
$this->response->redirect($this->helper->url->to('AvatarFile', 'show', array('user_id' => $user['id'])));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,14 +60,18 @@ class AvatarFile extends Base
|
|||||||
public function remove($user_id)
|
public function remove($user_id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->objectStorage->remove($this->getFilename($user_id));
|
$filename = $this->getFilename($user_id);
|
||||||
$result = $this->db->table(User::TABLE)->eq('id', $user_id)->update(array('avatar_path' => ''));
|
|
||||||
$this->userSession->refresh($user_id);
|
if (! empty($filename)) {
|
||||||
return $result;
|
$this->objectStorage->remove($filename);
|
||||||
|
return $this->db->table(User::TABLE)->eq('id', $user_id)->update(array('avatar_path' => ''));
|
||||||
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class User extends Base
|
|||||||
const TABLE = 'users';
|
const TABLE = 'users';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Id used for everbody (filtering)
|
* Id used for everybody (filtering)
|
||||||
*
|
*
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user