Skip to content

Commit

Permalink
fix: fix contact information without a protocol (monicahq/chandler#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
djaiss authored Dec 12, 2022
1 parent 27f6309 commit e53b7ac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public static function dto(Contact $contact, ContactInformation $info): array
return [
'id' => $info->id,
'label' => $info->name,
'data' => $info->contactInformationType->protocol ? $info->contactInformationType->protocol.$info->data : $info->data,
'protocol' => $info->contactInformationType->protocol,
'data' => $info->data,
'data_with_protocol' => $info->contactInformationType->protocol ? $info->contactInformationType->protocol.$info->data : $info->data,
'contact_information_type' => [
'id' => $info->contactInformationType->id,
'name' => $info->contactInformationType->name,
Expand Down
9 changes: 6 additions & 3 deletions resources/js/Shared/Modules/ContactInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
:type="'text'"
:autofocus="true"
:input-class="'block w-full'"
:required="false"
:required="true"
:autocomplete="false"
:maxlength="255"
@esc-key-pressed="addContactInformationModalShown = false" />
Expand Down Expand Up @@ -81,7 +81,10 @@
class="item-list border-b border-gray-200 hover:bg-slate-50 dark:border-gray-700 dark:bg-slate-900 hover:dark:bg-slate-800">
<!-- contact information -->
<div v-if="editedContactInformationId != info.id" class="flex items-center justify-between px-3 py-2">
<a :href="info.data" class="text-blue-500 hover:underline">{{ info.label }} </a>
<div>
<a :href="info.data_with_protocol" class="text-blue-500 hover:underline">{{ info.data }}</a>
<span class="ml-2 text-xs text-gray-500">({{ info.label }})</span>
</div>

<!-- actions -->
<ul class="text-sm">
Expand Down Expand Up @@ -197,7 +200,7 @@ export default {
this.addContactInformationModalShown = true;
this.form.errors = [];
this.form.data = '';
this.form.contact_information_type_id = 0;
this.form.contact_information_type_id = this.data.contact_information_types[0].id;
this.$nextTick(() => {
this.$refs.newData.focus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ public function it_gets_the_data_transfer_object(): void
[
'id' => $info->id,
'label' => 'Facebook shit',
'data' => 'mailto:'.$info->data,
'protocol' => 'mailto:',
'data' => $info->data,
'data_with_protocol' => 'mailto:'.$info->data,
'contact_information_type' => [
'id' => $type->id,
'name' => 'Facebook shit',
Expand Down

0 comments on commit e53b7ac

Please sign in to comment.