-
Notifications
You must be signed in to change notification settings - Fork 293
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
Simplify logic around user input completion state #5900
Comments
@kuasha420 this is worded in a way that could be misinterpreted. I think the intention here is that
This part is a bit confusing as well. Above we're saying the completion status can be represented as a boolean now, but here we're referring to new named user input states. AFAIU, we should be able to remove |
@aaemnnosttv I have updated the wordings and merged #5901 with this one. It it looks good to you. feel free to close #5901. Cheers! |
Thanks @kuasha420 – LGTM 👍 |
Hi @kuasha420! 👋 Quick question regarding the ACs here. I’m working on the IB and it strikes me, do we really need a method to check the completion state of user input? I ask this because since we no longer need to redirect the user to the user input page based on the completion state (we will only redirect once after authorisation, if user input settings are not set, which can be checked using I'm sure I'm missing something and just in need of a little clarification. Thank you! |
Hi @nfmohit ! While brainstorming, my thought was that we will store the answers in separate Options field, that this function would return true if all the options are set ie. all questions answered. Which will be used in Key Metrics CTA in Dashboard and settings to determine whether the user has completed User Input questions. If we can easily determine that without this method, we can safely skip the method. Hope that clears it up. Cheers. |
Thank you for the clarification, @kuasha420! |
Hi @nfmohit, thanks for the IB. I am not sure about this point:
I might have misunderstood something here but this does not appear needed to fulfil the AC and seems counter to the stated aim of the User Input V2 Design Doc, which in the Overview states:
It looks to me like implementing the above point would result in new users being redirected to the User Input page. Please could you take a look and either clarify or update/remove this point as necessary? cc @kuasha420 |
Thank you for pointing that out, @techanvil. I have updated the IB to remove the condition and method call entirely. |
Thanks @nfmohit! I've spotted something else, sorry for not realising yesterday. Bear in mind this AC point:
The IB removes We should in fact, rather than simply removing |
QA Update: ❌I have an observation and a question.
ui-3.mp4
|
@wpdarren Thanks for the thorough testing as always!
|
QA Update: ✅Thanks @jimmymadon for clarifying those issues will be fixed in other tickets. Verified:
ui-5.mp4 |
@aaemnnosttv @kuasha420 @jimmymadon Apologies, looking at this for approval, I'm lacking some context here. I have tried to find the pull request that addresses this issue but don't see it anywhere in the issue history, and somehow most references in here appear to be from December 2022 or older. What is the context here? If this was implemented such a long time ago, why is it only in a release now? Or am I just missing something? :) |
@felixarntz Here is the PR that addresses this issue. Not sure why it didn't show up as a linked issue - I've linked it in Zenhub and via the comment template on the PR issue. Hope this is what you were looking for - thanks! |
@felixarntz the PR is linked above but that event was in a folded group by GitHub so you wouldn't see it without expanding that. Note: I just amended the AC here to remove a reference to a specific class that no longer exists. There was already a relevant requirement, so that part was more of an implementation detail anyways. This LGTM though so, closing it out! |
Feature Description
Going forward, user input questions will no longer be mandatory to answer and the given answers will live on the sites WordPress database. Therefore, there will be only two states for a given user regarding User Input completion: complete and incomplete.
Also, it will be easier to infer this state from the saved values and can be represented as a boolean. This will significantly simplify logic around
User_Input_State
andUser_Input_Settings
.Going forward, the User Input is optional for all users, therefore, there should no longer be any automatic redirection to user-input page based on the completion state of User Input Survey.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
REQUIRED
(mandatory) state.User_Input_State
class should be removed and its usage should be refactored to make use of the above method.Implementation Brief
includes/Core/Util/User_Input_Settings.php
:is_complete()
). In this method:get()
method from the same class (being implemented in Store User Input answers in Site Database #5898) to get the values of the user input questions.true
if the values contain answers for all three questions, i.e.purpose
,postFrequency
, andgoals
(being refined in Update questions and related copies of User Input Screens #5888).includes/Core/Authentication/Authentication.php
:require_user_input()
verify_user_input_settings()
get_user_input_state()
register()
method:admin_init
hook) that calls theverify_user_input_settings
method.admin_init
hook) that redirects the user to theuser-input
page ifUser_Input_State
isVALUE_REQUIRED
.googlesitekit_authorize_user
hook and remove the call therequire_user_input()
method (along with its condition checking if$previous_scopes
is empty).googlesitekit_user_data
hook, replace theuserInputState
key added to the$user
array withisUserInputComplete
mapped to a call to the newis_complete()
method fromUser_Input_Settings
.User_Input_State
class (i.e. deleteincludes/Core/Authentication/User_Input_State.php
).assets/js/googlesitekit/datastore/user/user-info.js
:RECEIVE_USER_INPUT_STATE
and its value toRECEIVE_IS_USER_INPUT_COMPLETE
. Update all its usages accordingly.userInputState
withisUserInputComplete
receiveUserInputState
action to bereceiveIsUserInputComplete
. Update all its usages accordingly.getUserInputState
selector to begetIsUserInputComplete
. Update all its usages accordingly.getUserInputState
resolver to begetIsUserInputComplete
.User_Input_State
class.includes/Core/Authentication/Authentication.php
.getUserInputState
selector from theCORE_USER
store:userInputState
, change it toisUserInputComplete
.complete
.Test Coverage
is_complete()
).User_Input_State
class (tests/phpunit/integration/Core/Authentication/User_Input_StateTest.php
and others).tests/e2e/plugins/user-input.php
tests/phpunit/integration/Core/Authentication/AuthenticationTest.php
tests/phpunit/integration/Core/Util/User_Input_SettingsTest.php
assets/js/googlesitekit/datastore/user/user-input-settings.test.js
assets/js/googlesitekit/datastore/user/user-info.test.js
QA Brief
userInput
feature flag, verify the automatic redirect from dashboard to User Input Questionnaire does not happen. Only the new Key Metrics banner should be visible. Clicking on "Personalise your metrics" should take you to the questionnaire which should be fillable as usual.Authentication
class, smoke test the setup and authentication of the plugin and all modules.Changelog entry
The text was updated successfully, but these errors were encountered: