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

Pivotal ID # 187921156: Enable users with ADMIN rights for a collection to set back release dates for public submissions #857

Merged
merged 4 commits into from
Jul 25, 2024

Conversation

Juan-EBI
Copy link
Contributor

Copy link
Contributor

@jhoanmanuelms jhoanmanuelms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please consider my comments

when (val previous = rqt.previousVersion) {
null -> if (releaseTime < today) throw PastReleaseDateException()
else ->
if (previous.released) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block could be simplified by using if (releaseTime != previous.releaseTime) since, once a submission is public, the date shouldn't be modified regardless if it's a past or future date

) {
fun ensureSequence(prefix: String) {
if (sequenceRepository.existsByPrefix(prefix).not()) sequenceRepository.save(DbSequence(prefix))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

@Test
fun `28-2 Modification date is changed beetween re submissions`() =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two tests could be merge into one since they're doing basically the same and the two conditions always have to be satisfied:

  1. Creation date is never changed
  2. Modification date is updated upon resubmission

Actually, we could validate that the modification date for version 2 is always in the future

Copy link
Contributor Author

@Juan-EBI Juan-EBI Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes we can merge it but I think is actually better to have each test and isolated as possible (that test a single feature). We do have that all around but in general the more specialized the better

}

@Nested
inner class NormalUser {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the rest of the tests we've been using RegularUser rather than "Normal". Not saying it couldn't change, just pointing out what's already there

}

@Test
fun `28-4 Normal user re-submit an already released submission with a new release date in the future`() =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of "already released" we should use public

}

@Test
fun `28-5 Normal user re-submit a not released submission with a new release date in the past`() =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of "not released", we should use private

}

@Test
fun `28-7 Admin make a public submission private`() =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a couple of tests to cover this in ResubmissionApiTest. We should remove or migrate those here since they're date related. Specifically

5-4 | regular user suppresses own submission
5-5 | super user suppresses submission from another user

@Juan-EBI Juan-EBI merged commit 47d7bc4 into master Jul 25, 2024
1 check passed
@Juan-EBI Juan-EBI deleted the feature/pivotal-187921156 branch August 7, 2024 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants