diff --git a/app/Domains/Contact/ManageCalls/Services/CreateCall.php b/app/Domains/Contact/ManageCalls/Services/CreateCall.php index 95a60ca8e9a..0eaf3f8d054 100644 --- a/app/Domains/Contact/ManageCalls/Services/CreateCall.php +++ b/app/Domains/Contact/ManageCalls/Services/CreateCall.php @@ -4,6 +4,7 @@ use App\Interfaces\ServiceInterface; use App\Models\Call; +use App\Models\ContactFeedItem; use App\Services\BaseService; use Carbon\Carbon; @@ -57,6 +58,7 @@ public function execute(array $data): Call $this->createCall(); $this->updateLastEditedDate(); + $this->createFeedItem(); return $this->call; } @@ -93,4 +95,14 @@ private function updateLastEditedDate(): void $this->contact->last_updated_at = Carbon::now(); $this->contact->save(); } + + private function createFeedItem(): void + { + $feedItem = ContactFeedItem::create([ + 'author_id' => $this->author->id, + 'contact_id' => $this->contact->id, + 'action' => ContactFeedItem::ACTION_CALL_CREATED, + ]); + $this->call->feedItem()->save($feedItem); + } } diff --git a/app/Domains/Contact/ManageContactFeed/Web/ViewHelpers/Actions/ActionFeedCall.php b/app/Domains/Contact/ManageContactFeed/Web/ViewHelpers/Actions/ActionFeedCall.php new file mode 100644 index 00000000000..290fb64266e --- /dev/null +++ b/app/Domains/Contact/ManageContactFeed/Web/ViewHelpers/Actions/ActionFeedCall.php @@ -0,0 +1,35 @@ +contact; + $call = $item->feedable; + + return [ + 'call' => [ + 'object' => $call ? [ + 'id' => $call->id, + 'type' => $call->type ? $call->type : null, + ] : null, + 'description' => $item->description, + ], + 'contact' => [ + 'id' => $contact->id, + 'name' => $contact->name, + 'age' => $contact->age, + 'avatar' => $contact->avatar, + 'url' => route('contact.show', [ + 'vault' => $contact->vault_id, + 'contact' => $contact->id, + ]), + ], + ]; + } +} diff --git a/app/Domains/Contact/ManageContactFeed/Web/ViewHelpers/ModuleFeedViewHelper.php b/app/Domains/Contact/ManageContactFeed/Web/ViewHelpers/ModuleFeedViewHelper.php index 8ec93789005..0401939352f 100644 --- a/app/Domains/Contact/ManageContactFeed/Web/ViewHelpers/ModuleFeedViewHelper.php +++ b/app/Domains/Contact/ManageContactFeed/Web/ViewHelpers/ModuleFeedViewHelper.php @@ -3,6 +3,7 @@ namespace App\Domains\Contact\ManageContactFeed\Web\ViewHelpers; use App\Domains\Contact\ManageContactFeed\Web\ViewHelpers\Actions\ActionFeedAddress; +use App\Domains\Contact\ManageContactFeed\Web\ViewHelpers\Actions\ActionFeedCall; use App\Domains\Contact\ManageContactFeed\Web\ViewHelpers\Actions\ActionFeedContactInformation; use App\Domains\Contact\ManageContactFeed\Web\ViewHelpers\Actions\ActionFeedGenericContactInformation; use App\Domains\Contact\ManageContactFeed\Web\ViewHelpers\Actions\ActionFeedGoal; @@ -72,6 +73,7 @@ private static function getSentence(ContactFeedItem $item): mixed 'unfavorited' => trans('removed the contact from the favorites'), 'changed_avatar' => trans('updated the avatar of the contact'), 'mood_tracking_event_added' => trans('logged the mood'), + 'call_created' => trans('logged a call'), default => trans('unknown action'), }; } @@ -141,6 +143,9 @@ private static function getData(ContactFeedItem $item, User $user) case 'mood_tracking_event_deleted': return ActionFeedMoodTrackingEvent::data($item, $user); + case 'call_created': + return ActionFeedCall::data($item, $user); + default: return ActionFeedGenericContactInformation::data($item); } diff --git a/app/Models/Call.php b/app/Models/Call.php index 5924ebc54b9..046a595f2ad 100644 --- a/app/Models/Call.php +++ b/app/Models/Call.php @@ -5,6 +5,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\MorphOne; class Call extends Model { @@ -83,4 +84,12 @@ public function emotion(): BelongsTo { return $this->belongsTo(Emotion::class); } + + /** + * Get the mood tracking event's feed item. + */ + public function feedItem(): MorphOne + { + return $this->morphOne(ContactFeedItem::class, 'feedable'); + } } diff --git a/app/Models/ContactFeedItem.php b/app/Models/ContactFeedItem.php index 470be3f4ee6..59068bdcfb5 100644 --- a/app/Models/ContactFeedItem.php +++ b/app/Models/ContactFeedItem.php @@ -92,6 +92,8 @@ class ContactFeedItem extends Model public const ACTION_MOOD_TRACKING_EVENT_DESTROYED = 'mood_tracking_event_deleted'; + public const ACTION_CALL_CREATED = 'call_created'; + /** * The attributes that are mass assignable. * diff --git a/lang/ar.json b/lang/ar.json index fc459795d5f..e2ed75475a6 100644 --- a/lang/ar.json +++ b/lang/ar.json @@ -574,6 +574,7 @@ "Locale default: :value": "اللغة الافتراضية: :value", "Log a call": "تسجيل مكالمة", "Log details": "تفاصيل السجل", + "logged a call": "قمت بتسجيل مكالمة", "logged the mood": "سجلت المزاج", "Log in": "تسجيل الدخول", "Login": "تسجيل الدخول", diff --git a/lang/bn.json b/lang/bn.json index 0792b1bf2e5..c04324cdfbb 100644 --- a/lang/bn.json +++ b/lang/bn.json @@ -574,6 +574,7 @@ "Locale default: :value": "স্থানীয় ডিফল্ট: :value", "Log a call": "একটি কল লগ", "Log details": "লগ বিবরণ", + "logged a call": "একটি কল লগ", "logged the mood": "মেজাজ লগ", "Log in": "লগইন করুন", "Login": "লগইন", diff --git a/lang/ca.json b/lang/ca.json index 15ba9a49ead..0363297781f 100644 --- a/lang/ca.json +++ b/lang/ca.json @@ -574,6 +574,7 @@ "Locale default: :value": "Localització predeterminada: :value", "Log a call": "Registre una trucada", "Log details": "Detalls del registre", + "logged a call": "ha registrat una trucada", "logged the mood": "registrat l’estat d’ànim", "Log in": "Entrar", "Login": "Entrar", diff --git a/lang/da.json b/lang/da.json index 2e67458a13f..8b801c059a2 100644 --- a/lang/da.json +++ b/lang/da.json @@ -574,6 +574,7 @@ "Locale default: :value": "Landestandard: :value", "Log a call": "Log et opkald", "Log details": "Log detaljer", + "logged a call": "logget et opkald", "logged the mood": "logget stemningen", "Log in": "Log ind", "Login": "Log ind", diff --git a/lang/de.json b/lang/de.json index 73a062843ca..ce42c273dcd 100644 --- a/lang/de.json +++ b/lang/de.json @@ -574,6 +574,7 @@ "Locale default: :value": "Gebietsschema-Standard: :value", "Log a call": "Einen Anruf protokollieren", "Log details": "Protokolldetails", + "logged a call": "einen Anruf protokolliert", "logged the mood": "protokollierte die Stimmung", "Log in": "Einloggen", "Login": "Anmelden", diff --git a/lang/el.json b/lang/el.json index e02e50468d3..4fc7d0ae930 100644 --- a/lang/el.json +++ b/lang/el.json @@ -574,6 +574,7 @@ "Locale default: :value": "Προεπιλογή τοπικής ρύθμισης: :value", "Log a call": "Καταγράψτε μια κλήση", "Log details": "Στοιχεία καταγραφής", + "logged a call": "κατέγραψε μια κλήση", "logged the mood": "κατέγραψε τη διάθεση", "Log in": "Συνδεθείτε", "Login": "Είσοδος", diff --git a/lang/es.json b/lang/es.json index 6e7c0336796..910dbf53f0c 100644 --- a/lang/es.json +++ b/lang/es.json @@ -574,6 +574,7 @@ "Locale default: :value": "Configuración regional predeterminada: :value", "Log a call": "Registrar una llamada", "Log details": "Detalles del registro", + "logged a call": "registró una llamada", "logged the mood": "registró el estado de ánimo", "Log in": "Iniciar sesión", "Login": "Iniciar sesión", diff --git a/lang/fr.json b/lang/fr.json index 3b79ecd1773..5df8a53b0e8 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -574,6 +574,7 @@ "Locale default: :value": "Paramètres régionaux par défaut : :value", "Log a call": "Enregistrer un appel", "Log details": "Détails du journal", + "logged a call": "enregistré un appel", "logged the mood": "a enregistré l’humeur", "Log in": "Se connecter", "Login": "Connexion", diff --git a/lang/he.json b/lang/he.json index ca7ae31d8a9..0583fac6ab0 100644 --- a/lang/he.json +++ b/lang/he.json @@ -574,6 +574,7 @@ "Locale default: :value": "ברירת המחדל של המקום: :value", "Log a call": "רישום שיחה", "Log details": "פרטי יומן", + "logged a call": "רשם שיחה", "logged the mood": "רשם את מצב הרוח", "Log in": "התחבר", "Login": "התחברות", diff --git a/lang/hi.json b/lang/hi.json index 29afa59d1f7..6304ccb99e4 100644 --- a/lang/hi.json +++ b/lang/hi.json @@ -574,6 +574,7 @@ "Locale default: :value": "स्थानीय डिफ़ॉल्ट: :value", "Log a call": "कॉल लॉग करें", "Log details": "लॉग विवरण", + "logged a call": "कॉल लॉग किया", "logged the mood": "मूड लॉग किया", "Log in": "लॉग इन करें", "Login": "लॉगिन करें", diff --git a/lang/it.json b/lang/it.json index 6a107b338e3..47f0b833647 100644 --- a/lang/it.json +++ b/lang/it.json @@ -574,6 +574,7 @@ "Locale default: :value": "Impostazioni locali predefinite: :value", "Log a call": "Registra una chiamata", "Log details": "Dettagli del registro", + "logged a call": "registrato una chiamata", "logged the mood": "registrato l’umore", "Log in": "Accedi", "Login": "Accedi", diff --git a/lang/ja.json b/lang/ja.json index 0f7cdd97642..e2965d64df1 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -574,6 +574,7 @@ "Locale default: :value": "ロケールのデフォルト: :value", "Log a call": "通話を記録する", "Log details": "ログの詳細", + "logged a call": "通話を記録しました", "logged the mood": "気分を記録した", "Log in": "ログイン", "Login": "ログイン", diff --git a/lang/ml.json b/lang/ml.json index 4e638d8bf27..934c25eb9b6 100644 --- a/lang/ml.json +++ b/lang/ml.json @@ -575,6 +575,7 @@ "Locale default: :value": "പ്രാദേശിക സ്ഥിരസ്ഥിതി: :value", "Log a call": "ഒരു കോൾ ലോഗ് ചെയ്യുക", "Log details": "ലോഗ് വിശദാംശങ്ങൾ", + "logged a call": "ഒരു കോൾ ലോഗ് ചെയ്തു", "logged the mood": "മാനസികാവസ്ഥ രേഖപ്പെടുത്തി", "Log in": "ലോഗിൻ", "Login": "ലോഗിൻ", diff --git a/lang/nl.json b/lang/nl.json index 8ae86b1462c..04f2537a309 100644 --- a/lang/nl.json +++ b/lang/nl.json @@ -574,6 +574,7 @@ "Locale default: :value": "Standaard landinstelling: :value", "Log a call": "Een oproep registreren", "Log details": "Loggegevens", + "logged a call": "een oproep geregistreerd", "logged the mood": "registreerde de stemming", "Log in": "Inloggen", "Login": "Inloggen", diff --git a/lang/nn.json b/lang/nn.json index f71224561c9..5ca13d8bf72 100644 --- a/lang/nn.json +++ b/lang/nn.json @@ -574,6 +574,7 @@ "Locale default: :value": "Standard standard: :value", "Log a call": "Logg en samtale", "Log details": "Loggdetaljer", + "logged a call": "logget en samtale", "logged the mood": "logget stemningen", "Log in": "Logg Inn", "Login": "Logg inn", diff --git a/lang/pa.json b/lang/pa.json index 0f8b5b2cf30..196a0e1d548 100644 --- a/lang/pa.json +++ b/lang/pa.json @@ -575,6 +575,7 @@ "Locale default: :value": "ਲੋਕੇਲ ਡਿਫੌਲਟ: :value", "Log a call": "ਇੱਕ ਕਾਲ ਲੌਗ ਕਰੋ", "Log details": "ਲੌਗ ਵੇਰਵੇ", + "logged a call": "ਇੱਕ ਕਾਲ ਲੌਗ ਕੀਤੀ", "logged the mood": "ਮੂਡ ਨੂੰ ਲੌਗ ਕੀਤਾ", "Log in": "ਲਾਗਿਨ", "Login": "ਲਾਗਿਨ", diff --git a/lang/pl.json b/lang/pl.json index 4a2e85dc59d..0f359c17743 100644 --- a/lang/pl.json +++ b/lang/pl.json @@ -574,6 +574,7 @@ "Locale default: :value": "Domyślne ustawienia regionalne: :value", "Log a call": "Zarejestruj połączenie", "Log details": "Szczegóły dziennika", + "logged a call": "zarejestrował połączenie", "logged the mood": "zarejestrował nastrój", "Log in": "Zaloguj się", "Login": "Logowanie", diff --git a/lang/pt.json b/lang/pt.json index 3d0c3a7ddd5..76b1b79438e 100644 --- a/lang/pt.json +++ b/lang/pt.json @@ -574,6 +574,7 @@ "Locale default: :value": "Padrão de localidade: :value", "Log a call": "Registrar uma chamada", "Log details": "Detalhes do registro", + "logged a call": "registrou uma chamada", "logged the mood": "registrou o clima", "Log in": "Iniciar sessão", "Login": "Iniciar Sessão", diff --git a/lang/pt_BR.json b/lang/pt_BR.json index 6e8936495a1..d4533a00626 100644 --- a/lang/pt_BR.json +++ b/lang/pt_BR.json @@ -574,6 +574,7 @@ "Locale default: :value": "Padrão de localidade: :value", "Log a call": "Registrar uma chamada", "Log details": "Detalhes do registro", + "logged a call": "registrou uma chamada", "logged the mood": "registrou o clima", "Log in": "Entrar", "Login": "Entrar", diff --git a/lang/ro.json b/lang/ro.json index 77b916b587f..f2f82e84b5c 100644 --- a/lang/ro.json +++ b/lang/ro.json @@ -574,6 +574,7 @@ "Locale default: :value": "Localizare implicită: :value", "Log a call": "Înregistrează un apel", "Log details": "Detalii jurnal", + "logged a call": "a înregistrat un apel", "logged the mood": "a înregistrat starea de spirit", "Log in": "Autentificare", "Login": "Autentificare", diff --git a/lang/ru.json b/lang/ru.json index d4fc2c1cf46..ec68cd8b3ef 100644 --- a/lang/ru.json +++ b/lang/ru.json @@ -574,6 +574,7 @@ "Locale default: :value": "Локаль по умолчанию: :value", "Log a call": "Зарегистрировать звонок", "Log details": "Подробности журнала", + "logged a call": "зарегистрировал звонок", "logged the mood": "записал настроение", "Log in": "Войти", "Login": "Войти", diff --git a/lang/sv.json b/lang/sv.json index f087e8c2c89..f7d86741044 100644 --- a/lang/sv.json +++ b/lang/sv.json @@ -574,6 +574,7 @@ "Locale default: :value": "Standard för språk: :value", "Log a call": "Logga ett samtal", "Log details": "Loggdetaljer", + "logged a call": "loggade ett samtal", "logged the mood": "registrerade stämningen", "Log in": "Inloggning", "Login": "Logga in", diff --git a/lang/te.json b/lang/te.json index cba95f67deb..67da8b37195 100644 --- a/lang/te.json +++ b/lang/te.json @@ -575,6 +575,7 @@ "Locale default: :value": "లొకేల్ డిఫాల్ట్: :value", "Log a call": "కాల్‌ని లాగిన్ చేయండి", "Log details": "లాగ్ వివరాలు", + "logged a call": "కాల్ లాగ్ చేసాడు", "logged the mood": "మానసిక స్థితిని లాగిన్ చేసింది", "Log in": "ప్రవేశించండి", "Login": "ప్రవేశించండి", diff --git a/lang/tr.json b/lang/tr.json index 60d1a85a6e5..b5a1019a918 100644 --- a/lang/tr.json +++ b/lang/tr.json @@ -574,6 +574,7 @@ "Locale default: :value": "Yerel ayar varsayılanı: :value", "Log a call": "Bir çağrıyı günlüğe kaydet", "Log details": "Günlük ayrıntıları", + "logged a call": "bir çağrı kaydettim", "logged the mood": "ruh halini kaydetti", "Log in": "Giriş yap", "Login": "Giriş Yap", diff --git a/lang/ur.json b/lang/ur.json index 43f3cc6edf0..192b9952062 100644 --- a/lang/ur.json +++ b/lang/ur.json @@ -574,6 +574,7 @@ "Locale default: :value": "لوکل ڈیفالٹ: :value", "Log a call": "کال لاگ ان کریں۔", "Log details": "لاگ تفصیلات", + "logged a call": "کال لاگ ان کی", "logged the mood": "موڈ کو لاگو کیا", "Log in": "میں لاگ ان کریں", "Login": "لاگ ان کریں", diff --git a/lang/vi.json b/lang/vi.json index 8f5fc61f6ce..d66f4d6bbd7 100644 --- a/lang/vi.json +++ b/lang/vi.json @@ -574,6 +574,7 @@ "Locale default: :value": "Mặc định ngôn ngữ: :value", "Log a call": "Đăng nhập cuộc gọi", "Log details": "Chi tiết nhật ký", + "logged a call": "đã ghi lại một cuộc gọi", "logged the mood": "ghi lại tâm trạng", "Log in": "Đăng nhập", "Login": "Đăng nhập", diff --git a/lang/zh_CN.json b/lang/zh_CN.json index 26b8764cf22..eeb73cc4054 100644 --- a/lang/zh_CN.json +++ b/lang/zh_CN.json @@ -574,6 +574,7 @@ "Locale default: :value": "语言环境默认值::value", "Log a call": "记录通话", "Log details": "日志详情", + "logged a call": "已记录通话", "logged the mood": "记录心情", "Log in": "登录", "Login": "登录", diff --git a/lang/zh_TW.json b/lang/zh_TW.json index b74f114bd8a..2d5949cfeef 100644 --- a/lang/zh_TW.json +++ b/lang/zh_TW.json @@ -574,6 +574,7 @@ "Locale default: :value": "語言環境預設值::value", "Log a call": "記錄通話", "Log details": "日誌詳情", + "logged a call": "已記錄通話", "logged the mood": "記錄心情", "Log in": "登入", "Login": "登入", diff --git a/resources/js/Shared/Modules/Feed.vue b/resources/js/Shared/Modules/Feed.vue index e42f44700c3..8d347b6c661 100644 --- a/resources/js/Shared/Modules/Feed.vue +++ b/resources/js/Shared/Modules/Feed.vue @@ -88,6 +88,11 @@ :data="feedItem.data" :contact-view-mode="contactViewMode" /> + + 'contact', 'emotion_id' => optional($emotion)->id, ]); + + $this->assertDatabaseHas('contact_feed_items', [ + 'contact_id' => $contact->id, + 'feedable_id' => $call->id, + 'feedable_type' => 'App\Models\Call', + ]); } }