[Editor] Make sure editor session starts (with content_type=new) matches post_created event#10097
Conversation
…es `post_created` event by re-using the same logic to track a post as new
content_type=new) event match…content_type=new) matches post_created event
content_type=new) matches post_created eventcontent_type=new) matches post_created event
WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java
Outdated
Show resolved
Hide resolved
|
I'm attempting to reproduce on WordPress-Android develop (47f36b2) and I'm unable to save an empty draft to test the behavior in the second test. Also, when I leave the editor, the empty post is not shown in drafts (I guess it never saves when exiting the editor, if the post is empty). Are there some special steps to save an empty post? |
|
@mkevins Nope, you can't save a completely empty post|page. In order to test no.2 you need to insert a title, and keep the content blank. You can either do that on the web, or in the mobile app. |
|
@daniloercoli not sure why, but when I test case 2 on develop, without these changes, I observe that Edit: I tried this from a post only drafted on web, as well as a post drafted on mobile. In both cases, I see |
|
@mkevins That's the default/correct behaviour. Previously to this PR the session tracking logic was just checking the post content, instead it should rely on the |
mkevins
left a comment
There was a problem hiding this comment.
Previously to this PR the session tracking logic was just checking the post content, instead it should rely on the
mIsNewPostvariable, and be in par with the other tracking logic.
Ah, this logic is working correctly with this PR. I tested this on with a Pixel 3a (real device). In the testing steps, I first tested the behavior on develop, and was expecting both case 1 and case 2 to "fail", but observed that for case 2, the member variable mIsNewPost was already false when reaching the condition that skips the call to trackEditorCreatedPost. Specifically, the bullet point:
Make sure trackEditorCreatedPost is not bumped
Was behaving correctly even prior to these changes. I had misinterpreted the testing steps to expect differing behavior for that specific point on develop, so thanks for clarifying.
Indeed the salient bullet point:
Make sure createPostEditorAnalyticsSessionTracker is called with isNewPost = false
Is working correctly on this PR (and not working correctly on develop). This looks good, and fixes the issue as described. LGTM! 🎉
This PR fixes #10061 by making sure to re-use the same logic to track a post as
newin bothsession_startsandpost_createdevents.Note: The logic is pretty simple, there is a boolean flag passed to the activity, that is true on new posts only. Previously, the session_starts event was checking if the post content was empty or not, and it failed on draft posts with empty content.
To test:
isNewPostis truetrackEditorCreatedPostis reachedTo test #2
trackEditorCreatedPostis not bumpedcreatePostEditorAnalyticsSessionTrackeris called withisNewPost= falseUpdate release notes:
RELEASE-NOTES.txt.