monicahq / monica

Personal CRM. Remember everything about your friends, family and business relationships.
https://beta.monicahq.com
GNU Affero General Public License v3.0
21.69k stars 2.18k forks source link

Deleting One Spouse Breaks the Other #6644

Open mnw700x opened 1 year ago

mnw700x commented 1 year ago

Summary: If a contact, Contact A, has a relationship with another contact, Contact B, and you delete one of them, Contact B, then you are no longer able to access the other, Contact A. Hope that makes sense.

Steps to reproduce

  1. Add a contact.
  2. Give them a name.
  3. Click on Social
  4. Click on Relationships -> Add Relationship
  5. Add a Spouse <--> Spouse relationship, Choose I dont know their name, and click the "Create a contact entry for this person" check box. Note that you can also provide them a name this it fails either way
  6. After Submission if you then go to contacts and cilck on Spouse 2 that we just added. At the bottom left of the page is the delete contact option.
  7. After you delete the contact try to access the contact for Spouse 1 and you will get the following error

App\Domains\Contact\ManageRelationships\Web\ViewHelpers\ModuleFamilySummaryViewHelper::getContact(): Argument #1 ($contact) must be of type App\Models\Contact, null given, called in /srv/app/monica-staging/htdocs/app/Domains/Contact/ManageRelationships/Web/ViewHelpers/ModuleFamilySummaryViewHelper.php on line 77

TypeError: App\Domains\Contact\ManageRelationships\Web\ViewHelpers\ModuleFamilySummaryViewHelper::getContact(): Argument #1 ($contact) must be of type App\Models\Contact, null given, called in /srv/app/monica-staging/htdocs/app/Domains/Contact/ManageRelationships/Web/ViewHelpers/ModuleFamilySummaryViewHelper.php on line 77

