Merge pull request #23618 from owncloud/backport-23543-activity-emails-always-short

Backport 23543 activity emails always short
This commit is contained in:
Thomas Müller 2016-03-30 16:59:22 +02:00
commit cdff098357
2 changed files with 31 additions and 2 deletions

View File

@ -49,6 +49,9 @@ class ActivityManager implements IManager {
/** @var int */
protected $formattingObjectId;
/** @var string */
protected $currentUserId;
/**
* constructor of the controller
*
@ -321,7 +324,8 @@ class ActivityManager implements IManager {
* @return bool
*/
public function isFormattingFilteredObject() {
return $this->formattingObjectType === $this->request->getParam('object_type')
return $this->formattingObjectType !== null && $this->formattingObjectId !== null
&& $this->formattingObjectType === $this->request->getParam('object_type')
&& $this->formattingObjectId === $this->request->getParam('object_id');
}
@ -474,6 +478,19 @@ class ActivityManager implements IManager {
return array(' and ((' . implode(') or (', $conditions) . '))', $parameters);
}
/**
* Set the user we need to use
*
* @param string|null $currentUserId
* @throws \UnexpectedValueException If the user is invalid
*/
public function setCurrentUserId($currentUserId) {
if (!is_string($currentUserId) && $currentUserId !== null) {
throw new \UnexpectedValueException('The given current user is invalid');
}
$this->currentUserId = $currentUserId;
}
/**
* Get the user we need to use
*
@ -483,7 +500,9 @@ class ActivityManager implements IManager {
* @throws \UnexpectedValueException If the token is invalid, does not exist or is not unique
*/
public function getCurrentUserId() {
if (!$this->session->isLoggedIn()) {
if ($this->currentUserId !== null) {
return $this->currentUserId;
} else if (!$this->session->isLoggedIn()) {
return $this->getUserFromToken();
} else {
return $this->session->getUser()->getUID();

View File

@ -204,6 +204,16 @@ interface IManager {
*/
public function getQueryForFilter($filter);
/**
* Set the user we need to use
*
* @param string|null $currentUserId
* @throws \UnexpectedValueException If the user is invalid
* @since 9.0.1
*/
public function setCurrentUserId($currentUserId);
/**
* Get the user we need to use
*