diff --git a/opentech/apply/dashboard/templates/dashboard/partner_dashboard.html b/opentech/apply/dashboard/templates/dashboard/partner_dashboard.html index e788f07720034182195c6f27aa84f5b3ae0059b1..35292f0e0be72220f52bae7ac5bf886091c19369 100644 --- a/opentech/apply/dashboard/templates/dashboard/partner_dashboard.html +++ b/opentech/apply/dashboard/templates/dashboard/partner_dashboard.html @@ -27,13 +27,6 @@ {% endif %} </div> - {% if my_reviewed.data %} - <div class="wrapper wrapper--bottom-space"> - <h4 class="heading heading--normal">Your previous reviews</h4> - {% render_table my_reviewed %} - </div> - {% endif %} - <div class="wrapper wrapper--bottom-space"> <h4 class="heading heading--normal">Your active submissions</h4> {% for submission in my_submissions %} diff --git a/opentech/apply/dashboard/views.py b/opentech/apply/dashboard/views.py index acfcb49296d9ffbfc4ddad2b5900102a53f5d551..30fef7f50e5c713e05269ca61d76fcac2846ab42 100644 --- a/opentech/apply/dashboard/views.py +++ b/opentech/apply/dashboard/views.py @@ -225,16 +225,10 @@ class PartnerDashboardView(TemplateView): def get_partner_submissions(self, user, qs): partner_submissions_qs = qs.partner_for(user).order_by('-submit_time') - partner_submissions_table = ReviewerSubmissionsTable(partner_submissions_qs, prefix='my-partnered-') + partner_submissions_table = SubmissionsTable(partner_submissions_qs, prefix='my-partnered-') return partner_submissions_qs, partner_submissions_table - def get_my_reviewed(self, request, qs): - my_reviewed_qs = qs.reviewed_by(request.user).order_by('-submit_time') - my_reviewed_table = ReviewerSubmissionsTable(my_reviewed_qs, prefix='my-reviewed-') - - return my_reviewed_qs, my_reviewed_table - def get_my_submissions(self, request, qs): my_submissions = qs.filter( user=request.user @@ -256,16 +250,12 @@ class PartnerDashboardView(TemplateView): # Submissions in which user added as partner partner_submissions_qs, partner_submissions = self.get_partner_submissions(self.request.user, qs) - # Partner's reviewed submissions - my_reviewed_qs, my_reviewed = self.get_my_reviewed(self.request, qs) - # Applications by partner my_submissions, my_inactive_submissions = self.get_my_submissions(self.request, qs) context.update({ 'partner_submissions': partner_submissions, 'partner_submissions_count': partner_submissions_qs.count(), - 'my_reviewed': my_reviewed, 'my_submissions': my_submissions, 'my_inactive_submissions': my_inactive_submissions, }) diff --git a/opentech/apply/funds/migrations/0071_update_field_reviewer.py b/opentech/apply/funds/migrations/0071_update_field_reviewer.py new file mode 100644 index 0000000000000000000000000000000000000000..c657f46e26496aec3f1444cf4dbd916ce76ef182 --- /dev/null +++ b/opentech/apply/funds/migrations/0071_update_field_reviewer.py @@ -0,0 +1,20 @@ +# Generated by Django 2.1.11 on 2019-12-05 13:13 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('funds', '0070_rename_meta_categories_to_meta_terms'), + ] + + operations = [ + migrations.AlterField( + model_name='assignedreviewers', + name='reviewer', + field=models.ForeignKey(limit_choices_to={'groups__name__in': ['Staff', 'Reviewer', 'Community reviewer']}, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/opentech/apply/funds/models/submissions.py b/opentech/apply/funds/models/submissions.py index 857d79b8071b64d7735c13f5d5681f342b754560..8c1436d400bf5cbe2831edc1606991126ad28375 100644 --- a/opentech/apply/funds/models/submissions.py +++ b/opentech/apply/funds/models/submissions.py @@ -46,7 +46,6 @@ from .utils import ( LIMIT_TO_STAFF, LIMIT_TO_REVIEWER_GROUPS, LIMIT_TO_PARTNERS, - PARTNER_GROUP_NAME, REVIEW_GROUPS, REVIEWER_GROUP_NAME, STAFF_GROUP_NAME, @@ -645,8 +644,7 @@ class ApplicationSubmission( def missing_reviewers(self): reviewers_submitted = self.assigned.reviewed().values('reviewer') reviewers = self.reviewers.exclude(id__in=reviewers_submitted) - partners = self.partners.exclude(id__in=reviewers_submitted) - return reviewers.union(partners) + return reviewers @property def staff_not_reviewed(self): @@ -656,10 +654,6 @@ class ApplicationSubmission( def reviewers_not_reviewed(self): return self.missing_reviewers.reviewers().exclude(id__in=self.staff_not_reviewed) - @property - def partners_not_reviewed(self): - return self.missing_reviewers.partners().exclude(id__in=self.staff_not_reviewed) - def reviewed_by(self, user): return self.assigned.reviewed().filter(reviewer=user).exists() @@ -677,9 +671,6 @@ class ApplicationSubmission( if user in self.reviewers_not_reviewed: return True - if user in self.partners_not_reviewed: - return True - if user.is_community_reviewer and self.user != user and self.community_review and not self.reviewed_by(user): return True @@ -822,7 +813,6 @@ class AssignedReviewersQuerySet(models.QuerySet): def review_order(self): review_order = [ STAFF_GROUP_NAME, - PARTNER_GROUP_NAME, COMMUNITY_REVIEWER_GROUP_NAME, REVIEWER_GROUP_NAME, ] @@ -892,9 +882,7 @@ class AssignedReviewersQuerySet(models.QuerySet): def get_or_create_for_user(self, submission, reviewer): groups = set(reviewer.groups.values_list('name', flat=True)) & set(REVIEW_GROUPS) if len(groups) > 1: - if PARTNER_GROUP_NAME in groups and reviewer in submission.partners.all(): - groups = {PARTNER_GROUP_NAME} - elif COMMUNITY_REVIEWER_GROUP_NAME in groups: + if COMMUNITY_REVIEWER_GROUP_NAME in groups: groups = {COMMUNITY_REVIEWER_GROUP_NAME} elif reviewer.is_apply_staff: groups = {STAFF_GROUP_NAME} diff --git a/opentech/apply/funds/models/utils.py b/opentech/apply/funds/models/utils.py index 582a1df10f2682a4de9fe9b50c3dc542b94af5f7..cd51d1ed523354886bf12f000e5b8dfb59b4c88c 100644 --- a/opentech/apply/funds/models/utils.py +++ b/opentech/apply/funds/models/utils.py @@ -21,7 +21,6 @@ REVIEW_GROUPS = [ STAFF_GROUP_NAME, REVIEWER_GROUP_NAME, COMMUNITY_REVIEWER_GROUP_NAME, - PARTNER_GROUP_NAME, ] LIMIT_TO_STAFF = {'groups__name': STAFF_GROUP_NAME} LIMIT_TO_REVIEWERS = {'groups__name': REVIEWER_GROUP_NAME} diff --git a/opentech/apply/funds/templates/funds/applicationsubmission_partner_detail.html b/opentech/apply/funds/templates/funds/applicationsubmission_partner_detail.html deleted file mode 100644 index f6ce10384853bd6ac87963f5ee0e8087b201248e..0000000000000000000000000000000000000000 --- a/opentech/apply/funds/templates/funds/applicationsubmission_partner_detail.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "funds/applicationsubmission_detail.html" %} -{% load static workflow_tags review_tags determination_tags %} - -{% block reviews %} - <div class="sidebar__inner"> - <h5>Reviews & assignees</h5> - - {% include 'funds/includes/review_sidebar.html' %} - - <div class="wrapper wrapper--sidebar-buttons"> - {% include 'review/includes/review_button.html' with submission=object class="button--half-width" %} - </div> - </div> -{% endblock %} - -{% block related %} -{% endblock %} - -{% block extra_js %} - {{ reviewer_form.media.js }} - {{ comment_form.media.js }} - {{ block.super }} - <script src="{% static 'js/apply/toggle-reviewers.js' %}"></script> - <script src="{% static 'js/apply/toggle-sidebar.js' %}"></script> -{% endblock %} diff --git a/opentech/apply/funds/templates/funds/includes/review_sidebar_item.html b/opentech/apply/funds/templates/funds/includes/review_sidebar_item.html index 46f116dad65750daac59ffff4e64daee1a1474b6..4040de06b17f883ee8e96c52506f8ed7421e6efb 100644 --- a/opentech/apply/funds/templates/funds/includes/review_sidebar_item.html +++ b/opentech/apply/funds/templates/funds/includes/review_sidebar_item.html @@ -9,7 +9,7 @@ <div>-</div> <div>-</div> {% else %} - {% if request.user == reviewer.reviewer or request.user.is_reviewer and reviewer.review.reviewer_visibility or request.user.is_partner and reviewer.review.reviewer_visibility or request.user.is_community_reviewer and reviewer.review.reviewer_visibility or request.user.is_apply_staff %} + {% if request.user == reviewer.reviewer or request.user.is_reviewer and reviewer.review.reviewer_visibility or request.user.is_community_reviewer and reviewer.review.reviewer_visibility or request.user.is_apply_staff %} <div> <a href="{% url 'apply:submissions:reviews:review' submission_pk=reviewer.submission.id pk=reviewer.review.id %}"> <div class="reviews-sidebar__name"> diff --git a/opentech/apply/funds/views.py b/opentech/apply/funds/views.py index bd85a504b60df71597c0aa34a736f5c7eaa1ddc2..a4587b8ffe2cc3d445ae1f50ecf0360323e410a7 100644 --- a/opentech/apply/funds/views.py +++ b/opentech/apply/funds/views.py @@ -604,21 +604,23 @@ class ReviewerSubmissionDetailView(ReviewContextMixin, ActivityContextMixin, Del def dispatch(self, request, *args, **kwargs): submission = self.get_object() # If the requesting user submitted the application, return the Applicant view. - # Reviewers and partners may somtimes be appliants as well. + # Reviewers may sometimes be applicants as well. if submission.user == request.user: return ApplicantSubmissionDetailView.as_view()(request, *args, **kwargs) return super().dispatch(request, *args, **kwargs) -class PartnerSubmissionDetailView(ReviewContextMixin, ActivityContextMixin, DelegateableView, DetailView): - template_name_suffix = '_partner_detail' +class PartnerSubmissionDetailView(ActivityContextMixin, DelegateableView, DetailView): model = ApplicationSubmission form_views = [CommentFormView] + def get_object(self): + return super().get_object().from_draft() + def dispatch(self, request, *args, **kwargs): submission = self.get_object() # If the requesting user submitted the application, return the Applicant view. - # Reviewers and partners may somtimes be appliants as well. + # Partners may sometimes be applicants as well. if submission.user == request.user: return ApplicantSubmissionDetailView.as_view()(request, *args, **kwargs) # Only allow partners in the submission they are added as partners @@ -636,7 +638,7 @@ class CommunitySubmissionDetailView(ReviewContextMixin, ActivityContextMixin, De def dispatch(self, request, *args, **kwargs): submission = self.get_object() # If the requesting user submitted the application, return the Applicant view. - # Reviewers and partners may somtimes be appliants as well. + # Reviewers may sometimes be applicants as well. if submission.user == request.user: return ApplicantSubmissionDetailView.as_view()(request, *args, **kwargs) # Only allow community reviewers in submission with a community review state. @@ -842,7 +844,7 @@ class PartnerSubmissionEditView(ApplicantSubmissionEditView): def dispatch(self, request, *args, **kwargs): submission = self.get_object() # If the requesting user submitted the application, return the Applicant view. - # Partners may somtimes be appliants as well. + # Partners may somtimes be applicants as well. partner_has_access = submission.partners.filter(pk=request.user.pk).exists() if not partner_has_access and submission.user != request.user: raise PermissionDenied diff --git a/opentech/apply/funds/workflow.py b/opentech/apply/funds/workflow.py index 973c73f65c9be0aea2270a50536382b17bf6289b..76a58579332d984c2889d9454bb8eaaa91387459 100644 --- a/opentech/apply/funds/workflow.py +++ b/opentech/apply/funds/workflow.py @@ -168,13 +168,13 @@ default_permissions = make_permissions(edit=[staff_can], review=[staff_can]) hidden_from_applicant_permissions = make_permissions(edit=[staff_can], review=[staff_can], view=[staff_can, reviewer_can]) -reviewer_review_permissions = make_permissions(edit=[staff_can, partner_can], review=[staff_can, reviewer_can, partner_can]) +reviewer_review_permissions = make_permissions(edit=[staff_can], review=[staff_can, reviewer_can]) community_review_permissions = make_permissions(edit=[staff_can], review=[staff_can, reviewer_can, community_can]) applicant_edit_permissions = make_permissions(edit=[applicant_can, partner_can], review=[staff_can]) -staff_applicant_edit_permissions = make_permissions(edit=[staff_can, applicant_can]) +staff_applicant_edit_permissions = make_permissions(edit=[staff_can, applicant_can, partner_can]) staff_edit_permissions = make_permissions(edit=[staff_can]) diff --git a/opentech/apply/review/views.py b/opentech/apply/review/views.py index 66ef59a46456f42406490b01d834a20e0e912eb8..c9c77125760f7d9fdea87f8083d95e5419f08bb1 100644 --- a/opentech/apply/review/views.py +++ b/opentech/apply/review/views.py @@ -233,7 +233,6 @@ class ReviewDisplay(UserPassesTestMixin, DetailView): user = self.request.user author = review.author.reviewer submission = review.submission - partner_has_access = submission.partners.filter(pk=user.pk).exists() if user.is_apply_staff: return True @@ -244,9 +243,6 @@ class ReviewDisplay(UserPassesTestMixin, DetailView): if user.is_reviewer and review.reviewer_visibility: return True - if user.is_partner and partner_has_access and review.reviewer_visibility and submission.user != user: - return True - if user.is_community_reviewer and submission.community_review and review.reviewer_visibility and submission.user != user: return True @@ -279,7 +275,6 @@ class ReviewOpinionFormView(UserPassesTestMixin, CreateView): user = self.request.user author = review.author.reviewer submission = review.submission - partner_has_access = submission.partners.filter(pk=user.pk).exists() if user.is_apply_staff: return True @@ -290,9 +285,6 @@ class ReviewOpinionFormView(UserPassesTestMixin, CreateView): if user.is_reviewer and review.reviewer_visibility: return True - if user.is_partner and partner_has_access and review.reviewer_visibility and submission.user != user: - return True - if user.is_community_reviewer and submission.community_review and review.reviewer_visibility and submission.user != user: return True