Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated publishActivity function #11636

Merged
merged 1 commit into from
Oct 5, 2018
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
25 changes: 0 additions & 25 deletions lib/private/Activity/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,31 +197,6 @@ public function publish(IEvent $event) {
}
}

/**
* @param string $app The app where this event is associated with
* @param string $subject A short description of the event
* @param array $subjectParams Array with parameters that are filled in the subject
* @param string $message A longer description of the event
* @param array $messageParams Array with parameters that are filled in the message
* @param string $file The file including path where this event is associated with
* @param string $link A link where this event is associated with
* @param string $affectedUser Recipient of the activity
* @param string $type Type of the notification
* @param int $priority Priority of the notification
*/
public function publishActivity($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority) {
$event = $this->generateEvent();
$event->setApp($app)
->setType($type)
->setAffectedUser($affectedUser)
->setSubject($subject, $subjectParams)
->setMessage($message, $messageParams)
->setObject('', 0, $file)
->setLink($link);

$this->publish($event);
}

/**
* In order to improve lazy loading a closure can be registered which will be called in case
* activity consumers are actually requested
Expand Down
16 changes: 0 additions & 16 deletions lib/public/Activity/IManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,6 @@ public function generateEvent();
*/
public function publish(IEvent $event);

/**
* @param string $app The app where this event is associated with
* @param string $subject A short description of the event
* @param array $subjectParams Array with parameters that are filled in the subject
* @param string $message A longer description of the event
* @param array $messageParams Array with parameters that are filled in the message
* @param string $file The file including path where this event is associated with
* @param string $link A link where this event is associated with
* @param string $affectedUser Recipient of the activity
* @param string $type Type of the notification
* @param int $priority Priority of the notification
* @since 6.0.0
* @deprecated 8.2.0 Grab an IEvent from generateEvent() instead and use the publish() method
*/
public function publishActivity($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority);

/**
* In order to improve lazy loading a closure can be registered which will be called in case
* activity consumers are actually requested
Expand Down
52 changes: 0 additions & 52 deletions tests/lib/Activity/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,58 +390,6 @@ public function testPublishAllManually() {

$this->activityManager->publish($event);
}

public function testDeprecatedPublishActivity() {
$event = $this->activityManager->generateEvent();
$event->setApp('test_app')
->setType('test_type')
->setAffectedUser('test_affected')
->setAuthor('test_author')
->setTimestamp(1337)
->setSubject('test_subject', ['test_subject_param'])
->setMessage('test_message', ['test_message_param'])
->setObject('test_object_type', 42, 'test_object_name')
->setLink('test_link')
;

$consumer = $this->getMockBuilder('OCP\Activity\IConsumer')
->disableOriginalConstructor()
->getMock();
$consumer->expects($this->once())
->method('receive')
->willReturnCallback(function(\OCP\Activity\IEvent $event) {
$this->assertSame('test_app', $event->getApp(), 'App not set correctly');
$this->assertSame('test_type', $event->getType(), 'Type not set correctly');
$this->assertSame('test_affected', $event->getAffectedUser(), 'Affected user not set correctly');
$this->assertSame('test_subject', $event->getSubject(), 'Subject not set correctly');
$this->assertSame(['test_subject_param'], $event->getSubjectParameters(), 'Subject parameter not set correctly');
$this->assertSame('test_message', $event->getMessage(), 'Message not set correctly');
$this->assertSame(['test_message_param'], $event->getMessageParameters(), 'Message parameter not set correctly');
$this->assertSame('test_object_name', $event->getObjectName(), 'Object name not set correctly');
$this->assertSame('test_link', $event->getLink(), 'Link not set correctly');

// The following values can not be used via publishActivity()
$this->assertLessThanOrEqual(time() + 2, $event->getTimestamp(), 'Timestamp not set correctly');
$this->assertGreaterThanOrEqual(time() - 2, $event->getTimestamp(), 'Timestamp not set correctly');
$this->assertSame('', $event->getAuthor(), 'Author not set correctly');
$this->assertSame('', $event->getObjectType(), 'Object type should not be set');
$this->assertSame(0, $event->getObjectId(), 'Object ID should not be set');
});
$this->activityManager->registerConsumer(function () use ($consumer) {
return $consumer;
});

$this->activityManager->publishActivity(
$event->getApp(),
$event->getSubject(), $event->getSubjectParameters(),
$event->getMessage(), $event->getMessageParameters(),
$event->getObjectName(),
$event->getLink(),
$event->getAffectedUser(),
$event->getType(),
\OCP\Activity\IExtension::PRIORITY_MEDIUM
);
}
}

class SimpleExtension implements \OCP\Activity\IExtension {
Expand Down