Merged in [13717] from rjsparks@nostrum.com:

Actually use the topic audience type in the feedback view. Fixes #2320.
 - Legacy-Id: 13728
Note: SVN reference [13717] has been migrated to Git commit 9638cb2e397beab18f3607b324518fd2900215f7
This commit is contained in:
Henrik Levkowetz 2017-06-29 12:52:25 +00:00
parent 22f181cdbe
commit 3c727106a2
3 changed files with 104 additions and 0 deletions

View file

@ -1,3 +1,67 @@
ietfdb (6.55.2) ietf; urgency=medium
This release contains bugfixes and code refactoring:
* Modified the text shown on Chairs' 'Manage Document Adoption in Group'
button and corrected the logic for which text to show.
* Merged in [13722] and [13712] from rcross@amsl.com:
Remove all use of request.session from secretariat apps. Add tests for
affected views. Fixes #1455.
* Removed the copy of xym copied directly from repository -- the method
call we use is too unstable at the moment. Now requiring xym=='0.4'.
* Merged in [13628] from rcross@amsl.com:
Grant secretariat meeting__meeting admin permissions.
* Added checks for the presence of yang module directories to the check
framework. Tweaked some text strings.
* Modified the yang checker to work with both versions 0.3.x and 0.4.x of
xym (different signatures for get_extracted_models()).
* Removed the 'apply to all sessions' checkbox from the
agenda/minutes/slides upload pages for non-session timeslots, such as
plenaries etc. as it is rarely if ever correct to have it checked then.
* Additional tweaks to the mailman listinfo importer.
* Code reorganization, doing away with multiple urls_* and views_ files
in ietf.group. No intentional functionality changes.
* Made the import_mailman_listinfo management command somewhat more
robust.
* Return a checker None result with exception message on xym exceptions.
* Changed the url coverage code to handle deeper chains of url includes,
and to handle url includes through url lists in addition to url modules.
Added information in the release coverage dictionaries about the view
functions coupled to the urls.
* Fixed a wrong virtualenv path in bin/mm_hourly
* Updated PLAN
* Updated docker/settings_local.py with new needed settings. Added a lot
of quotes to docker/run in order to work better with paths containsing
spaces. Touched a file during setup to be more debian compatible.
* Variable naming tweak
* Catch bad module names in the Yang checker (they are not currently
flagged by xym).
* Changed the implementation of Submission.latest_checks() to also return
None checks, so it's possible to update a Passed due to no yang modules to
a None (no modules to check).
* Corrected the settings names used in the yang extraction command.
-- Henrik Levkowetz <henrik@levkowetz.com> 28 Jun 2017 10:43:38 -0700
ietfdb (6.55.1) ietf; urgency=medium
This is a bugfix release, with some smaller enhancements. From the commit

View file

@ -1992,3 +1992,33 @@ class TopicTests(TestCase):
self.assertContains(response, "alert-success")
self.assertNotContains(response, "feedbackform")
self.assertEqual(topic.feedback_set.count(),1)
def testAudience(self):
for audience in ['nomcom','nominee']:
topic = TopicFactory(nomcom=self.nc,audience_id=audience)
feedback_url = reverse('ietf.nomcom.views.public_feedback',kwargs={'year':self.nc.year() })
login_testing_unauthorized(self, self.plain_person.user.username, feedback_url)
r = self.client.get(feedback_url)
self.assertEqual(r.status_code,200)
self.assertFalse(topic.subject in unicontent(r))
topic_url = feedback_url + '?topic=%d'%topic.pk
r = self.client.get(topic_url)
self.assertEqual(r.status_code,404)
r = self.client.post(topic_url, {'comments':'junk', 'confirmation':False})
self.assertEqual(r.status_code,404)
self.client.logout()
if audience == 'nomcom':
valid_user = self.nc.group.role_set.filter(name='member').first().person
else:
valid_user = self.nc.nominee_set.first().person
self.client.login(username=valid_user.user.username,password=valid_user.user.username+"+password")
r = self.client.get(feedback_url)
self.assertEqual(r.status_code,200)
self.assertTrue(topic.subject in unicontent(r))
r = self.client.get(topic_url)
self.assertEqual(r.status_code,200)
r = self.client.post(topic_url, {'comments':'junk', 'confirmation':False})
self.assertEqual(r.status_code,200)
self.assertEqual(topic.feedback_set.count(),1)
self.client.logout()

View file

@ -426,6 +426,10 @@ def feedback(request, year, public):
selected_topic = request.GET.get('topic')
if selected_topic:
topic = get_object_or_404(Topic,id=selected_topic)
if topic.audience_id == 'nomcom' and not nomcom.group.has_role(request.user, ['chair','advisor','liaison','member']):
raise Http404()
if topic.audience_id == 'nominee' and not nomcom.nominee_set.filter(person=request.user.person).exists():
raise Http404()
if public:
positions = Position.objects.get_by_nomcom(nomcom=nomcom).filter(is_open=True,accepting_feedback=True)
@ -434,6 +438,12 @@ def feedback(request, year, public):
positions = Position.objects.get_by_nomcom(nomcom=nomcom).filter(is_open=True)
topics = Topic.objects.filter(nomcom=nomcom)
if not nomcom.group.has_role(request.user, ['chair','advisor','liaison','member']):
topics = topics.exclude(audience_id='nomcom')
if not nomcom.nominee_set.filter(person=request.user.person).exists():
topics = topics.exclude(audience_id='nominee')
user_comments = Feedback.objects.filter(nomcom=nomcom,
type='comment',
author__in=request.user.person.email_set.filter(active='True'))