Skip to content

Commit

Permalink
feat: download one contact as vcard (#6747)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Jul 13, 2023
1 parent 5606224 commit dd27398
Show file tree
Hide file tree
Showing 30 changed files with 139 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace App\Domains\Contact\ManageContact\Web\Controllers;

use App\Domains\Contact\Dav\Services\ExportVCard;
use App\Http\Controllers\Controller;
use App\Models\Contact;
use App\Models\Vault;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Str;

class ContactVCardController extends Controller
{
public function download(Request $request, Vault $vault, Contact $contact)
{
$cardData = $this->exportVCard($vault->id, $contact->id);
$name = Str::of($contact->name)->slug(language: App::getLocale());

return Redirect::back()->with('flash', [
'data' => $cardData,
'filename' => "$name.vcf",
]);
}

/**
* Get the new exported version of the object.
*/
protected function exportVCard(string $vaultId, string $contactId): string
{
$vcard = app(ExportVCard::class)->execute([
'account_id' => Auth::user()->account_id,
'author_id' => Auth::id(),
'vault_id' => $vaultId,
'contact_id' => $contactId,
]);

return $vcard->serialize();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public static function data(Contact $contact, User $user): array
'vault' => $contact->vault_id,
'contact' => $contact->id,
]),
'download_vcard' => route('contact.vcard.download', [
'vault' => $contact->vault,
'contact' => $contact,
]),
],
];
}
Expand Down
3 changes: 2 additions & 1 deletion lang/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "কুকুর",
"Done.": "সম্পন্ন.",
"Download": "ডাউনলোড করুন",
"Download as vCard": "vCard হিসেবে ডাউনলোড করুন",
"Drank": "পান",
"Drove": "চালান",
"Due and upcoming tasks": "প্রাপ্য এবং আসন্ন কাজ",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "নতুন পাসওয়ার্ড",
"New to Monica?": "মনিকা নতুন?",
"Next": "পরবর্তী",
"Nickname": "ডাকনাম",
"nickname": "ডাকনাম",
"Nickname": "ডাকনাম",
"No cities have been added yet in any contact’s addresses.": "কোনো পরিচিতির ঠিকানায় এখনো কোনো শহর যোগ করা হয়নি।",
"No contacts found.": "কোন পরিচিতি পাওয়া যায়নি.",
"No countries have been added yet in any contact’s addresses.": "কোনো পরিচিতির ঠিকানায় এখনো কোনো দেশ যোগ করা হয়নি।",
Expand Down
3 changes: 2 additions & 1 deletion lang/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "gos",
"Done.": "Fet.",
"Download": "descarregar",
"Download as vCard": "Descarrega com a vCard",
"Drank": "Bevia",
"Drove": "Va conduir",
"Due and upcoming tasks": "Tasques pendents i properes",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "nova contrasenya",
"New to Monica?": "Nou a la Mònica?",
"Next": "Pròxim",
"Nickname": "Pseudònim",
"nickname": "sobrenom",
"Nickname": "Pseudònim",
"No cities have been added yet in any contact’s addresses.": "Encara no s'ha afegit cap ciutat a les adreces de cap contacte.",
"No contacts found.": "No s'han trobat contactes.",
"No countries have been added yet in any contact’s addresses.": "Encara no s'ha afegit cap país a les adreces de cap contacte.",
Expand Down
3 changes: 2 additions & 1 deletion lang/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "Hund",
"Done.": "Færdig.",
"Download": "Hent",
"Download as vCard": "Download som vCard",
"Drank": "Drak",
"Drove": "Kørte",
"Due and upcoming tasks": "Forfaldne og kommende opgaver",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "nyt kodeord",
"New to Monica?": "Ny for Monica?",
"Next": "Næste",
"Nickname": "Kaldenavn",
"nickname": "kaldenavn",
"Nickname": "Kaldenavn",
"No cities have been added yet in any contact’s addresses.": "Ingen byer er blevet tilføjet endnu i nogen kontakts adresser.",
"No contacts found.": "Ingen kontakter fundet.",
"No countries have been added yet in any contact’s addresses.": "Ingen lande er blevet tilføjet endnu i nogen kontakts adresser.",
Expand Down
3 changes: 2 additions & 1 deletion lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "Hund",
"Done.": "Erledigt.",
"Download": "Herunterladen",
"Download as vCard": "Als vCard herunterladen",
"Drank": "Getrunken",
"Drove": "Gefahren",
"Due and upcoming tasks": "Fällige und anstehende Aufgaben",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "Neues Passwort",
"New to Monica?": "Neu bei Monica?",
"Next": "Nächster",
"Nickname": "Spitzname",
"nickname": "Spitzname",
"Nickname": "Spitzname",
"No cities have been added yet in any contact’s addresses.": "In den Adressen Ihrer Kontakte wurden noch keine Städte hinzugefügt.",
"No contacts found.": "Keine Kontakte gefunden.",
"No countries have been added yet in any contact’s addresses.": "In den Adressen Ihrer Kontakte wurden noch keine Länder hinzugefügt.",
Expand Down
3 changes: 2 additions & 1 deletion lang/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "Σκύλος",
"Done.": "Εγινε.",
"Download": "Κατεβάστε",
"Download as vCard": "Λήψη ως vCard",
"Drank": "Ήπιε",
"Drove": "Οδήγησε",
"Due and upcoming tasks": "Προβλεπόμενες και επερχόμενες εργασίες",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "Νέος Κωδικός",
"New to Monica?": "Νέος στη Μόνικα;",
"Next": "Επόμενο",
"Nickname": "Παρατσούκλι",
"nickname": "παρατσούκλι",
"Nickname": "Παρατσούκλι",
"No cities have been added yet in any contact’s addresses.": "Δεν έχουν προστεθεί ακόμη πόλεις στις διευθύνσεις οποιασδήποτε επαφής.",
"No contacts found.": "Δεν βρέθηκαν επαφές.",
"No countries have been added yet in any contact’s addresses.": "Δεν έχουν προστεθεί ακόμη χώρες στις διευθύνσεις οποιασδήποτε επαφής.",
Expand Down
3 changes: 2 additions & 1 deletion lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "Perro",
"Done.": "Hecho.",
"Download": "Descargar",
"Download as vCard": "Descargar como vCard",
"Drank": "Bebió",
"Drove": "Condujo",
"Due and upcoming tasks": "Tareas pendientes y próximas",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "Nueva Contraseña",
"New to Monica?": "¿Nuevo en Monica?",
"Next": "Siguiente",
"Nickname": "Apodo",
"nickname": "Apodo",
"Nickname": "Apodo",
"No cities have been added yet in any contact’s addresses.": "Todavía no se han agregado ciudades en las direcciones de ningún contacto.",
"No contacts found.": "No se encontraron contactos.",
"No countries have been added yet in any contact’s addresses.": "Todavía no se han agregado países en las direcciones de ningún contacto.",
Expand Down
5 changes: 3 additions & 2 deletions lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "Chien",
"Done.": "Terminé.",
"Download": "Télécharger",
"Download as vCard": "Télécharger en tant que vCard",
"Drank": "A bu",
"Drove": "A conduit",
"Due and upcoming tasks": "Tâches dues et à venir",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "Nouveau mot de passe",
"New to Monica?": "Nouveau sur Monica ?",
"Next": "Suivant",
"Nickname": "Surnom",
"nickname": "surnom",
"Nickname": "Surnom",
"No cities have been added yet in any contact’s addresses.": "Aucune ville n’a encore été ajoutée dans les adresses d’un contact.",
"No contacts found.": "Aucun contact trouvé.",
"No countries have been added yet in any contact’s addresses.": "Aucun pays n’a encore été ajouté dans les adresses d’un contact.",
Expand Down Expand Up @@ -1278,4 +1279,4 @@
"😩 Awful": "😩 Horrible",
"😶‍🌫️ Neutral": "😶‍🌫️ Neutre",
"🥳 Awesome": "🥳 Génial"
}
}
3 changes: 2 additions & 1 deletion lang/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "כֶּלֶב",
"Done.": "בוצע.",
"Download": "הורד",
"Download as vCard": "הורד כ-vCard",
"Drank": "שתה",
"Drove": "נסע",
"Due and upcoming tasks": "משימות צפויות ובא",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "סיסמה חדשה",
"New to Monica?": "חדש במוניקה?",
"Next": "הַבָּא",
"Nickname": "כינוי",
"nickname": "כינוי",
"Nickname": "כינוי",
"No cities have been added yet in any contact’s addresses.": "עדיין לא נוספו ערים בכתובות של איש קשר.",
"No contacts found.": "לא נמצאו אנשי קשר.",
"No countries have been added yet in any contact’s addresses.": "לא נוספו עדיין מדינות בכתובות של איש קשר.",
Expand Down
3 changes: 2 additions & 1 deletion lang/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "कुत्ता",
"Done.": "पूर्ण।",
"Download": "डाउनलोड करना",
"Download as vCard": "vCard के रूप में डाउनलोड करें",
"Drank": "पिया",
"Drove": "गल्ला",
"Due and upcoming tasks": "देय और आगामी कार्य",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "नया पासवर्ड",
"New to Monica?": "मोनिका के लिए नया?",
"Next": "अगला",
"Nickname": "उपनाम",
"nickname": "उपनाम",
"Nickname": "उपनाम",
"No cities have been added yet in any contact’s addresses.": "किसी भी संपर्क के पतों में अभी तक कोई शहर नहीं जोड़ा गया है।",
"No contacts found.": "कोई संपर्क नहीं मिला.",
"No countries have been added yet in any contact’s addresses.": "किसी भी संपर्क के पतों में अभी तक कोई देश नहीं जोड़ा गया है।",
Expand Down
3 changes: 2 additions & 1 deletion lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "Cani",
"Done.": "Fatto.",
"Download": "Scarica",
"Download as vCard": "Scarica come vCard",
"Drank": "Ha bevuto",
"Drove": "Ha guidato una macchina",
"Due and upcoming tasks": "Compiti in scadenza e futuri",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "Nuova password",
"New to Monica?": "Nuovo su Monica?",
"Next": "Prossimo",
"Nickname": "Soprannome",
"nickname": "soprannome",
"Nickname": "Soprannome",
"No cities have been added yet in any contact’s addresses.": "Non sono state ancora aggiunte città negli indirizzi di nessun contatto.",
"No contacts found.": "Nessun contatto trovato.",
"No countries have been added yet in any contact’s addresses.": "Non sono ancora stati aggiunti paesi in nessun indirizzo dei contatti.",
Expand Down
3 changes: 2 additions & 1 deletion lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "",
"Done.": "終わり。",
"Download": "ダウンロード",
"Download as vCard": "vCard としてダウンロード",
"Drank": "飲んだ",
"Drove": "運転した",
"Due and upcoming tasks": "期日および今後のタスク",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "新しいパスワード",
"New to Monica?": "モニカは初めてですか?",
"Next": "",
"Nickname": "ニックネーム",
"nickname": "ニックネーム",
"Nickname": "ニックネーム",
"No cities have been added yet in any contact’s addresses.": "連絡先の住所に都市が追加されていません。",
"No contacts found.": "連絡先が見つかりません。",
"No countries have been added yet in any contact’s addresses.": "どの連絡先の住所にも国が追加されていません。",
Expand Down
3 changes: 2 additions & 1 deletion lang/ml.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "നായ",
"Done.": "ചെയ്തു.",
"Download": "ഡൗൺലോഡ്",
"Download as vCard": "vCard ആയി ഡൗൺലോഡ് ചെയ്യുക",
"Drank": "കുടിച്ചു",
"Drove": "ഓടിച്ചു",
"Due and upcoming tasks": "വരാനിരിക്കുന്നതും വരാനിരിക്കുന്നതുമായ ജോലികൾ",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "പുതിയ പാസ്വേഡ്",
"New to Monica?": "മോണിക്കയിൽ പുതിയത്?",
"Next": "അടുത്തത്",
"Nickname": "വിളിപ്പേര്",
"nickname": "വിളിപ്പേര്",
"Nickname": "വിളിപ്പേര്",
"No cities have been added yet in any contact’s addresses.": "ഒരു കോൺടാക്റ്റിന്റെയും വിലാസത്തിൽ ഇതുവരെ നഗരങ്ങളൊന്നും ചേർത്തിട്ടില്ല.",
"No contacts found.": "കോൺടാക്‌റ്റുകളൊന്നും കണ്ടെത്തിയില്ല.",
"No countries have been added yet in any contact’s addresses.": "ഒരു കോൺടാക്റ്റിന്റെയും വിലാസങ്ങളിൽ ഇതുവരെ രാജ്യങ്ങളൊന്നും ചേർത്തിട്ടില്ല.",
Expand Down
3 changes: 2 additions & 1 deletion lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "Hond",
"Done.": "Klaar.",
"Download": "Downloaden",
"Download as vCard": "Downloaden als vCard",
"Drank": "Dronken",
"Drove": "reed",
"Due and upcoming tasks": "Vervallen en aankomende taken",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "nieuw paswoord",
"New to Monica?": "Nieuw bij Monica?",
"Next": "Volgende",
"Nickname": "Bijnaam",
"nickname": "bijnaam",
"Nickname": "Bijnaam",
"No cities have been added yet in any contact’s addresses.": "Er zijn nog geen steden toegevoegd aan de adressen van een contact.",
"No contacts found.": "Geen contacten gevonden.",
"No countries have been added yet in any contact’s addresses.": "Er zijn nog geen landen toegevoegd aan de adressen van contactpersonen.",
Expand Down
3 changes: 2 additions & 1 deletion lang/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "Hund",
"Done.": "Ferdig.",
"Download": "nedlasting",
"Download as vCard": "Last ned som vCard",
"Drank": "Drakk",
"Drove": "Kjørte",
"Due and upcoming tasks": "Forfallende og kommende oppgaver",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "Nytt passord",
"New to Monica?": "Ny hos Monica?",
"Next": "Neste",
"Nickname": "Kallenavn",
"nickname": "kallenavn",
"Nickname": "Kallenavn",
"No cities have been added yet in any contact’s addresses.": "Ingen byer er lagt til i noen kontakts adresser ennå.",
"No contacts found.": "Ingen kontakter funnet.",
"No countries have been added yet in any contact’s addresses.": "Ingen land er lagt til i noen kontakts adresser ennå.",
Expand Down
3 changes: 2 additions & 1 deletion lang/pa.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "ਕੁੱਤਾ",
"Done.": "ਹੋ ਗਿਆ।",
"Download": "ਡਾਊਨਲੋਡ ਕਰੋ",
"Download as vCard": "vCard ਵਜੋਂ ਡਾਊਨਲੋਡ ਕਰੋ",
"Drank": "ਪੀਤਾ",
"Drove": "ਚਲਾਇਆ",
"Due and upcoming tasks": "ਬਕਾਇਆ ਅਤੇ ਆਉਣ ਵਾਲੇ ਕਾਰਜ",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "ਨਵਾਂ ਪਾਸਵਰਡ",
"New to Monica?": "ਮੋਨਿਕਾ ਲਈ ਨਵੇਂ?",
"Next": "ਅਗਲਾ",
"Nickname": "ਉਪਨਾਮ",
"nickname": "ਉਪਨਾਮ",
"Nickname": "ਉਪਨਾਮ",
"No cities have been added yet in any contact’s addresses.": "ਕਿਸੇ ਵੀ ਸੰਪਰਕ ਦੇ ਪਤੇ ਵਿੱਚ ਅਜੇ ਤੱਕ ਕੋਈ ਸ਼ਹਿਰ ਸ਼ਾਮਲ ਨਹੀਂ ਕੀਤਾ ਗਿਆ ਹੈ।",
"No contacts found.": "ਕੋਈ ਸੰਪਰਕ ਨਹੀਂ ਮਿਲੇ।",
"No countries have been added yet in any contact’s addresses.": "ਕਿਸੇ ਵੀ ਸੰਪਰਕ ਦੇ ਪਤੇ ਵਿੱਚ ਅਜੇ ਤੱਕ ਕੋਈ ਦੇਸ਼ ਸ਼ਾਮਲ ਨਹੀਂ ਕੀਤਾ ਗਿਆ ਹੈ।",
Expand Down
3 changes: 2 additions & 1 deletion lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "Pies",
"Done.": "Zrobione.",
"Download": "Pobierać",
"Download as vCard": "Pobierz jako vCard",
"Drank": "Pił",
"Drove": "Stado",
"Due and upcoming tasks": "Terminowe i nadchodzące zadania",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "nowe hasło",
"New to Monica?": "Nowy dla Moniki?",
"Next": "Następny",
"Nickname": "Przezwisko",
"nickname": "przezwisko",
"Nickname": "Przezwisko",
"No cities have been added yet in any contact’s addresses.": "Żadne miasto nie zostało jeszcze dodane w adresach żadnego kontaktu.",
"No contacts found.": "Nie znaleziono kontaktów.",
"No countries have been added yet in any contact’s addresses.": "Żadne kraje nie zostały jeszcze dodane w adresach żadnego kontaktu.",
Expand Down
3 changes: 2 additions & 1 deletion lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "Cachorro",
"Done.": "Realizado.",
"Download": "Baixar",
"Download as vCard": "Baixar como vCard",
"Drank": "Bebi",
"Drove": "Dirigiu",
"Due and upcoming tasks": "Tarefas a vencer e futuras",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "Nova Palavra-passe",
"New to Monica?": "Novo na Monica?",
"Next": "Próximo",
"Nickname": "Apelido",
"nickname": "apelido",
"Nickname": "Apelido",
"No cities have been added yet in any contact’s addresses.": "Nenhuma cidade foi adicionada ainda nos endereços dos contatos.",
"No contacts found.": "Nenhum contato encontrado.",
"No countries have been added yet in any contact’s addresses.": "Nenhum país foi adicionado ainda nos endereços dos contatos.",
Expand Down
3 changes: 2 additions & 1 deletion lang/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"Dog": "Câine",
"Done.": "Terminat.",
"Download": "Descarca",
"Download as vCard": "Descărcați ca vCard",
"Drank": "A băut",
"Drove": "A condus",
"Due and upcoming tasks": "Sarcini scadente și viitoare",
Expand Down Expand Up @@ -638,8 +639,8 @@
"New Password": "Parolă Nouă",
"New to Monica?": "Nou cu Monica?",
"Next": "Următorul",
"Nickname": "Poreclă",
"nickname": "poreclă",
"Nickname": "Poreclă",
"No cities have been added yet in any contact’s addresses.": "Niciun oraș nu a fost adăugat încă la adresele niciunei persoane de contact.",
"No contacts found.": "Nu s-au găsit persoane de contact.",
"No countries have been added yet in any contact’s addresses.": "Nicio țară nu a fost adăugată încă la adresele vreunei persoane de contact.",
Expand Down
Loading

0 comments on commit dd27398

Please sign in to comment.