| @@ -41,8 +41,48 @@ | ||
| 41 | 41 | { |
| 42 | 42 | return \maybe_unserialize($settings); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | + /** Read full custom-field message attributes from their LONGTEXT payload; preserve legacy rows. */ | |
| 46 | + private function customFieldActivityAttribute($key, $fallback) | |
| 47 | + { | |
| 48 | + if (empty($this->settings['custom_field_activity_payload'])) { | |
| 49 | + return $fallback; | |
| 50 | + } | |
| 51 | + | |
| 52 | + $payload = json_decode($this->attributes['description'] ?? '', true); | |
| 53 | + return is_array($payload) && array_key_exists($key, $payload) ? $payload[$key] : $fallback; | |
| 54 | + } | |
| 55 | + | |
| 56 | + /** Resolve the stored label while preserving display translations applied by the activity service. */ | |
| 57 | + public function getColumnAttribute($value) | |
| 58 | + { | |
| 59 | + // Payload rows store this identifier until translateActivities assigns a display label. | |
| 60 | + if ($value !== Constant::ACTIVITY_CUSTOM_FIELD) { | |
| 61 | + return $value; | |
| 62 | + } | |
| 63 | + | |
| 64 | + return $this->customFieldActivityAttribute('column', $value); | |
| 65 | + } | |
| 66 | + | |
| 67 | + /** Restore the complete previous value for all activity feeds and serialized responses. */ | |
| 68 | + public function getOldValueAttribute($value) | |
| 69 | + { | |
| 70 | + return $this->customFieldActivityAttribute('old_value', $value); | |
| 71 | + } | |
| 72 | + | |
| 73 | + /** Restore the complete new value, including null removals and zero values. */ | |
| 74 | + public function getNewValueAttribute($value) | |
| 75 | + { | |
| 76 | + return $this->customFieldActivityAttribute('new_value', $value); | |
| 77 | + } | |
| 78 | + | |
| 79 | + /** Keep storage details out of the user-facing activity description. */ | |
| 80 | + public function getDescriptionAttribute($value) | |
| 81 | + { | |
| 82 | + return $this->customFieldActivityAttribute('description', $value); | |
| 83 | + } | |
| 84 | + | |
| 45 | 85 | /** |
| 46 | 86 | * One2One: Activity belongs to one Task |
| 47 | 87 | * @return \FluentBoards\Framework\Database\Orm\Relations\BelongsTo |
| 48 | 88 | */ |