Skip to content

Commit ae616e9

Browse files
committed
Rename mitigate_risks and guard GoogleAuth init
Rename the stage key `mitigate_risks` to `mitigate_risk` across components and the contentTranslation model to keep stage names consistent (editWhatnow.vue, whatnowContentItem.vue, whatnowSummary.vue, store/models/contentTranslation.js). Also add a guard around GoogleAuth initialization in app.js using optional chaining to avoid errors when a Google client_id is not present. Minor whitespace/CSS newline cleanup in whatnowContentItem.vue/whatnowSummary.vue.
1 parent 54c0445 commit ae616e9

22 files changed

Lines changed: 71 additions & 64 deletions

File tree

app/Classes/RcnApi/Entities/InstructionTranslation.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class InstructionTranslation implements \JsonSerializable, Arrayable
1212
'warning',
1313
'anticipated',
1414
'assess_and_plan',
15-
'mitigate_risks',
15+
'mitigate_risk',
1616
'prepare_to_respond',
1717
'recover'
1818
];
@@ -47,11 +47,11 @@ class InstructionTranslation implements \JsonSerializable, Arrayable
4747
public static function createFromRequest(array $array)
4848
{
4949
$translation = new self();
50-
$translation->lang = $array['lang'];
51-
$translation->webUrl = $array['webUrl'];
52-
$translation->title = $array['title'];
53-
$translation->description = $array['description'];
54-
$translation->stages = new Collection($array['stages']);
50+
$translation->lang = $array['lang'];
51+
$translation->webUrl = $array['webUrl'];
52+
$translation->title = $array['title'];
53+
$translation->description = $array['description'];
54+
$translation->stages = new Collection($array['stages']);
5555
return $translation;
5656
}
5757

