Skip to content

Commit ae80f23

Browse files
committed
fix: refactor field data handling in single_select and comment views
1 parent 3fba547 commit ae80f23

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
@php
2-
$fieldName = $payload['projects_v2_item']['field_name'];
3-
$fromValue = $payload['from']['name'] ?? null;
4-
$toValue = $payload['to']['name'] ?? null;
2+
$fieldData = $payload['changes']['field_value'] ?? null;
3+
4+
$fieldName = $fieldData['field_name'] ?? 'Unknown Field';
5+
$fromValue = $fieldData['from']['name'] ?? null;
6+
$toValue = $fieldData['to']['name'] ?? null;
57
@endphp
68
@include(
7-
'github-project::md.field_types.' . $payload['projects_v2_item']['field_type'],
8-
compact('fieldName', 'fromValue', 'toValue')
9+
'github-project::md.field_types.' . $fieldData['field_type'],
10+
compact('fieldName', 'fromValue', 'toValue', 'fieldData')
911
)
1012

1113
@include('github-project::md.shared.author', compact('payload'))

resources/views/md/field_types/single_select.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@php
2-
$fromColor = $payload['from']['color'] ?? null;
3-
$toColor = $payload['to']['color'] ?? null;
2+
$fromColor = $fieldData['from']['color'] ?? null;
3+
$toColor = $fieldData['to']['color'] ?? null;
44
@endphp
55
@if($fromValue != null)
66
**{{ $fieldName }}** has been changed from $${\color{{{ $fromColor }}}{{ $fromValue }}$$ to $${\color{{{ $toColor }}}{{ $toValue }}$$.

0 commit comments

Comments
 (0)