at /srv/app/monica-staging/htdocs/app/Domains/Contact/ManageRelationships/Web/ViewHelpers/ModuleFamilySummaryViewHelper.php:86 at App\Domains\Contact\ManageRelationships\Web\ViewHelpers\ModuleFamilySummaryViewHelper::getContact(null) (/srv/app/monica-staging/htdocs/app/Domains/Contact/ManageRelationships/Web/ViewHelpers/ModuleFamilySummaryViewHelper.php:77) at App\Domains\Contact\ManageRelationships\Web\ViewHelpers\ModuleFamilySummaryViewHelper::getRelations(object(Collection), object(Contact)) (/srv/app/monica-staging/htdocs/app/Domains/Contact/ManageRelationships/Web/ViewHelpers/ModuleFamilySummaryViewHelper.php:30) at App\Domains\Contact\ManageRelationships\Web\ViewHelpers\ModuleFamilySummaryViewHelper::data(object(Contact), object(User)) (/srv/app/monica-staging/htdocs/app/Domains/Contact/ManageContact/Web/ViewHelpers/ContactShowViewHelper.php:201) at App\Domains\Contact\ManageContact\Web\ViewHelpers\ContactShowViewHelper::getContactInformation(object(Collection), object(Contact), object(User)) (/srv/app/monica-staging/htdocs/app/Domains/Contact/ManageContact/Web/ViewHelpers/ContactShowViewHelper.php:53) at App\Domains\Contact\ManageContact\Web\ViewHelpers\ContactShowViewHelper::data(object(Contact), object(User)) (/srv/app/monica-staging/htdocs/app/Domains/Contact/ManageContact/Web/Controllers/ContactController.php:120) at App\Domains\Contact\ManageContact\Web\Controllers\ContactController->show(object(Request), '995cbaf6-5940-4981-a800-b1880ec138cf', '995cbbba-df20-4021-b740-2acc163608bb') (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54) at Illuminate\Routing\Controller->callAction('show', array(object(Request), 'vault' => '995cbaf6-5940-4981-a800-b1880ec138cf', 'contact' => '995cbbba-df20-4021-b740-2acc163608bb')) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:43) at Illuminate\Routing\ControllerDispatcher->dispatch(object(Route), object(ContactController), 'show') (/srv/app/monica-staging/htdocs/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingControllerDispatcherTracing.php:21) at Sentry\Laravel\Tracing\Routing\TracingControllerDispatcherTracing->Sentry\Laravel\Tracing\Routing{closure}() (/srv/app/monica-staging/htdocs/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingRoutingDispatcher.php:31) at Sentry\Laravel\Tracing\Routing\TracingRoutingDispatcher->wrapRouteDispatch(object(Closure), object(Route)) (/srv/app/monica-staging/htdocs/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingControllerDispatcherTracing.php:20) at Sentry\Laravel\Tracing\Routing\TracingControllerDispatcherTracing->dispatch(object(Route), object(ContactController), 'show') (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Route.php:259) at Illuminate\Routing\Route->runController() (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Route.php:205) at Illuminate\Routing\Route->run() (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Router.php:798) at Illuminate\Routing\Router->Illuminate\Routing{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:141) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php:41) at Illuminate\Auth\Middleware\EnsureEmailIsVerified->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/inertiajs/inertia-laravel/src/Middleware.php:87) at Inertia\Middleware->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/jetstream/src/Http/Middleware/ShareInertiaData.php:66) at Laravel\Jetstream\Http\Middleware\ShareInertiaData->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authorize.php:57) at Illuminate\Auth\Middleware\Authorize->handle(object(Request), object(Closure), 'contact-owner', 'vault', 'contact') (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authorize.php:57) at Illuminate\Auth\Middleware\Authorize->handle(object(Request), object(Closure), 'vault-viewer', 'vault') (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php:50) at Illuminate\Routing\Middleware\SubstituteBindings->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php:60) at Illuminate\Session\Middleware\AuthenticateSession->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php:57) at Illuminate\Auth\Middleware\Authenticate->handle(object(Request), object(Closure), 'sanctum') (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:78) at Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:49) at Illuminate\View\Middleware\ShareErrorsFromSession->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/codezero/laravel-localizer/src/Middleware/SetLocale.php:43) at CodeZero\Localizer\Middleware\SetLocale->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:121) at Illuminate\Session\Middleware\StartSession->handleStatefulRequest(object(Request), object(Store), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:64) at Illuminate\Session\Middleware\StartSession->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37) at Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:67) at Illuminate\Cookie\Middleware\EncryptCookies->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:116) at Illuminate\Pipeline\Pipeline->then(object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Router.php:797) at Illuminate\Routing\Router->runRouteWithinStack(object(Route), object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Router.php:776) at Illuminate\Routing\Router->runRoute(object(Request), object(Route)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Router.php:740) at Illuminate\Routing\Router->dispatchToRoute(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Router.php:729) at Illuminate\Routing\Router->dispatch(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:200) at Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:141) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/SetRequestIpMiddleware.php:45) at Sentry\Laravel\Http\SetRequestIpMiddleware->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/SetRequestMiddleware.php:30) at Sentry\Laravel\Http\SetRequestMiddleware->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21) at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php:31) at Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21) at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php:40) at Illuminate\Foundation\Http\Middleware\TrimStrings->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27) at Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php:86) at Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php:49) at Illuminate\Http\Middleware\HandleCors->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php:39) at Illuminate\Http\Middleware\TrustProxies->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Middleware.php:52) at Sentry\Laravel\Tracing\Middleware->handle(object(Request), object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:116) at Illuminate\Pipeline\Pipeline->then(object(Closure)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:175) at Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(object(Request)) (/srv/app/monica-staging/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:144) at Illuminate\Foundation\Http\Kernel->handle(object(Request)) (/srv/app/monica-staging/htdocs/public/index.php:51)

RobinMkGeorge commented 1 year ago

I'm assuming this thread is about the Chandler edition.

I had a similar experience trying to assign "brother" relationship status between two contacts. The "Save" button didn't work when I tried to select "Choose an Existing Contact" - and once the search field had revealed the appropriate contact, the "add" button wouldn't work.

So I went with "I know the name" - which resulted in a new contact being generated, duplicating the original. I deleted the duplicate, and now I can no longer look at the "Social" page on the original brother's entry. 505 error comes back.