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

Allow submitting author status to be transferred to a co-author. Ref #2128 #2131

Merged
merged 3 commits into from
Nov 15, 2023

Conversation

tompollard
Copy link
Member

As discussed in #2128, currently the submitting author of a project cannot be changed. There are times when it would be helpful to allow submitting authors to transfer this status to co-authors. e.g. when:

  • A co-author would like to take responsibility for editing content or uploading files.
  • A project requires updating and the original submitting author is no longer available.

This change adds a 'transfer project' button to the author page of the project submission system.

…2128.

We occasionally ask for submtting author status of a project to be transferred. This change adds a 'transfer project' button to the author page of the project submission system.
@bemoody
Copy link
Collaborator

bemoody commented Nov 14, 2023

Not tested but sounds like a great idea.

If the project is published then only the original submitting author can create a new version. (I have thought that it would be nice to allow any author to do that, but that can be another PR.)

However, we don't want to allow the original submitting author to create two new versions of the same project - does this still prevent that?

@tompollard
Copy link
Member Author

tompollard commented Nov 14, 2023

we don't want to allow the original submitting author to create two new versions of the same project - does this still prevent that?

Good question! I tested this fairly thoroughly and, as far as I can see, it is not possible to create multiple new versions of a project. e.g. if the submitting author creates a new version and transfers the new version to a co-author, it is not possible to create a second new version.

I think the logic that prevents multiple new versions is defined here:

def new_project_version(request, project_slug):
"""
Publish a new version of a project
"""
if settings.SYSTEM_MAINTENANCE_NO_UPLOAD:
raise ServiceUnavailable()
user = request.user
n_submitting = Author.objects.filter(user=user, is_submitting=True,
content_type=ContentType.objects.get_for_model(ActiveProject)).count()
if n_submitting >= ActiveProject.MAX_SUBMITTING_PROJECTS:
return render(request, 'project/project_limit_reached.html',
{'max_projects':ActiveProject.MAX_SUBMITTING_PROJECTS})
previous_projects = PublishedProject.objects.filter(
slug=project_slug).order_by('-version_order')
latest_project = previous_projects.first()
# Only submitting author can make new. Also can only have one new version
# of this project out at a time.
if not latest_project.can_publish_new(user):
return redirect('project_home')

... and here:

def can_publish_new(self, user):
"""
Whether the user can publish a new version of this project
"""
if user == self.submitting_user() and not self.core_project.active_new_version():
return True
return False

@bemoody
Copy link
Collaborator

bemoody commented Nov 14, 2023

Sounds good, thanks for checking.

Could you add a test case in project/test_views.py? It looks like the demo "MIMIC-III Clinical Database" (slug = T108xFtYkRAxiRiuOLEJ) has rgmark as submitting author and aewj as a coauthor, so we should be test reassigning it.

@tompollard
Copy link
Member Author

@bemoody Test case added!

@bemoody
Copy link
Collaborator

bemoody commented Nov 15, 2023

+        self.assertTrue(self.submitting_author.user.email, self.AUTHOR_EMAIL)
+        self.assertTrue(self.coauthor.user.email, self.COAUTHOR_EMAIL)

You mean assertEqual here.

@tompollard tompollard force-pushed the tp/switch_submitting_author branch from f38d11c to 84141fa Compare November 15, 2023 18:59
@tompollard
Copy link
Member Author

You mean assertEqual here.

Good catch, now fixed.

@bemoody bemoody merged commit 80e589a into dev Nov 15, 2023
8 checks passed
@tompollard tompollard deleted the tp/switch_submitting_author branch November 15, 2023 21: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.

2 participants