Skip to content

fix: Incorrect initial data not allowing edit webhooks properly#31948

Merged
kodiakhq[bot] merged 7 commits intoRocketChat:developfrom
dieselftw:fix/integration-options
Mar 18, 2024
Merged

fix: Incorrect initial data not allowing edit webhooks properly#31948
kodiakhq[bot] merged 7 commits intoRocketChat:developfrom
dieselftw:fix/integration-options

Conversation

@dieselftw
Copy link
Copy Markdown
Contributor

@dieselftw dieselftw commented Mar 9, 2024

Proposed changes (including videos or screenshots)

The logic for toggle switches in EditIncomingWebhook.tsx and EditOutgoingWebhook.tsx isn't implemented correctly right now.

enabled: webhookData?.enabled || true, will always return true, hence the switch will always be in the 'on' state.

Before:

2024-03-09.18-22-03.mp4

After:

2024-03-09.18-20-54.mp4

Since the intended use is to initialize the toggle switch with true value (during creation) and take the actual value when it's available, ?? operator would logically work best here in my opinion.

Issue(s)

fixes #31943

Steps to test or reproduce

  1. Go to the Administration section.
  2. Click on Workspace.
  3. Select Integrations.
  4. Scroll down and click Advanced Settings.
  5. Turn off "Retry Failed Url Calls" or "enabled".
  6. Save your changes.
  7. Go back to the integration.
  8. Check if the button is enabled again, but it's actually off during testing.

Further comments

EditIncomingWebhook.tsx has a similar issue but there the "Enabled" value is always initialized to false (which is confusing and unnecessary). That can be fixed and merged in this pull request as well if this fix is deemed correct.

I've only edited the affected fields for now, but this should ideally be done in all fields.

@dieselftw dieselftw requested a review from a team as a code owner March 9, 2024 13:05
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 9, 2024

🦋 Changeset detected

Latest commit: 8d08841

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 31 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/api-client Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/models Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.61%. Comparing base (5ecfd6f) to head (8d08841).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #31948      +/-   ##
===========================================
- Coverage    54.62%   54.61%   -0.01%     
===========================================
  Files         2292     2295       +3     
  Lines        50540    50575      +35     
  Branches     10320    10327       +7     
===========================================
+ Hits         27608    27623      +15     
- Misses       20438    20458      +20     
  Partials      2494     2494              
Flag Coverage Δ
e2e 53.74% <ø> (+0.02%) ⬆️
e2e-api 40.08% <ø> (-0.07%) ⬇️
unit 75.45% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@dieselftw dieselftw changed the title fix: corrected logic for toggle switch fix: Correct logic for toggle switches Mar 9, 2024
Copy link
Copy Markdown
Member

@dougfabris dougfabris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, go ahead and make the fixes on the incoming as well

@dougfabris dougfabris added this to the 6.7 milestone Mar 11, 2024
@dieselftw
Copy link
Copy Markdown
Contributor Author

I've changed all other fields @dougfabris, I'm assuming this is optimal, let me know if you'd prefer changing only certain fields.

@dieselftw
Copy link
Copy Markdown
Contributor Author

Hey again @dougfabris, sorry for the tag, but I made a few PRs for bug fixes. Would really appreciate a review so these tickets can be solved and closed. Thanks!

#31770
#31442
#31399

@dougfabris dougfabris changed the title fix: Correct logic for toggle switches fix: Logic for Webhook's enable switches Mar 18, 2024
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: needs QA labels Mar 18, 2024
@dougfabris dougfabris changed the title fix: Logic for Webhook's enable switches fix: Incorrect initial data not allowing edit webhooks properly Mar 18, 2024
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: ready to merge PR tested and approved waiting for merge labels Mar 18, 2024
@dionisio-bot dionisio-bot bot removed the stat: ready to merge PR tested and approved waiting for merge label Mar 18, 2024
@dougfabris dougfabris added the stat: ready to merge PR tested and approved waiting for merge label Mar 18, 2024
@kodiakhq kodiakhq bot merged commit 6d8610f into RocketChat:develop Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slide buttons not turning off on Integrations

2 participants