Skip to content

Commit 98a88f7

Browse files
committed
fix: improve field change messages and enhance value retrieval logic
1 parent 7d0432f commit 98a88f7

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

resources/views/md/comment.blade.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22
$fieldData = $payload['changes']['field_value'] ?? null;
33
44
$fieldName = $fieldData['field_name'] ?? 'Unknown Field';
5-
$fromValue = $fieldData['from']['name'] ?? $fieldData['from'] ?? null;
6-
$toValue = $fieldData['to']['name'] ?? $fieldData['to'] ?? null;
5+
$fromValue = $fieldData['from']['name']
6+
?? $fieldData['from']['title']
7+
?? $fieldData['from']
8+
?? null;
9+
$toValue = $fieldData['to']['name']
10+
?? $fieldData['to']['title']
11+
?? $fieldData['to']
12+
?? null;
713
@endphp
814
@include(
915
'github-project::md.field_types.' . $fieldData['field_type'],
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@if($fromValue != null && $toValue != null)
2+
**`{{ $fieldName }}`** has been changed:
3+
- From **`{{ $fromValue }}`**
4+
- To **`{{ $toValue }}`**.
5+
@elseif ($toValue == null)
6+
**`{{ $fieldName }}`** has been removed from **`{{ $fromValue }}`**.
7+
@else
8+
**`{{ $fieldName }}`** has been set to **`{{ $toValue }}`**.
9+
@endif

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
$fromColor = $fieldData['from']['color'] ?? null;
33
$toColor = $fieldData['to']['color'] ?? null;
44
@endphp
5-
@if($fromValue != null)
5+
@if($fromValue != null && $toValue != null)
66
**`{{ $fieldName }}`** has been changed from $${\color{<?= $fromColor ?>}{{ $fromValue }}}$$ to $${\color{<?= $toColor ?>}{{ $toValue }}}$$.
7-
@elseif ($toValue != null)
7+
@elseif ($toValue == null)
88
**`{{ $fieldName }}`** has been removed from $${\color{<?= $fromColor ?>}{{ $fromValue }}}$$.
99
@else
1010
**`{{ $fieldName }}`** has been set to $${\color{<?= $toColor ?>}{{ $toValue }}}$$.

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
@if($fromValue != null)
2-
**`{{ $fieldName }}`** has been changed from **`{{ $fromValue }}`** to **`{{ $toValue }}`**.
3-
@elseif ($toValue != null)
1+
@if($fromValue != null && $toValue != null)
2+
**`{{ $fieldName }}`** has been changed:
3+
- From **`{{ $fromValue }}`**
4+
- To **`{{ $toValue }}`**.
5+
@elseif ($toValue == null)
46
**`{{ $fieldName }}`** has been removed from **`{{ $fromValue }}`**.
57
@else
68
**`{{ $fieldName }}`** has been set to **`{{ $toValue }}`**.

0 commit comments

Comments
 (0)