Skip to content

Commit

Permalink
Display escalation address for teams that provide one (#3484)
Browse files Browse the repository at this point in the history
* progress

* Rephrase and add privacy team email.

* Updated tests
  • Loading branch information
jrobbins authored Nov 9, 2023
1 parent 1dfaaf3 commit 5bc02ca
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.
1 change: 1 addition & 0 deletions api/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ def gate_value_to_json_dict(gate: Gate) -> dict[str, Any]:
'gate_type': gate.gate_type,
'team_name': appr_def.team_name if appr_def else 'Team',
'gate_name': appr_def.name if appr_def else 'Gate',
'escalation_email': appr_def.escalation_email if appr_def else None,
'state': gate.state,
'requested_on': requested_on, # YYYY-MM-DD HH:MM:SS or None
'responded_on': responded_on, # YYYY-MM-DD HH:MM:SS or None
Expand Down
2 changes: 2 additions & 0 deletions api/converters_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ def test_minimal(self):
'gate_type': 3,
'team_name': appr_def.team_name,
'gate_name': appr_def.name,
'escalation_email': None,
'state': 4,
'requested_on': None,
'responded_on': None,
Expand Down Expand Up @@ -543,6 +544,7 @@ def test_maxmimal(self, mock_now):
'gate_type': 34,
'team_name': appr_def.team_name,
'gate_name': appr_def.name,
'escalation_email': '[email protected]',
'state': 4,
'requested_on': '2022-12-14 01:02:03',
'responded_on': None,
Expand Down
1 change: 1 addition & 0 deletions api/reviews_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ def test_do_get__success(self, mock_get_approvers):
"gate_type": 1,
"team_name": "API Owners",
"gate_name": "Intent to Prototype",
"escalation_email": None,
"state": 1,
"requested_on": None,
"responded_on": None,
Expand Down
14 changes: 10 additions & 4 deletions client-src/elements/chromedash-gate-column.js
Original file line number Diff line number Diff line change
Expand Up @@ -840,21 +840,27 @@ export class ChromedashGateColumn extends LitElement {
>${checkboxLabel}</sl-checkbox>
` :
nothing);
const escalation = this.gate.escalation_email ?
html`If needed, you can
<a href="mailto:${this.gate.escalation_email}" target="_blank"
>email the team directly</a>.` :
nothing;

return html`
<sl-textarea id="comment_area" rows=2 cols=40 ${ref(this.commentAreaRef)}
@sl-change=${this.checkNeedsPost}
@keypress=${this.checkNeedsPost}
placeholder="Add a comment"
></sl-textarea>
<div class="instructions">
Comments will be visible publicly.
Only reviewers will be notified when a comment is posted.
</div>
<div id="controls">
${postButton}
${postToThreadCheckbox}
</div>
<div class="instructions">
Comments will be visible publicly.
Only reviewers will be notified when a comment is posted.
${escalation}
</div>
`;
}

Expand Down
3 changes: 3 additions & 0 deletions internals/approval_defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class ApprovalFieldDef:
rule: str
approvers: str | list[str]
team_name: str
escalation_email: str | None = None
slo_initial_response: int = DEFAULT_SLO_LIMIT


Expand Down Expand Up @@ -96,13 +97,15 @@ class ApprovalFieldDef:
'Privacy OT Review',
core_enums.GATE_PRIVACY_ORIGIN_TRIAL, ONE_LGTM,
approvers=PRIVACY_APPROVERS, team_name='Privacy',
escalation_email='[email protected]',
slo_initial_response=6)

PrivacyShipApproval = ApprovalFieldDef(
'Privacy Ship Review',
'Privacy Ship Review',
core_enums.GATE_PRIVACY_SHIP, ONE_LGTM,
approvers=PRIVACY_APPROVERS, team_name='Privacy',
escalation_email='[email protected]',
slo_initial_response=6)

SecurityOriginTrialApproval = ApprovalFieldDef(
Expand Down
9 changes: 5 additions & 4 deletions internals/processes_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
BAKE_APPROVAL_DEF_DICT = collections.OrderedDict([
('name', 'Approval for baking'),
('team_name', 'Chef'),
('escalation_email', None),
('description', 'The head chef must approve of you using the oven'),
('field_id', 9),
('rule', approval_defs.ONE_LGTM),
Expand All @@ -55,10 +56,10 @@ def test_process_to_dict(self):
'Make it before you are hungry',
[processes.ProcessStage(
'Make dough',
'Mix it and kneed',
'Mix it and knead',
[PI_COLD_DOUGH],
[processes.Action(
'Share kneeding video', 'https://example.com', [])],
'Share kneading video', 'https://example.com', [])],
[],
0, 1, STAGE_BAKE_DOUGH),
processes.ProcessStage(
Expand All @@ -75,10 +76,10 @@ def test_process_to_dict(self):
'applicability': 'Make it before you are hungry',
'stages': [
{'name': 'Make dough',
'description': 'Mix it and kneed',
'description': 'Mix it and knead',
'progress_items': [{'name': 'Cold dough', 'field': 'dough'}],
'actions': [{
'name': 'Share kneeding video',
'name': 'Share kneading video',
'url': 'https://example.com',
'prerequisites': []}],
'approvals': [],
Expand Down

0 comments on commit 5bc02ca

Please sign in to comment.