Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
'OCP\\Accounts\\PropertyDoesNotExistException' => $baseDir . '/lib/public/Accounts/PropertyDoesNotExistException.php',
'OCP\\Accounts\\UserUpdatedEvent' => $baseDir . '/lib/public/Accounts/UserUpdatedEvent.php',
'OCP\\Activity\\ActivitySettings' => $baseDir . '/lib/public/Activity/ActivitySettings.php',
'OCP\\Activity\\Exceptions\\FilterNotFoundException' => $baseDir . '/lib/public/Activity/Exceptions/FilterNotFoundException.php',
'OCP\\Activity\\Exceptions\\IncompleteActivityException' => $baseDir . '/lib/public/Activity/Exceptions/IncompleteActivityException.php',
'OCP\\Activity\\Exceptions\\InvalidValueException' => $baseDir . '/lib/public/Activity/Exceptions/InvalidValueException.php',
'OCP\\Activity\\Exceptions\\SettingNotFoundException' => $baseDir . '/lib/public/Activity/Exceptions/SettingNotFoundException.php',
'OCP\\Activity\\Exceptions\\UnknownActivityException' => $baseDir . '/lib/public/Activity/Exceptions/UnknownActivityException.php',
'OCP\\Activity\\IConsumer' => $baseDir . '/lib/public/Activity/IConsumer.php',
'OCP\\Activity\\IEvent' => $baseDir . '/lib/public/Activity/IEvent.php',
'OCP\\Activity\\IEventMerger' => $baseDir . '/lib/public/Activity/IEventMerger.php',
Expand Down
6 changes: 6 additions & 0 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\Accounts\\PropertyDoesNotExistException' => __DIR__ . '/../../..' . '/lib/public/Accounts/PropertyDoesNotExistException.php',
'OCP\\Accounts\\UserUpdatedEvent' => __DIR__ . '/../../..' . '/lib/public/Accounts/UserUpdatedEvent.php',
'OCP\\Activity\\ActivitySettings' => __DIR__ . '/../../..' . '/lib/public/Activity/ActivitySettings.php',
'OCP\\Activity\\Exceptions\\FilterNotFoundException' => __DIR__ . '/../../..' . '/lib/public/Activity/Exceptions/FilterNotFoundException.php',
'OCP\\Activity\\Exceptions\\IncompleteActivityException' => __DIR__ . '/../../..' . '/lib/public/Activity/Exceptions/IncompleteActivityException.php',
'OCP\\Activity\\Exceptions\\InvalidValueException' => __DIR__ . '/../../..' . '/lib/public/Activity/Exceptions/InvalidValueException.php',
'OCP\\Activity\\Exceptions\\SettingNotFoundException' => __DIR__ . '/../../..' . '/lib/public/Activity/Exceptions/SettingNotFoundException.php',
'OCP\\Activity\\Exceptions\\UnknownActivityException' => __DIR__ . '/../../..' . '/lib/public/Activity/Exceptions/UnknownActivityException.php',
'OCP\\Activity\\IConsumer' => __DIR__ . '/../../..' . '/lib/public/Activity/IConsumer.php',
'OCP\\Activity\\IEvent' => __DIR__ . '/../../..' . '/lib/public/Activity/IEvent.php',
'OCP\\Activity\\IEventMerger' => __DIR__ . '/../../..' . '/lib/public/Activity/IEventMerger.php',
Expand Down Expand Up @@ -1171,6 +1176,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Core\\Command\\User\\AuthTokens\\Add' => __DIR__ . '/../../..' . '/core/Command/User/AuthTokens/Add.php',
'OC\\Core\\Command\\User\\AuthTokens\\Delete' => __DIR__ . '/../../..' . '/core/Command/User/AuthTokens/Delete.php',
'OC\\Core\\Command\\User\\AuthTokens\\ListCommand' => __DIR__ . '/../../..' . '/core/Command/User/AuthTokens/ListCommand.php',
'OC\\Core\\Command\\User\\ClearGeneratedAvatarCacheCommand' => __DIR__ . '/../../..' . '/core/Command/User/ClearGeneratedAvatarCacheCommand.php',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regression from #44840

