summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-01-20 09:39:05 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-01-20 21:12:26 +0100
commit67f5216160e9045a7fcbb152eda34fbf5e0833d4 (patch)
tree4abd318d272169d75c38697480a76fa95875cdd6
parent9467859e42638476006004cfc0020b3247f51724 (diff)
downloadnextcloud-server-67f5216160e9045a7fcbb152eda34fbf5e0833d4.tar.gz
nextcloud-server-67f5216160e9045a7fcbb152eda34fbf5e0833d4.zip
Do not use deprected activities API
-rw-r--r--apps/files_sharing/lib/controllers/sharecontroller.php54
1 files changed, 33 insertions, 21 deletions
diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php
index 2ed5db5f00f..19517a9012e 100644
--- a/apps/files_sharing/lib/controllers/sharecontroller.php
+++ b/apps/files_sharing/lib/controllers/sharecontroller.php
@@ -324,10 +324,14 @@ class ShareController extends Controller {
// Single file share
if ($share->getPath() instanceof \OCP\Files\File) {
- $this->activityManager->publishActivity(
- 'files_sharing', Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED, [$originalSharePath], '', [],
- $originalSharePath, '', $share->getShareOwner()->getUID(), Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM
- );
+ // Single file download
+ $event = $this->activityManager->generateEvent();
+ $event->setApp('files_sharing')
+ ->setType(Activity::TYPE_PUBLIC_LINKS)
+ ->setSubject(Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED, [$userFolder->getRelativePath($share->getPath()->getPath())])
+ ->setAffectedUser($share->getShareOwner()->getUID())
+ ->setObject('files', $share->getPath()->getId(), $userFolder->getRelativePath($share->getPath()->getPath()));
+ $this->activityManager->publish($event);
}
// Directory share
else {
@@ -347,35 +351,43 @@ class ShareController extends Controller {
if ($node instanceof \OCP\Files\File) {
// Single file download
- $this->activityManager->publishActivity(
- 'files_sharing', Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED, [$originalSharePath], '', [],
- $originalSharePath, '', $share->getShareOwner()->getUID(), Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM
- );
+ $event = $this->activityManager->generateEvent();
+ $event->setApp('files_sharing')
+ ->setType(Activity::TYPE_PUBLIC_LINKS)
+ ->setSubject(Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED, [$userFolder->getRelativePath($node->getPath())])
+ ->setAffectedUser($share->getShareOwner()->getUID())
+ ->setObject('files', $node->getId(), $userFolder->getRelativePath($node->getPath()));
+ $this->activityManager->publish($event);
} else if (!empty($files_list)) {
/** @var \OCP\Files\Folder $node */
// Subset of files is downloaded
foreach ($files_list as $file) {
$subNode = $node->get($file);
- $nodePath = $userFolder->getRelativePath($subNode->getPath());
+
+ $event = $this->activityManager->generateEvent();
+ $event->setApp('files_sharing')
+ ->setType(Activity::TYPE_PUBLIC_LINKS)
+ ->setAffectedUser($share->getShareOwner()->getUID())
+ ->setObject('files', $subNode->getId(), $userFolder->getRelativePath($subNode->getPath()));
+
if ($subNode instanceof \OCP\Files\File) {
- $this->activityManager->publishActivity(
- 'files_sharing', Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED, [$nodePath], '', [],
- $nodePath, '', $share->getShareOwner()->getUID(), Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM
- );
+ $event->setSubject(Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED, [$userFolder->getRelativePath($subNode->getPath())]);
} else {
- $this->activityManager->publishActivity(
- 'files_sharing', Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED, [$nodePath], '', [],
- $nodePath, '', $share->getShareOwner()->getUID(), Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM
- );
+ $event->setSubject(Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED, [$userFolder->getRelativePath($subNode->getPath())]);
}
+
+ $this->activityManager->publish($event);
}
} else {
// The folder is downloaded
- $this->activityManager->publishActivity(
- 'files_sharing', Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED, [$originalSharePath], '', [],
- $originalSharePath, '', $share->getShareOwner()->getUID(), Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM
- );
+ $event = $this->activityManager->generateEvent();
+ $event->setApp('files_sharing')
+ ->setType(Activity::TYPE_PUBLIC_LINKS)
+ ->setSubject(Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED, [$userFolder->getRelativePath($node->getPath())])
+ ->setAffectedUser($share->getShareOwner()->getUID())
+ ->setObject('files', $node->getId(), $userFolder->getRelativePath($node->getPath()));
+ $this->activityManager->publish($event);
}
}