Skip to content

Commit

Permalink
Merge branch 'blockDeletingWorkflow-566' into 'main'
Browse files Browse the repository at this point in the history
Bloqueio de exclusões no OJS após submissão

See merge request softwares-pkp/plugins_ojs/dataverse!135
  • Loading branch information
JhonathanLepidus committed Jul 28, 2023
2 parents 0bbef7c + c9f1a0c commit 87b3865
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
14 changes: 14 additions & 0 deletions cypress/tests/Test03_ResearchDataDeposit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,21 @@ describe('Research data deposit', function () {
dataverseServerName = citation.text().split(',')[5].trim();
});
});
it('Check author if options are disabled for authors without edit permission', function () {
cy.login('ckwantes', null, 'publicknowledge');
cy.visit('index.php/publicknowledge/authorDashboard/submission/' + submission.id);

cy.get('button[aria-controls="publication"]').click();
cy.get('button[aria-controls="datasetTab"]').click();

cy.contains('Delete research data').should('be.disabled');
cy.get('div[aria-labelledby="dataset_metadata-button"] > form button[label="Save"]').should('be.disabled');

cy.get('button[aria-controls="dataset_files"]').click();
cy.contains('Add research data').should('be.enabled');

cy.get('#datasetFiles .listPanel__item button:contains(Delete)').should('be.disabled');
});
it('Check author can edit research data metadata', function () {
if (Cypress.env('contextTitles').en_US !== 'Public Knowledge Preprint Server') {
cy.allowAuthorToEditPublication('dbarnes', null, 'Catherine Kwantes');
Expand Down
4 changes: 4 additions & 0 deletions js/DataverseWorkflowPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ var DataverseWorkflowPage = $.extend(true, {}, pkp.controllers.WorkflowPage, {
return this.components.datasetFiles.items.length === 0;
},

userCanEditDataset: function () {
return this.canEditPublication;
},

datasetIsPublished: function () {
return this.dataset.versionState === 'RELEASED';
},
Expand Down
4 changes: 2 additions & 2 deletions templates/datasetTab/datasetData.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<pkp-button
@click="openDeleteDatasetModal"
:is-warnable="true"
:disabled="datasetIsPublished"
:disabled="datasetIsPublished || !userCanEditDataset"
>
{translate key="plugins.generic.dataverse.researchData.delete"}
</pkp-button>
Expand Down Expand Up @@ -64,7 +64,7 @@
<pkp-button
@click="openDeleteFileModal(item.item.id)"
class="pkpButton--isWarnable"
:disabled="datasetIsPublished"
:disabled="datasetIsPublished || !userCanEditDataset"
>
{{ __('common.delete') }}
</pkp-button>
Expand Down
2 changes: 1 addition & 1 deletion version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<version>
<application>dataverse</application>
<type>plugins.generic</type>
<release>2.3.9.0</release>
<release>2.3.10.0</release>
<date>2023-07-28</date>
<lazy-load>1</lazy-load>
<class>DataversePlugin</class>
Expand Down

0 comments on commit 87b3865

Please sign in to comment.