Skip to content

Commit

Permalink
fix: Prevent ADs and chairs from added to bethere constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert committed Feb 17, 2023
1 parent 9eb113a commit f9072f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions ietf/secr/sreq/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ def clean_joint_with_groups(self):
def clean_comments(self):
return clean_text_field(self.cleaned_data['comments'])

def clean_bethere(self):
extra = set(Person.objects.filter(role__group=self.group, role__name__in=['chair','ad']) & self.cleaned_data['bethere'])
if extra:
extras = ", ".join(e.name for e in extra)
raise forms.ValidationError(f"Please remove the following persons, the system tracks their availability due to their roles: {extras}.")
return True

def clean_send_notifications(self):
return True if not self.notifications_optional else self.cleaned_data['send_notifications']

Expand Down
2 changes: 1 addition & 1 deletion ietf/secr/templates/includes/sessions_request_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{{ form.bethere.errors }}
{{ form.bethere }}
<p class="fw-bold text-danger">
You should not include the Area Directors; they will be added automatically.
Do not include Area Directors and WG Chairs; the system already tracks their availability.
</p>
</td>
</tr>
Expand Down
6 changes: 3 additions & 3 deletions ietf/static/js/session_details_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@

function update_name_field_visibility(name_elts, purpose) {
if (!purpose || purpose === 'regular') {
name_elts.forEach(e => e.closest('.form-group').classList.add('hidden'));
name_elts.forEach(e => e.closest('.form-group') ? e.closest('.form-group').classList.add('hidden') : null);
} else {
name_elts.forEach(e => e.closest('.form-group').classList.remove('hidden'));
name_elts.forEach(e => e.closest('.form-group') ? e.closest('.form-group').classList.remove('hidden') : null);
}
}

Expand Down Expand Up @@ -113,4 +113,4 @@
}
}
window.addEventListener('load', on_load, false);
})();
})();

0 comments on commit f9072f7

Please sign in to comment.