@@ -60,12 +60,12 @@ public static function createFromResponse(array $array)
6060
{
6161
$translation = new self();
6262

63-
$translation->id = $array['id'];
64-
$translation->lang = $array['lang'];
65-
$translation->webUrl = $array['webUrl'];
66-
$translation->title = $array['title'];
67-
$translation->description = $array['description'];
68-
$translation->stages = new Collection($array['stages']);
63+
$translation->id = $array['id'];
64+
$translation->lang = $array['lang'];
65+
$translation->webUrl = $array['webUrl'];
66+
$translation->title = $array['title'];
67+
$translation->description = $array['description'];
68+
$translation->stages = new Collection($array['stages']);
6969
$translation->createdAt = new \DateTimeImmutable($array['createdAt']);
7070
$translation->published = $array['published'];
7171
return $translation;

app/Classes/RcnApi/Importer/BulkUploadTemplateExport.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,31 @@ class BulkUploadTemplateExport implements FromArray, ShouldAutoSize, WithEvents
2323
private $nationalSociety;
2424
private $region;
2525
private $headings = [
26-
'Title', 'Description', 'URL', 'Hazard', 'Urgency Level', 'Safety Message'
26+
'Title',
27+
'Description',
28+
'URL',
29+
'Hazard',
30+
'Urgency Level',
31+
'Safety Message'
2732
];
28-
private $urgencyLevels = '"Immediate,Warning,Anticipated,Assess and Plan,Mitigate Risks,Prepare to Respond,Recover"';
33+
private $urgencyLevels = '"Immediate,Warning,Anticipated,Assess and Plan,Mitigate Risk,Prepare to Respond,Recover"';
2934

3035
private $eventTypesDropdown = [];
3136

3237
private $data;
3338

34-
public function __construct(string $nationalSociety, string $region,array $data, int $maxSupportingMessages)
39+
public function __construct(string $nationalSociety, string $region, array $data, int $maxSupportingMessages)
3540
{
3641
$eventTypes = EventType::whereNotIn('code', ['other'])->get()->toArray();
3742
$this->nationalSociety = $nationalSociety;
3843
$this->eventTypesDropdown = '"' . implode(',', array_map(function ($event) {
39-
return "{$event['name']}";
40-
}, $eventTypes)) . '"';
44+
return "{$event['name']}";
45+
}, $eventTypes)) . '"';
4146
$this->subnational = $region;
4247
$this->data = $data;
43-
if($maxSupportingMessages <= 0) $maxSupportingMessages = 3;
44-
for($i = 0; $i< $maxSupportingMessages; $i++){
48+
if ($maxSupportingMessages <= 0)
49+
$maxSupportingMessages = 3;
50+
for ($i = 0; $i < $maxSupportingMessages; $i++) {
4551
$this->headings[] = 'Supporting Message ' . ($i + 1);
4652
}
4753

resources/assets/js/app.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ Vue.use(VueMoment)
4242

4343
Vue.use(TscGTAG)
4444

45-
Vue.use(GoogleAuth, { client_id: window.config.google.client_id, scopes: 'profile email openid' })
46-
Vue.googleAuth().load()
45+
const googleClientId = window.config?.google?.client_id
46+
if (googleClientId) {
47+
Vue.use(GoogleAuth, { client_id: googleClientId, scopes: 'profile email openid' })
48+
Vue.googleAuth().load()
49+
}
4750

4851
Vue.config.productionTip = false
4952

resources/assets/js/pages/content/editWhatnow.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export default {
343343
'warning',
344344
'anticipated',
345345
'assess_and_plan',
346-
'mitigate_risks',
346+
'mitigate_risk',
347347
'prepare_to_respond',
348348
'recover'
349349
],
@@ -358,7 +358,7 @@ export default {
358358
{
359359
value: 'disaster_risk_reduction',
360360
text: this.$t('content.edit_whatnow.disaster_risk_reduction'),
361-
stages: ['assess_and_plan', 'mitigate_risks', 'prepare_to_respond'],
361+
stages: ['assess_and_plan', 'mitigate_risk', 'prepare_to_respond'],
362362
description: this.$t('content.edit_whatnow.disaster_risk_reduction_description')
363363
},
364364
{

resources/assets/js/pages/content/whatnowContentItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export default {
140140
{
141141
value: 'disaster_risk_reduction',
142142
text: this.$t('content.edit_whatnow.disaster_risk_reduction'),
143-
stages: ['assess_and_plan', 'mitigate_risks', 'prepare_to_respond'],
143+
stages: ['assess_and_plan', 'mitigate_risk', 'prepare_to_respond'],
144144
description: this.$t('content.edit_whatnow.disaster_risk_reduction_description')
145145
},
146146
{
@@ -271,7 +271,7 @@ export default {
271271
.btn {
272272
font-size: 14px;
273273
}
274-
}
274+
}
275275
}
276276
277277
.hazard-cards-container {

resources/assets/js/pages/content/whatnowSummary.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default {
3636
'warning',
3737
'anticipated',
3838
'assess_and_plan',
39-
'mitigate_risks',
39+
'mitigate_risk',
4040
'prepare_to_respond',
4141
'recover'
4242
],
@@ -50,7 +50,7 @@ export default {
5050
{
5151
value: 'disaster_risk_reduction',
5252
text: this.$t('content.edit_whatnow.disaster_risk_reduction'),
53-
stages: ['assess_and_plan', 'mitigate_risks', 'prepare_to_respond'],
53+
stages: ['assess_and_plan', 'mitigate_risk', 'prepare_to_respond'],
5454
description: this.$t('content.edit_whatnow.disaster_risk_reduction_description')
5555
},
5656
{
@@ -123,4 +123,4 @@ export default {
123123
color: $grey;
124124
}
125125
}
126-
</style>
126+
</style>

resources/assets/js/store/models/contentTranslation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const createStages = (stages) => {
2424
warning: stages.warning || [],
2525
anticipated: stages.anticipated || [],
2626
assess_and_plan: stages.assess_and_plan || [],
27-
mitigate_risks: stages.mitigate_risks || [],
27+
mitigate_risk: stages.mitigate_risk || [],
2828
prepare_to_respond: stages.prepare_to_respond || [],
2929
recover: stages.recover || []
3030
}

resources/lang/am.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@
440440
"warning": "ማስጠንቀቂያ",
441441
"anticipated": "በቅድሚያ የተጠበቀ",
442442
"assess_and_plan":"ግምገማ እና እቅድ",
443-
"mitigate_risks":"አደጋዎችን መቀነስ",
443+
"mitigate_risks":"አደጋን መቀነስ",
444444
"prepare_to_respond":"ለመልስ ዝግጁ ይሁኑ",
445445
"recover": "መልሶ ማግኛት"
446446
},
@@ -536,7 +536,7 @@
536536
"recover_extra": "እነዚህ አደገኛ ሁኔታን ተከትሎ አደጋን ለመቀነስ የሚወሰዱ የመከላከያ እርምጃዎች ናቸው።",
537537
"anticipated": "በቅድሚያ የተጠበቀ",
538538
"assess_and_plan": "ግምገማ እና እቅድ",
539-
"mitigate_risks": "አደጋዎችን መቀነስ",
539+
"mitigate_risks": "አደጋን መቀነስ",
540540
"prepare_to_respond": "ለመልስ ዝግጁ ይሁኑ",
541541
"updated": "የተሻሻለ",
542542
"download_icon": "ምልክቶችን ያውርዱ",

resources/lang/ar.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@
450450
"warning": "تحذير",
451451
"anticipated": "متوقع",
452452
"assess_and_plan":"تقييم وتخطيط",
453-
"mitigate_risks":"تخفيف المخاطر",
453+
"mitigate_risks":"تخفيف المخاطرة",
454454
"prepare_to_respond":"الاستعداد للاستجابة",
455455
"recover": "التعافي"
456456
},
@@ -560,7 +560,7 @@
560560
"recover_extra": "اتخذ هذه الإجراءات بعد وقوع الحدث الخطير لضمان السلامة.",
561561
"anticipated": "متوقع",
562562
"assess_and_plan": "تقييم وتخطيط",
563-
"mitigate_risks": "تخفيف المخاطر",
563+
"mitigate_risks": "تخفيف المخاطرة",
564564
"prepare_to_respond": "الاستعداد للاستجابة",
565565
"updated": "تم التحديث",
566566
"download_icon": "تنزيل الأيقونة",

resources/lang/de.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@
442442
"warning": "Warnung",
443443
"anticipated": "Erwartet",
444444
"assess_and_plan":"Bewerten und planen",
445-
"mitigate_risks":"Risiken mindern",
445+
"mitigate_risks":"Risiko mindern",
446446
"prepare_to_respond":"Auf die Reaktion vorbereiten",
447447
"recover": "Wiederherstellen"
448448
},
@@ -538,7 +538,7 @@
538538
"recover_extra": "Dies sind Schutzmaßnahmen, die zu ergreifen sind, um das Risiko nach einem gefährlichen Ereignis zu verringern.",
539539
"anticipated": "Erwartet",
540540
"assess_and_plan": "Bewerten und planen",
541-
"mitigate_risks": "Risiken mindern",
541+
"mitigate_risks": "Risiko mindern",
542542
"prepare_to_respond": "Auf die Reaktion vorbereiten",
543543
"updated": "aktualisiert",
544544
"download_icon": "Icon herunterladen",

0 commit comments

Comments
 (0)