Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93307bb247 | ||
|
|
45f2eedafe | ||
|
|
6fb0f6209c | ||
|
|
043327dc09 | ||
|
|
05aafd9ddb | ||
|
|
5f789962b4 |
@@ -199,4 +199,12 @@ class ConfigService {
|
|||||||
|
|
||||||
return $this->config->getUserValue($userId ?? $this->getUserId(), 'deck', 'attachment_folder', '/Deck');
|
return $this->config->getUserValue($userId ?? $this->getUserId(), 'deck', 'attachment_folder', '/Deck');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setAttachmentFolder(?string $userId = null, string $path): void {
|
||||||
|
if ($userId === null && $this->getUserId() === null) {
|
||||||
|
throw new NoPermissionException('Must be logged in get the attachment folder');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->config->setUserValue($userId ?? $this->getUserId(), 'deck', 'attachment_folder', $path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ use OCA\Deck\Sharing\DeckShareProvider;
|
|||||||
use OCA\Deck\StatusException;
|
use OCA\Deck\StatusException;
|
||||||
use OCP\AppFramework\Http\StreamResponse;
|
use OCP\AppFramework\Http\StreamResponse;
|
||||||
use OCP\Constants;
|
use OCP\Constants;
|
||||||
|
use OCP\Files\Folder;
|
||||||
use OCP\Files\IMimeTypeDetector;
|
use OCP\Files\IMimeTypeDetector;
|
||||||
use OCP\Files\IRootFolder;
|
use OCP\Files\IRootFolder;
|
||||||
use OCP\Files\NotFoundException;
|
use OCP\Files\NotFoundException;
|
||||||
@@ -189,6 +190,16 @@ class FilesAppService implements IAttachmentService, ICustomAttachmentService {
|
|||||||
$folder = $userFolder->newFolder($this->configService->getAttachmentFolder());
|
$folder = $userFolder->newFolder($this->configService->getAttachmentFolder());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($folder->isShared()) {
|
||||||
|
$folderName = $userFolder->getNonExistingName($this->configService->getAttachmentFolder());
|
||||||
|
$folder = $userFolder->newFolder($folderName);
|
||||||
|
$this->configService->setAttachmentFolder($this->userId, $folderName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$folder instanceof Folder || $folder->isShared()) {
|
||||||
|
throw new NotFoundException('No target folder found');
|
||||||
|
}
|
||||||
|
|
||||||
$fileName = $folder->getNonExistingName($fileName);
|
$fileName = $folder->getNonExistingName($fileName);
|
||||||
$target = $folder->newFile($fileName);
|
$target = $folder->newFile($fileName);
|
||||||
$content = fopen($file['tmp_name'], 'rb');
|
$content = fopen($file['tmp_name'], 'rb');
|
||||||
|
|||||||
@@ -84,7 +84,20 @@ export default {
|
|||||||
params.append('object_id', '' + this.objectId)
|
params.append('object_id', '' + this.objectId)
|
||||||
params.append('limit', ACTIVITY_FETCH_LIMIT)
|
params.append('limit', ACTIVITY_FETCH_LIMIT)
|
||||||
|
|
||||||
const response = await axios.get(generateOcsUrl(`apps/activity/api/v2/activity/${this.filter}`) + '?' + params)
|
const response = await axios.get(
|
||||||
|
generateOcsUrl(`apps/activity/api/v2/activity/${this.filter}`) + '?' + params,
|
||||||
|
{
|
||||||
|
validateStatus: (status) => {
|
||||||
|
return (status >= 200 && status < 300) || status === 304
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if (response.status === 304) {
|
||||||
|
this.endReached = true
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
let activities = response.data.ocs.data
|
let activities = response.data.ocs.data
|
||||||
if (this.filter === 'deck') {
|
if (this.filter === 'deck') {
|
||||||
// We need to manually filter activities here, since currently we use two different types and there is no way
|
// We need to manually filter activities here, since currently we use two different types and there is no way
|
||||||
@@ -95,7 +108,7 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.activities.push(...activities)
|
this.activities.push(...activities)
|
||||||
if (response.data.ocs.meta.statuscode === 304 || activities.length === 0) {
|
if (activities.length === 0) {
|
||||||
this.endReached = true
|
this.endReached = true
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user