diff --git a/app/Http/Controllers/Contacts/IntroductionsController.php b/app/Http/Controllers/Contacts/IntroductionsController.php
index d6a1194b4c4..9cf396c9300 100644
--- a/app/Http/Controllers/Contacts/IntroductionsController.php
+++ b/app/Http/Controllers/Contacts/IntroductionsController.php
@@ -7,6 +7,7 @@
use App\Http\Controllers\Controller;
use App\Traits\JsonRespondController;
use App\Services\Contact\Contact\UpdateContactIntroduction;
+use App\Http\Resources\Contact\ContactShort as ContactResource;
class IntroductionsController extends Controller
{
@@ -25,11 +26,17 @@ public function edit(Contact $contact)
$contacts = $contact->siblingContacts()
->real()
->active()
- ->get();
+ ->paginate(20);
+
+ $introducer = $contact->getIntroducer();
+ if ($introducer !== null) {
+ $introducer = new ContactResource($introducer);
+ }
return view('people.introductions.edit')
->withContact($contact)
- ->withContacts($contacts);
+ ->withContacts(ContactResource::collection($contacts))
+ ->withIntroducer($introducer);
}
/**
diff --git a/resources/js/components/people/ContactSelect.vue b/resources/js/components/people/ContactSelect.vue
index 59f024a82b8..2761a7ce276 100644
--- a/resources/js/components/people/ContactSelect.vue
+++ b/resources/js/components/people/ContactSelect.vue
@@ -5,6 +5,7 @@
-
-
+
+
diff --git a/tests/cypress/integration/contacts/introductions_spec.js b/tests/cypress/integration/contacts/introductions_spec.js
new file mode 100644
index 00000000000..bc27f476f77
--- /dev/null
+++ b/tests/cypress/integration/contacts/introductions_spec.js
@@ -0,0 +1,65 @@
+describe('Introduction', function () {
+ beforeEach(function () {
+ cy.login();
+ cy.createContact('John', 'Doe', 'Man');
+ cy.createContact('Jane', 'Doe', 'Woman');
+ cy.createContact('Joe', 'Shmoe', 'Man');
+ });
+
+ it('lets you fill first met without an introducer', function () {
+ cy.url().should('include', '/people/h:');
+
+ cy.get('.introductions a[href$="introductions/edit"]').click();
+ cy.url().should('include', '/introductions/edit');
+
+ cy.get('textarea[name=first_met_additional_info]').type('Lorem ipsum');
+ cy.get('button.btn-primary[type=submit]').click();
+
+ cy.url().should('include', '/people/h:');
+ cy.get('.alert-success');
+ cy.get('.introductions').contains('Lorem ipsum');
+ });
+
+ it('lets you save first met', function () {
+ cy.url().should('include', '/people/h:');
+
+ cy.get('.introductions a[href$="introductions/edit"]').click();
+ cy.url().should('include', '/introductions/edit');
+
+ cy.get('textarea[name=first_met_additional_info]').type('Lorem ipsum');
+ cy.get('#metThrough > .v-select input').click();
+ cy.get('#metThrough ul[role="listbox"]').contains('John Doe');
+ cy.get('#metThrough ul[role="listbox"]').contains('Jane Doe');
+ cy.get('#metThrough ul[role="listbox"]').contains('Joe Shmoe');
+
+ cy.get('#metThrough ul[role="listbox"]').contains('John Doe').click();
+
+ cy.get('button.btn-primary[type=submit]').click();
+
+ cy.url().should('include', '/people/h:');
+ cy.get('.alert-success');
+ cy.get('.introductions').contains('Lorem ipsum');
+ cy.get('.introductions').contains('John Doe');
+ });
+
+ it('lets you search first met', function () {
+ cy.url().should('include', '/people/h:');
+
+ cy.get('.introductions a[href$="introductions/edit"]').click();
+ cy.url().should('include', '/introductions/edit');
+
+ cy.get('textarea[name=first_met_additional_info]').type('Lorem ipsum');
+ cy.get('#metThrough input[type=search]').type('John');
+ cy.get('#metThrough ul[role="listbox"]').contains('John Doe');
+ cy.get('#metThrough ul[role="listbox"]').should('not.contain', 'Joe Shmoe');
+ cy.get('#metThrough ul[role="listbox"]').should('not.contain', 'Jane Doe');
+
+ cy.get('#metThrough ul[role="listbox"]').contains('John Doe').click();
+ cy.get('button.btn-primary[type=submit]').click();
+
+ cy.url().should('include', '/people/h:');
+ cy.get('.introductions').contains('Lorem ipsum');
+ cy.get('.introductions').contains('John Doe');
+ });
+
+});