Skip to content

Fixes a bug where submit_info would clear CI.#4420

Merged
joemull merged 3 commits into
r-v1.7.xfrom
b-ci-bugfix
Sep 25, 2024
Merged

Fixes a bug where submit_info would clear CI.#4420
joemull merged 3 commits into
r-v1.7.xfrom
b-ci-bugfix

Conversation

@ajrbyers

@ajrbyers ajrbyers commented Sep 24, 2024

Copy link
Copy Markdown
Member

Closes #4421

  • Removes competing_interests from ArticleInfo base class
  • Adds new child class EditArticleMetadata which inherits from ArticleInfo
  • EditArticleMetadata adds competing_interests as one of its fields

Comment thread src/submission/forms.py Outdated
@mauromsl mauromsl requested a review from joemull September 24, 2024 19:35
@ajrbyers ajrbyers linked an issue Sep 24, 2024 that may be closed by this pull request
@mauromsl mauromsl assigned joemull and unassigned mauromsl Sep 25, 2024

@joemull joemull left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These changes seem to make ArticleInfo into an abstract base, but we do not explicitly say that anywhere that I can tell. Can we document it as that, so we don't use it by itself anywhere later?

We should also change this test to use the new class, right?

def test_edit_section(self):
""" Ensures editors can select sections that are not submissible"""
article = models.Article.objects.create(
journal=self.journal_one,
title="Test article: a test of sections",
)
with translation.override("en"):
section = models.Section.objects.create(
journal=self.journal_one,
name="section",
public_submissions=False,
)
form = forms.ArticleInfo(instance=article)
self.assertTrue(section in form.fields["section"].queryset)

@mauromsl

mauromsl commented Sep 25, 2024

Copy link
Copy Markdown
Member

These changes seem to make ArticleInfo into an abstract base, but we do not explicitly say that anywhere that I can tell. Can we document it as that, so we don't use it by itself anywhere later?

We should also change this test to use the new class, right?

def test_edit_section(self):
""" Ensures editors can select sections that are not submissible"""
article = models.Article.objects.create(
journal=self.journal_one,
title="Test article: a test of sections",
)
with translation.override("en"):
section = models.Section.objects.create(
journal=self.journal_one,
name="section",
public_submissions=False,
)
form = forms.ArticleInfo(instance=article)
self.assertTrue(section in form.fields["section"].queryset)

FYI: I don't think we should change the tests, the behaviour is still implemented in ArticleInfo and thus, it is the correct class member to run the test on.

The current abstraction is a bit leaky (why does ArticleInfo take a special argument called editor_view if we already have EditorArticleInfoSubmit)

@ajrbyers my suggestion would be to raise a separate issue to fix the abstraction here but for the sake of this feature, don't refactor these forms just yet.

@ajrbyers

Copy link
Copy Markdown
Member Author

@joemull are you happy with @mauromsl's suggestion above?

@joemull

joemull commented Sep 25, 2024

Copy link
Copy Markdown
Member

@joemull are you happy with @mauromsl's suggestion above?

Yes, as long as we document it by putting a docstring on the class or opening a new issue.

@joemull joemull assigned ajrbyers and unassigned joemull Sep 25, 2024
@ajrbyers ajrbyers mentioned this pull request Sep 25, 2024
@ajrbyers ajrbyers assigned joemull and unassigned ajrbyers Sep 25, 2024
@ajrbyers ajrbyers requested a review from joemull September 25, 2024 12:15
@joemull joemull merged commit 83a1314 into r-v1.7.x Sep 25, 2024
@joemull joemull deleted the b-ci-bugfix branch September 25, 2024 12:26
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.

Competing Interests are wiped by during submission

3 participants