'OC\\Core\\Command\\User\\Delete' => __DIR__ . '/../../..' . '/core/Command/User/Delete.php',
'OC\\Core\\Command\\User\\Disable' => __DIR__ . '/../../..' . '/core/Command/User/Disable.php',
'OC\\Core\\Command\\User\\Enable' => __DIR__ . '/../../..' . '/core/Command/User/Enable.php',
Expand Down
134 changes: 40 additions & 94 deletions lib/private/Activity/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*/
namespace OC\Activity;

use OCP\Activity\Exceptions\InvalidValueException;
use OCP\Activity\IEvent;
use OCP\RichObjectStrings\InvalidObjectExeption;
use OCP\RichObjectStrings\IValidator;
Expand Down Expand Up @@ -89,16 +90,11 @@ public function __construct(IValidator $richValidator) {
}

/**
* Set the app of the activity
*
* @param string $app
* @return IEvent
* @throws \InvalidArgumentException if the app id is invalid
* @since 8.2.0
* {@inheritDoc}
*/
public function setApp(string $app): IEvent {
if ($app === '' || isset($app[32])) {
throw new \InvalidArgumentException('The given app is invalid');
throw new InvalidValueException('app');
}
$this->app = $app;
return $this;
Expand All @@ -112,16 +108,11 @@ public function getApp(): string {
}

/**
* Set the type of the activity
*
* @param string $type
* @return IEvent
* @throws \InvalidArgumentException if the type is invalid
* @since 8.2.0
* {@inheritDoc}
*/
public function setType(string $type): IEvent {
if ($type === '' || isset($type[255])) {
throw new \InvalidArgumentException('The given type is invalid');
throw new InvalidValueException('type');
}
$this->type = $type;
return $this;
Expand All @@ -135,16 +126,11 @@ public function getType(): string {
}

/**
* Set the affected user of the activity
*
* @param string $affectedUser
* @return IEvent
* @throws \InvalidArgumentException if the affected user is invalid
* @since 8.2.0
* {@inheritDoc}
*/
public function setAffectedUser(string $affectedUser): IEvent {
if ($affectedUser === '' || isset($affectedUser[64])) {
throw new \InvalidArgumentException('The given affected user is invalid');
throw new InvalidValueException('affectedUser');
}
$this->affectedUser = $affectedUser;
return $this;
Expand All @@ -158,16 +144,11 @@ public function getAffectedUser(): string {
}

/**
* Set the author of the activity
*
* @param string $author
* @return IEvent
* @throws \InvalidArgumentException if the author is invalid
* @since 8.2.0
* {@inheritDoc}
*/
public function setAuthor(string $author): IEvent {
if (isset($author[64])) {
throw new \InvalidArgumentException('The given author user is invalid');
throw new InvalidValueException('author');
}
$this->author = $author;
return $this;
Expand All @@ -181,14 +162,12 @@ public function getAuthor(): string {
}

/**
* Set the timestamp of the activity
*
* @param int $timestamp
* @return IEvent
* @throws \InvalidArgumentException if the timestamp is invalid
* @since 8.2.0
* {@inheritDoc}
*/
public function setTimestamp(int $timestamp): IEvent {
if ($timestamp < 0) {
throw new InvalidValueException('timestamp');
}
$this->timestamp = $timestamp;
return $this;
}
Expand All @@ -201,17 +180,11 @@ public function getTimestamp(): int {
}

/**
* Set the subject of the activity
*
* @param string $subject
* @param array $parameters
* @return IEvent
* @throws \InvalidArgumentException if the subject or parameters are invalid
* @since 8.2.0
* {@inheritDoc}
*/
public function setSubject(string $subject, array $parameters = []): IEvent {
if (isset($subject[255])) {
throw new \InvalidArgumentException('The given subject is invalid');
throw new InvalidValueException('subject');
}
$this->subject = $subject;
$this->subjectParameters = $parameters;
Expand All @@ -233,14 +206,11 @@ public function getSubjectParameters(): array {
}

/**
* @param string $subject
* @return $this
* @throws \InvalidArgumentException if the subject is invalid
* @since 11.0.0
* {@inheritDoc}
*/
public function setParsedSubject(string $subject): IEvent {
if ($subject === '') {
throw new \InvalidArgumentException('The given parsed subject is invalid');
throw new InvalidValueException('parsedSubject');
}
$this->subjectParsed = $subject;
return $this;
Expand All @@ -255,21 +225,21 @@ public function getParsedSubject(): string {
}

/**
* @param string $subject
* @param array $parameters
* @return $this
* @throws \InvalidArgumentException if the subject or parameters are invalid
* @since 11.0.0
* {@inheritDoc}
*/
public function setRichSubject(string $subject, array $parameters = []): IEvent {
if ($subject === '') {
throw new \InvalidArgumentException('The given parsed subject is invalid');
throw new InvalidValueException('richSubject');
}
$this->subjectRich = $subject;
$this->subjectRichParameters = $parameters;

if ($this->subjectParsed === '') {
$this->subjectParsed = $this->richToParsed($subject, $parameters);
try {
$this->subjectParsed = $this->richToParsed($subject, $parameters);
} catch (\InvalidArgumentException $e) {
throw new InvalidValueException('richSubjectParameters', $e);
}
}

return $this;
Expand Down Expand Up @@ -316,17 +286,11 @@ public function getRichSubjectParameters(): array {
}

/**
* Set the message of the activity
*
* @param string $message
* @param array $parameters
* @return IEvent
* @throws \InvalidArgumentException if the message or parameters are invalid
* @since 8.2.0
* {@inheritDoc}
*/
public function setMessage(string $message, array $parameters = []): IEvent {
if (isset($message[255])) {
throw new \InvalidArgumentException('The given message is invalid');
throw new InvalidValueException('message');
}
$this->message = $message;
$this->messageParameters = $parameters;
Expand All @@ -348,10 +312,7 @@ public function getMessageParameters(): array {
}

/**
* @param string $message
* @return $this
* @throws \InvalidArgumentException if the message is invalid
* @since 11.0.0
* {@inheritDoc}
*/
public function setParsedMessage(string $message): IEvent {
$this->messageParsed = $message;
Expand All @@ -367,18 +328,18 @@ public function getParsedMessage(): string {
}

/**
* @param string $message
* @param array $parameters
* @return $this
* @throws \InvalidArgumentException if the subject or parameters are invalid
* @since 11.0.0
* {@inheritDoc}
*/
public function setRichMessage(string $message, array $parameters = []): IEvent {
$this->messageRich = $message;
$this->messageRichParameters = $parameters;

if ($this->messageParsed === '') {
$this->messageParsed = $this->richToParsed($message, $parameters);
try {
$this->messageParsed = $this->richToParsed($message, $parameters);
} catch (\InvalidArgumentException $e) {
throw new InvalidValueException('richMessageParameters', $e);
}
}

return $this;
Expand All @@ -401,21 +362,14 @@ public function getRichMessageParameters(): array {
}

/**
* Set the object of the activity
*
* @param string $objectType
* @param int $objectId
* @param string $objectName
* @return IEvent
* @throws \InvalidArgumentException if the object is invalid
* @since 8.2.0
* {@inheritDoc}
*/
public function setObject(string $objectType, int $objectId, string $objectName = ''): IEvent {
if (isset($objectType[255])) {
throw new \InvalidArgumentException('The given object type is invalid');
throw new InvalidValueException('objectType');
}
if (isset($objectName[4000])) {
throw new \InvalidArgumentException('The given object name is invalid');
throw new InvalidValueException('objectName');
}
$this->objectType = $objectType;
$this->objectId = $objectId;
Expand Down Expand Up @@ -445,16 +399,11 @@ public function getObjectName(): string {
}

/**
* Set the link of the activity
*
* @param string $link
* @return IEvent
* @throws \InvalidArgumentException if the link is invalid
* @since 8.2.0
* {@inheritDoc}
*/
public function setLink(string $link): IEvent {
if (isset($link[4000])) {
throw new \InvalidArgumentException('The given link is invalid');
throw new InvalidValueException('link');
}
$this->link = $link;
return $this;
Expand All @@ -468,14 +417,11 @@ public function getLink(): string {
}

/**
* @param string $icon
* @return $this
* @throws \InvalidArgumentException if the icon is invalid
* @since 11.0.0
* {@inheritDoc}
*/
public function setIcon(string $icon): IEvent {
if (isset($icon[4000])) {
throw new \InvalidArgumentException('The given icon is invalid');
throw new InvalidValueException('icon');
}
$this->icon = $icon;
return $this;
Expand Down
Loading