Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dashboard/notifications] improve email preference handling #5142

Merged
merged 7 commits into from
Aug 17, 2021

Conversation

laushinka
Copy link
Contributor

Creating this pull request firstly in order to run the following command and test that the new events are reflected on Segment.

/werft analytics=segment|TEZnsG4QbLSxLfHfNieLYGF4cDwyFWoe

@jakobhero
Copy link
Contributor

jakobhero commented Aug 11, 2021

/werft run

👍 started the job as gitpod-build-laushinka-update-notification-4793.16

@laushinka laushinka force-pushed the laushinka/update-notification-4793 branch from 27ba2cc to 9c63d71 Compare August 11, 2021 09:27
@laushinka laushinka self-assigned this Aug 11, 2021
@JanKoehnlein
Copy link
Contributor

/hold

@JanKoehnlein
Copy link
Contributor

/cc

@roboquat roboquat requested a review from JanKoehnlein August 11, 2021 11:13
@laushinka
Copy link
Contributor Author

laushinka commented Aug 12, 2021

/werft run

👍 started the job as gitpod-build-laushinka-update-notification-4793.22

@laushinka
Copy link
Contributor Author

@JanKoehnlein The DB queries have been tested, also with extra eyes from @jakobhero. This PR is now ready for review.

@JanKoehnlein
Copy link
Contributor

JanKoehnlein commented Aug 16, 2021

/werft run

👍 started the job as gitpod-build-laushinka-update-notification-4793.25

@laushinka laushinka force-pushed the laushinka/update-notification-4793 branch from fef01cc to 2fb5a61 Compare August 16, 2021 13:36
@laushinka
Copy link
Contributor Author

laushinka commented Aug 16, 2021

/werft run

👍 started the job as gitpod-build-laushinka-update-notification-4793.27

@JanKoehnlein
Copy link
Contributor

Looks like the initial values on the page are not automatically refreshed:

  • go to settings, check/uncheck a box
  • go to plans
  • go back to settings: old state shows up, only after a browser refresh the new ones are shown

});
await getGitpodService().server.trackEvent({
event: "notification_change",
properties: { "unsubscribed_changelog": isChangelogMail }
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I was at first glance confused why you're not using the !isChangelogMail here. Maybe it'd be better readable if we create a variable newIsChangelogMail = !isChangelogMail at the beginning of this block and use that instead of !isChangeLogMail in the following and write !newIsChangelogMail here. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this part did get confusing to me too, because the event name is a negative word “unsubscribe”. But your suggestion makes it a bit more readable. Will do this change.

});
await getGitpodService().server.trackEvent({
event: "notification_change",
properties: { "unsubscribed_devx": isDevXMail }
Copy link
Contributor

Choose a reason for hiding this comment

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

See above

@laushinka
Copy link
Contributor Author

Looks like the initial values on the page are not automatically refreshed:

  • go to settings, check/uncheck a box
  • go to plans
  • go back to settings: old state shows up, only after a browser refresh the new ones are shown

Fixed by setting the user context with the new value.

@JanKoehnlein
Copy link
Contributor

JanKoehnlein commented Aug 17, 2021

/werft run

👍 started the job as gitpod-build-laushinka-update-notification-4793.29

@JanKoehnlein
Copy link
Contributor

JanKoehnlein commented Aug 17, 2021

/werft run

👍 started the job as gitpod-build-laushinka-update-notification-4793.30

@JanKoehnlein
Copy link
Contributor

/lgtm
/unhold

@roboquat
Copy link
Contributor

LGTM label has been added.

Git tree hash: c021eea2f62fe8b11af4fa01308c95cdcc094239

@JanKoehnlein JanKoehnlein linked an issue Aug 17, 2021 that may be closed by this pull request
5 tasks
@JanKoehnlein
Copy link
Contributor

/approve no-issue

@roboquat
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JanKoehnlein

Associated issue requirement bypassed by: JanKoehnlein

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@roboquat roboquat merged commit d00ddee into main Aug 17, 2021
@roboquat roboquat deleted the laushinka/update-notification-4793 branch August 17, 2021 11:58

public async up(queryRunner: QueryRunner): Promise<any> {
if (await columnExists(queryRunner, "d_b_user", "allowsMarketingCommunication")) {
await queryRunner.query("UPDATE d_b_user set additionalData = JSON_MERGE_PATCH(IFNULL(additionalData, '{}'), JSON_SET('{\"emailNotificationSettings\":{\"allowsChangelogMail\":true}}', '$.emailNotificationSettings.allowsChangelogMail', IF(allowsMarketingCommunication, 'true', 'false')))");
Copy link
Member

Choose a reason for hiding this comment

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

@laushinka and @JanKoehnlein, please have a look at the db on gitpod-staging.com after this migration did run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, will do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've checked and it works as expected for both existing and new users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update notification preferences in dashboard
5 participants