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

DPMMA-1696 optionally stop engaging after closing the focus #12742

Merged

Conversation

patrykgruszka
Copy link
Member

@patrykgruszka patrykgruszka commented Sep 26, 2023

Q A
Bug fix? (use the a.b branch) [ N ]
New feature/enhancement? (use the a.x branch) [ Y ]
Deprecations? [ N ]
BC breaks? (use the c.x branch) [ N ]
Automated tests included? [ N ]
Related user documentation PR URL mautic/mautic-documentation#...
Related developer documentation PR URL mautic/developer-documentation#...
Issue(s) addressed Fixes #...

Description:

This PR adds a new option to the focus item builder to stop engaging when the user directly closes the focus (using the x key).
The implementation is similar to the existing Stop engaging after a conversion and is based on cookies. Therefore, the focus will no longer be displayed until the visitor clears their cookies.

Steps to test this PR:

  1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs here)
  2. Create new Focus Item with selected option Stop engaging after a closing the focus?
    image
  3. Create Landing Page and add Focus Item (via script in head/footer or token in builder)
  4. Open the landing page in a private window, the Focus Item should appear
  5. Refresh the page without closing the Focus Item, it should appear again
  6. Close the Focus Item with the 'x' button
  7. Refresh the page
  8. The Focus item should not appear until you clear your cookies

@patrykgruszka patrykgruszka marked this pull request as draft September 26, 2023 08:58
@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

Merging #12742 (da39693) into 5.1 (ab13d59) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##                5.1   #12742   +/-   ##
=========================================
  Coverage     58.70%   58.70%           
- Complexity    33646    33647    +1     
=========================================
  Files          2182     2182           
  Lines        101873   101875    +2     
=========================================
+ Hits          59801    59804    +3     
+ Misses        42072    42071    -1     
Files Coverage Δ
...ins/MauticFocusBundle/Form/Type/PropertiesType.php 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@patrykgruszka patrykgruszka marked this pull request as ready for review October 3, 2023 11:13
@patrykgruszka patrykgruszka changed the title Draft: DPMMA-1696 optionally stop engaging after closing the focus DPMMA-1696 optionally stop engaging after closing the focus Oct 3, 2023
@patrykgruszka patrykgruszka marked this pull request as draft October 3, 2023 11:30
@patrykgruszka patrykgruszka added WIP PR's that are not ready for review and are currently in progress focus-items Anything related to focus items labels Oct 4, 2023
@patrykgruszka patrykgruszka marked this pull request as ready for review November 2, 2023 10:17
@patrykgruszka patrykgruszka added ready-to-test PR's that are ready to test code-review-needed PR's that require a code review before merging and removed WIP PR's that are not ready for review and are currently in progress labels Nov 2, 2023
Copy link
Member

@kuzmany kuzmany left a comment

Choose a reason for hiding this comment

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

Why we do it so complicated?
Why we just after close do not set mautic_focus_id to -1 same like after submission

Focus.cookies.setItem('mautic_focus_{{ focus.id }}', -1, Infinity, '/');

@kuzmany kuzmany added the pending-feedback PR's and issues that are awaiting feedback from the author label Nov 3, 2023
@patrykgruszka
Copy link
Member Author

patrykgruszka commented Nov 3, 2023

@kuzmany sure, we could use mautic_focus_id, but that will not give us any information about why the focus item is no longer displayed. I wanted to use a separate cookie to separate this behaviour.

mautic_focus_id=-1 Could mean anything
mautic_focus_id_closed=2 Gives you exact info, that the Focus Item was closed two times and you can handle it in the code.

@patrykgruszka patrykgruszka removed the pending-feedback PR's and issues that are awaiting feedback from the author label Nov 3, 2023
@kuzmany
Copy link
Member

kuzmany commented Nov 3, 2023

@patrykgruszka Ok, understand. I prefer simplicity, but cannot block it just for that reason. Thanks. I will test it

Copy link
Member

@annamunk annamunk left a comment

Choose a reason for hiding this comment

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

I checked the changes and tested with "Stop engaging after closing" set to Yes, the cookie is set correctly. I like the idea of creating separate cookie that only stores information about closing the Focus Item, so the value won't be misleading.
focus_item_close

Copy link
Member

@kuzmany kuzmany left a comment

Choose a reason for hiding this comment

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

I've made basic tests and it works on my side.

@kuzmany kuzmany added ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged and removed ready-to-test PR's that are ready to test labels Nov 3, 2023
@kuzmany
Copy link
Member

kuzmany commented Nov 3, 2023

It needs rebase onto 5.1

@patrykgruszka patrykgruszka changed the base branch from 5.x to 5.1 November 3, 2023 12:25
@patrykgruszka patrykgruszka force-pushed the DPMMA-1696_focus-stop-engage-after-close branch from 0d95faa to da39693 Compare November 3, 2023 12:29
@patrykgruszka
Copy link
Member Author

@kuzmany right, I've just rebased this on 5.1. Thanks.

@annamunk thanks for your review.

@escopecz escopecz added this to the 5.1.0 milestone Nov 22, 2023
@escopecz escopecz added code-review-passed PRs which have passed code review and removed code-review-needed PR's that require a code review before merging labels Nov 22, 2023
@escopecz escopecz added the user-testing-passed PRs which have been successfully tested by the required number of people. label Nov 22, 2023
@escopecz escopecz merged commit da710ea into mautic:5.1 Nov 22, 2023
14 checks passed
@RCheesley RCheesley added the enhancement Any improvement to an existing feature or functionality label Apr 15, 2024
@RCheesley
Copy link
Member

@patrykgruszka this needs a small update to the docs on this page: https://docs.mautic.org/en/5.x/channels/focus_items.html - could you do that?

cc @mautic/education-team for 5.1 release.

@RCheesley
Copy link
Member

Docs are now done: mautic/user-documentation#273

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-review-passed PRs which have passed code review enhancement Any improvement to an existing feature or functionality focus-items Anything related to focus items ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged user-testing-passed PRs which have been successfully tested by the required number of people.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants