Do not use deprected activities API
This commit is contained in:
parent
9467859e42
commit
67f5216160
|
@ -324,10 +324,14 @@ class ShareController extends Controller {
|
||||||
|
|
||||||
// Single file share
|
// Single file share
|
||||||
if ($share->getPath() instanceof \OCP\Files\File) {
|
if ($share->getPath() instanceof \OCP\Files\File) {
|
||||||
$this->activityManager->publishActivity(
|
// Single file download
|
||||||
'files_sharing', Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED, [$originalSharePath], '', [],
|
$event = $this->activityManager->generateEvent();
|
||||||
$originalSharePath, '', $share->getShareOwner()->getUID(), Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM
|
$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
|
// Directory share
|
||||||
else {
|
else {
|
||||||
|
@ -347,35 +351,43 @@ class ShareController extends Controller {
|
||||||
|
|
||||||
if ($node instanceof \OCP\Files\File) {
|
if ($node instanceof \OCP\Files\File) {
|
||||||
// Single file download
|
// Single file download
|
||||||
$this->activityManager->publishActivity(
|
$event = $this->activityManager->generateEvent();
|
||||||
'files_sharing', Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED, [$originalSharePath], '', [],
|
$event->setApp('files_sharing')
|
||||||
$originalSharePath, '', $share->getShareOwner()->getUID(), Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM
|
->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)) {
|
} else if (!empty($files_list)) {
|
||||||
/** @var \OCP\Files\Folder $node */
|
/** @var \OCP\Files\Folder $node */
|
||||||
|
|
||||||
// Subset of files is downloaded
|
// Subset of files is downloaded
|
||||||
foreach ($files_list as $file) {
|
foreach ($files_list as $file) {
|
||||||
$subNode = $node->get($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) {
|
if ($subNode instanceof \OCP\Files\File) {
|
||||||
$this->activityManager->publishActivity(
|
$event->setSubject(Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED, [$userFolder->getRelativePath($subNode->getPath())]);
|
||||||
'files_sharing', Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED, [$nodePath], '', [],
|
|
||||||
$nodePath, '', $share->getShareOwner()->getUID(), Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
$this->activityManager->publishActivity(
|
$event->setSubject(Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED, [$userFolder->getRelativePath($subNode->getPath())]);
|
||||||
'files_sharing', Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED, [$nodePath], '', [],
|
|
||||||
$nodePath, '', $share->getShareOwner()->getUID(), Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->activityManager->publish($event);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// The folder is downloaded
|
// The folder is downloaded
|
||||||
$this->activityManager->publishActivity(
|
$event = $this->activityManager->generateEvent();
|
||||||
'files_sharing', Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED, [$originalSharePath], '', [],
|
$event->setApp('files_sharing')
|
||||||
$originalSharePath, '', $share->getShareOwner()->getUID(), Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM
|
->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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue