Skip to content
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
15 changes: 13 additions & 2 deletions lib/osf-components/addon/components/file-actions-menu/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { inject as service } from '@ember/service';
import Media from 'ember-responsive';
import File from 'ember-osf-web/packages/files/file';
import StorageManager from 'osf-components/components/storage-provider-manager/storage-manager/component';
import OsfStorageFile from 'ember-osf-web/packages/files/osf-storage-file';

interface Args {
item: File;
Expand Down Expand Up @@ -52,7 +53,17 @@ export default class FileActionsMenu extends Component<Args> {
}

get showSubmitToBoa() {
const { item } = this.args;
return this.isBoaEnabled && item.isBoaFile && item.providerIsOsfstorage && item.currentUserCanDelete;
const { item, manager } = this.args;
if (item.providerIsOsfstorage) {
let userCanUploadToHere;
if (manager) {
userCanUploadToHere = manager.currentFolder.userCanUploadToHere;
} else {
const parentFolder = new OsfStorageFile(item.currentUser, item.fileModel.get('parentFolder'));
userCanUploadToHere = parentFolder.userCanUploadToHere;
}
return this.isBoaEnabled && item.isBoaFile && userCanUploadToHere;
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ interface Args {
export default class SubmitToBoaModal extends Component<Args> {
@service toast!: Toastr;
@service intl!: IntlService;
datasets?: string[];
@tracked selectedDataset?: string;

datasets = [
Expand Down Expand Up @@ -63,6 +62,7 @@ export default class SubmitToBoaModal extends Component<Args> {
nodeId: fileModel.target.get('id'),
name: file.name,
materialized: fileModel.materializedPath,
sizeInt: fileModel.size,
links: {
download: file.links.download,
upload: file.links.upload,
Expand Down
1 change: 1 addition & 0 deletions mirage/scenarios/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export function dashboardScenario(server: Server, currentUser: ModelInstance<Use
server.create('file', {
id: 'snake',
name: 'snake.boa',
checkout: currentUser.id,
target: filesNode,
parentFolder: filesNodeOsfStorage.rootFolder,
});
Expand Down