Page MenuHomekolab.org

Conditionally show the support form if SUPPORT_EMAIL is set.
ClosedPublic

Authored by mollekopf on Mar 27 2023, 11:06 PM.

Diff Detail

Repository
rK kolab
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mollekopf requested review of this revision.Mar 27 2023, 11:06 PM
mollekopf created this revision.
mollekopf added a reviewer: Restricted Project.Mar 27 2023, 11:10 PM

I could extract the original test and put it into the kolabnow deployment config if we wanted that.

FWIW; I'm still facing failing tests in some payment tests as well as Tests\Browser\SignupTest and Tests\Browser\WalletTest. I couldn't figure those out just yet.

I fixed SignupTest in master, WalletTest works for me. Mollie payment tests fail because of https://github.com/mollie/mollie-api-php/issues/649 and I'm not sure what to do about it.

As for the diff... How about we make the support page to look like https://kolabnow.com/support, but hide the right-side box if app.support_email is not set? If you're a company that installs Kolab for your employees only, you still might find this support channel useful. That means that we'd have to set this option to something (like john@kolab.org for config.dev) to keep the test.

I fixed SignupTest in master, WalletTest works for me. Mollie payment tests fail because of https://github.com/mollie/mollie-api-php/issues/649 and I'm not sure what to do about it.

As for the diff... How about we make the support page to look like https://kolabnow.com/support, but hide the right-side box if app.support_email is not set? If you're a company that installs Kolab for your employees only, you still might find this support channel useful. That means that we'd have to set this option to something (like john@kolab.org for config.dev) to keep the test.

Good idea, I'll work on that this week.

mollekopf planned changes to this revision.Mar 28 2023, 10:05 AM
mollekopf updated this revision to Diff 12128.Mar 29 2023, 10:39 AM
mollekopf retitled this revision from The support contact form is only available in kolabnow. to Conditionally show the support form if SUPPORT_EMAIL is set..

As discussed. I fail to test disabling the support form currently (no idea why), but it seems to work fine in practice.

mollekopf updated this revision to Diff 12134.Mar 29 2023, 12:45 PM

Removed the toast check because this passes now

Changing the config in browser tests doesn't work because we're testing code served via octane...
Soo, not sure how to test this.

mollekopf updated this revision to Diff 12140.Mar 29 2023, 12:57 PM

Updated commented test with comment why we can't currently test this.

There seem to be some fairly elaborate workarounds possible in principle at least:
https://stackoverflow.com/questions/58450836/how-to-override-env-variables-in-laravel-dusk

We already have a way to set config options:

$browser->execScript(sprintf('Object.assign(window.config, %s)', \json_encode($config)));

For payment providers we have an additional mechanism that passes the setting to the backend via headers. See https://git.kolab.org/source/kolab/browse/master/src/resources/js/app.js$371 I suppose we could make it a bit more universal mechanism. See also App\Http\Middleware\DevelConfig.

mollekopf updated this revision to Diff 12152.Mar 29 2023, 10:22 PM

After trying various approaches I've settled on using the cache to propagate the values.
I suppose the javascript approach would also be doable, but it seems more complex to me.

If you prefer the javascript approach, I can give it another go.

machniak accepted this revision.Mar 30 2023, 8:07 AM
This revision is now accepted and ready to land.Mar 30 2023, 8:07 AM
This revision was landed with ongoing or failed builds.Apr 3 2023, 9:42 AM
Closed by commit rK4c2a0f78304b: Conditionally show the support form if SUPPORT_EMAIL is set. (authored by Christian Mollekopf <mollekopf@apheleia-it.ch>). · Explain Why
This revision was automatically updated to reflect the committed changes.