summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-03-29 18:44:16 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2016-03-29 18:44:16 +0200
commit37d32a93d0a4d887c84e7215a8d11751fd020249 (patch)
treeff8ad7b1b1396ea0a2e2038e3cad859f06a2d394 /lib
parentcd850dc325302e39749bf440d019bd7b43317496 (diff)
parentc0858f42aac8bf15f01bb5ffed2c4c6301f42424 (diff)
downloadnextcloud-server-37d32a93d0a4d887c84e7215a8d11751fd020249.tar.gz
nextcloud-server-37d32a93d0a4d887c84e7215a8d11751fd020249.zip
Merge pull request #23543 from owncloud/issue-23503-activity-emails-always-short
Fix activity emails always using the short translation
Diffstat (limited to 'lib')
-rw-r--r--lib/private/activitymanager.php23
-rw-r--r--lib/public/activity/imanager.php10
2 files changed, 31 insertions, 2 deletions
diff --git a/lib/private/activitymanager.php b/lib/private/activitymanager.php
index 9258b7298cc..e522dca9e3b 100644
--- a/lib/private/activitymanager.php
+++ b/lib/private/activitymanager.php
@@ -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');
}
@@ -475,6 +479,19 @@ class ActivityManager implements IManager {
}
/**
+ * 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
*
* Either the user is logged in, or we try to get it from the token
@@ -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();
diff --git a/lib/public/activity/imanager.php b/lib/public/activity/imanager.php
index 0b97f8a07ed..cbd08722410 100644
--- a/lib/public/activity/imanager.php
+++ b/lib/public/activity/imanager.php
@@ -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
*