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

[NEW][Apps] Add a new upload API #18955

Merged
merged 10 commits into from
Sep 22, 2020
9 changes: 9 additions & 0 deletions app/apps/server/bridges/uploads.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,13 @@ export class AppUploadBridge {
});
});
}

createUpload(details, buffer, appId) {
this.orch.debugLog(`The App ${ appId } is creating an upload "${ details.name }"`);

const fileStore = FileUpload.getStore('Uploads');
const uploadedFile = fileStore.insertSync(details, buffer);

return this.orch.getConverters().get('uploads').convertToApp(uploadedFile);
}
}
2 changes: 1 addition & 1 deletion app/file-upload/server/lib/FileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const FileUpload = {
const room = Rooms.findOneById(file.rid);
const directMessageAllowed = settings.get('FileUpload_Enabled_Direct');
const fileUploadAllowed = settings.get('FileUpload_Enabled');
if (canAccessRoom(room, user, file) !== true) {
if (canAccessRoom(room, user, file) !== true && user.type !== 'app') {
d-gubert marked this conversation as resolved.
Show resolved Hide resolved
return false;
}
const language = user ? user.language : 'en';
Expand Down
152 changes: 124 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading