From 62dfb2040955390439e78c61ec259e85ed99ea6b Mon Sep 17 00:00:00 2001 From: Siobhan Date: Fri, 13 May 2022 16:37:22 +0100 Subject: [PATCH 1/5] Update comment to better clarify code's purpose --- .../java/org/wordpress/android/ui/posts/EditPostActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index ffe563bb9b9a..c88d1b645f13 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -2305,7 +2305,9 @@ private GutenbergPropsBuilder getGutenbergPropsBuilder() { String languageString = LocaleManager.getLanguage(EditPostActivity.this); String wpcomLocaleSlug = languageString.replace("_", "-").toLowerCase(Locale.ENGLISH); - // If this.mIsXPostsCapable has not been set, default to allowing xPosts + // this.mIsXPostsCapable may return true for non-WP.com sites, but the app only supports xPosts for P2-based + // WP.com sites. + // If the site is using the WP.com API and this.mIsXPostsCapable has not been set, default to allowing xPosts. boolean enableXPosts = mSite.isUsingWpComRestApi() && (mIsXPostsCapable == null || mIsXPostsCapable); EditorTheme editorTheme = mEditorThemeStore.getEditorThemeForSite(mSite); From 30ecde5a177f36f68fc8f685ba85e12181de55aa Mon Sep 17 00:00:00 2001 From: Siobhan Date: Fri, 13 May 2022 17:16:39 +0100 Subject: [PATCH 2/5] Improve comment conciseness "If the site is using the WP.com API..." was too verbose, especially considering that was evident from reading the conditional itself. It's therefore been removed with this comment. Instead, the previous sentence will be iterated on in a following commit to clarify why the 'isUsingWpComRestApi' is used. --- .../java/org/wordpress/android/ui/posts/EditPostActivity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index c88d1b645f13..065cca329b0a 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -10,6 +10,7 @@ import android.os.Handler; import android.preference.PreferenceManager; import android.text.TextUtils; +import android.util.Log; import android.view.DragEvent; import android.view.Menu; import android.view.MenuInflater; @@ -2307,7 +2308,7 @@ private GutenbergPropsBuilder getGutenbergPropsBuilder() { // this.mIsXPostsCapable may return true for non-WP.com sites, but the app only supports xPosts for P2-based // WP.com sites. - // If the site is using the WP.com API and this.mIsXPostsCapable has not been set, default to allowing xPosts. + // If this.mIsXPostsCapable has not been set, default to allowing xPosts. boolean enableXPosts = mSite.isUsingWpComRestApi() && (mIsXPostsCapable == null || mIsXPostsCapable); EditorTheme editorTheme = mEditorThemeStore.getEditorThemeForSite(mSite); From 7519db253a120fdf8ed197c5c2672612eb16a527 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Fri, 13 May 2022 17:17:39 +0100 Subject: [PATCH 3/5] Revert "Improve comment conciseness" This reverts commit 30ecde5a177f36f68fc8f685ba85e12181de55aa. --- .../java/org/wordpress/android/ui/posts/EditPostActivity.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index 065cca329b0a..c88d1b645f13 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -10,7 +10,6 @@ import android.os.Handler; import android.preference.PreferenceManager; import android.text.TextUtils; -import android.util.Log; import android.view.DragEvent; import android.view.Menu; import android.view.MenuInflater; @@ -2308,7 +2307,7 @@ private GutenbergPropsBuilder getGutenbergPropsBuilder() { // this.mIsXPostsCapable may return true for non-WP.com sites, but the app only supports xPosts for P2-based // WP.com sites. - // If this.mIsXPostsCapable has not been set, default to allowing xPosts. + // If the site is using the WP.com API and this.mIsXPostsCapable has not been set, default to allowing xPosts. boolean enableXPosts = mSite.isUsingWpComRestApi() && (mIsXPostsCapable == null || mIsXPostsCapable); EditorTheme editorTheme = mEditorThemeStore.getEditorThemeForSite(mSite); From 5f087bff30e00809b36033e36e15bf4b72912c78 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Fri, 13 May 2022 17:18:21 +0100 Subject: [PATCH 4/5] Improve comment conciseness "If the site is using the WP.com API..." was too verbose, especially considering that was evident from reading the conditional itself. It's therefore been removed with this comment. Instead, the previous sentence will be iterated on in a following commit to clarify why the 'isUsingWpComRestApi' is used. --- .../java/org/wordpress/android/ui/posts/EditPostActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index c88d1b645f13..82a96a079abf 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -2307,7 +2307,7 @@ private GutenbergPropsBuilder getGutenbergPropsBuilder() { // this.mIsXPostsCapable may return true for non-WP.com sites, but the app only supports xPosts for P2-based // WP.com sites. - // If the site is using the WP.com API and this.mIsXPostsCapable has not been set, default to allowing xPosts. + // If this.mIsXPostsCapable has not been set, default to allowing xPosts. boolean enableXPosts = mSite.isUsingWpComRestApi() && (mIsXPostsCapable == null || mIsXPostsCapable); EditorTheme editorTheme = mEditorThemeStore.getEditorThemeForSite(mSite); From a96f115382500edbef7fe609c50a9a36b3ce2220 Mon Sep 17 00:00:00 2001 From: Siobhan Bamber Date: Fri, 13 May 2022 17:20:00 +0100 Subject: [PATCH 5/5] Clarify usage of 'isUsingWpComRestApi' Co-authored-by: Stefanos Togoulidis --- .../java/org/wordpress/android/ui/posts/EditPostActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index 82a96a079abf..9bbe2e9a5a62 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -2306,7 +2306,7 @@ private GutenbergPropsBuilder getGutenbergPropsBuilder() { String wpcomLocaleSlug = languageString.replace("_", "-").toLowerCase(Locale.ENGLISH); // this.mIsXPostsCapable may return true for non-WP.com sites, but the app only supports xPosts for P2-based - // WP.com sites. + // WP.com sites so, gate with `isUsingWpComRestApi()` // If this.mIsXPostsCapable has not been set, default to allowing xPosts. boolean enableXPosts = mSite.isUsingWpComRestApi() && (mIsXPostsCapable == null || mIsXPostsCapable);