Repository: oppia/oppia

Issue:
[BUG]: Eliminate obsolete feature flags
### Describe the bug

We have feature flags for `android_beta_landing_page` and `blog_pages`, but now that these features are fully deployed and stable, their feature flags should be removed. Eliminate the feature flags for these pages and instead have them always be active.

### URL of the page where the issue is observed.

_No response_

### Steps To Reproduce

_No response_

### Expected Behavior

_No response_

### Screenshots/Videos

_No response_

### What device are you using?

_No response_

### Operating System

_No response_

### What browsers are you seeing the problem on?

_No response_

### Browser version

_No response_

### Additional context

_No response_

### Tips for developers

Before tackling the bug, please use `git bisect` (see https://git-scm.com/docs/git-bisect) to investigate which PR caused it (you only need to go back as far as commit https://github.com/oppia/oppia/commits/9a334e9). If you find the PR, leave a comment on this issue pointing to it, or just say that it happened before commit 9a334e9 if you could reproduce it there. This will help us fix the issue by reverting the faulty PR.

Also, if this is your first issue, please make sure to follow https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#choosing-a-good-first-issue and https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#setting-things-up before claiming it. Thanks!

[BUG]: Eliminate obsolete feature flags
### Describe the bug

We have feature flags for `android_beta_landing_page` and `blog_pages`, but now that these features are fully deployed and stable, their feature flags should be removed. Eliminate the feature flags for these pages and instead have them always be active.

### URL of the page where the issue is observed.

_No response_

### Steps To Reproduce

_No response_

### Expected Behavior

_No response_

### Screenshots/Videos

_No response_

### What device are you using?

_No response_

### Operating System

_No response_

### What browsers are you seeing the problem on?

_No response_

### Browser version

_No response_

### Additional context

_No response_

### Tips for developers

Before tackling the bug, please use `git bisect` (see https://git-scm.com/docs/git-bisect) to investigate which PR caused it (you only need to go back as far as commit https://github.com/oppia/oppia/commits/9a334e9). If you find the PR, leave a comment on this issue pointing to it, or just say that it happened before commit 9a334e9 if you could reproduce it there. This will help us fix the issue by reverting the faulty PR.

Also, if this is your first issue, please make sure to follow https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#choosing-a-good-first-issue and https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#setting-things-up before claiming it. Thanks!



Discussion:
Can I give it a try? 
Can you assigne this issue to me
@tarunsamanta2k20 @princekumarg if you want to work on this issue, please follow our [instructions for taking up a good first issue](https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#choosing-a-good-first-issue). Specifically, make sure your comment "describes in more detail how you'd tackle the issue (e.g. explain which file(s) you would modify and what changes you would make). If your explanation makes sense, we'll assign the issue to you."
@U8NWXD according to me removing ANDROID_BETA_LANDING_PAGE and BLOG_PAGES from **platfrom_feature_list.py** can work as it is mentioned in that file "Features not added in the lists above won't be available to be enabled via the admin page." or they can also be added to DEPRECATED_FEATURE_NAMES. 
If this looks like a viable solution can you assign this issue to me?
@U8NWXD. I would like to work on this issue. My approach to this issue would be identifying the files which have android_beta_landing_page and blog_pages feature flags. According to my research on code base, there are 5 files which are having these feature flags under different folders. So deleting them would solve the issue. 

@U8NWXD I would like work on this issue...... can you assign it to me ?


> @U8NWXD I would like work on this issue...... can you assign it to me ?

Viable solution according to me:

Remove the Flags: Simply remove or comment out the lines of code that set or check these feature flags. This will ensure that the "android_beta_landing_page" and "blog_pages" are always active.
@Satyam298 @Sridevi139 your proposals would result in the pages never being active, but we want them to always be active. @divyanshsharma2280 your approach sounds good, but I already assigned you to #18921. Which would you rather work on?
I would work on this one (#18922).
@U8NWXD 

i  replicated this issue and fixed on my local .

my approach
commented **ANDROID_BETA_LANDING_PAGE** ( **AndroidBetaLandingPage** in ts  files)  ,(**BlogPages** in ts files )**BLOG_PAGES** and their references in  *.py files and *.ts.(I think we refer them in nearly 20 -25 files)

update test cases ( both .py and .ts files)

**if we dont comment in ts files frontend throws an error ( like feature does not exist)**


please let me know if i can take up this ? 




@U8NWXD can I please get this issue assigned to me? I think removing or commenting out android_beta_landing_page and blog_pages flags can solve the issue. 
@U8NWXD, I have worked on this issue on my local system.

My solution:
I commented android_beta_landing_page ( AndroidBetaLandingPage in ts files) , blog_pages (BlogPages in ts files ) and their references in *.py files and *.ts (there reference can be found in least 20 ). I also updated test cases ( both .py and .ts files)

Description:
commenting them in ts files is necessary to prevent errors ( like feature does not exist)

I would like to cork on this issue further, and kindly request to be assigned this issue.
Hi folks -- apologies for the late reply on this.

Just a note, commenting out lines is not OK. We don't want dead code in the codebase.

It is a bit hard to tell from the solution descriptions above whether the problem is properly understood. I suggest that, if you would like to take this up, showing a screenshot of your changes for one or two of the files. The first person to demonstrate that they understand what needs to be done here will be assigned the issue.
Hey @U8NWXD @seanlip 
`about-page.component.ts` file need to be changed
Below is the screenshot of the file, the code under red box is responsible for checking the feature flag. 
![image](https://github.com/oppia/oppia/assets/121742871/2a7e6d56-b563-4511-8167-e4f2350c6e50)

**I will delete this check as I think it is not needed** 
_Alternatively_, we can make this flag check return true. In that case we won't be able to remove the feature flag.

Similarly there are about 12 files which have the reference for the 'android_beta_landing_page' feature flag. I will search for all the checks and remove the feature flags for both `android_beta_landing_page` and `blog_pages`.

**I would like to work on this issue**

@amaanlari I don't think your solution is complete. If you delete that function then what happens to code which calls that function?

Please try doing this on your local machine and making sure everything works correctly. Submit an explanation with a clear description of the changes you make (and proof of correctness), and if it looks right we can assign you.
Hi @seanlip , 

**Changes made for `android_beta_landing_page` feature flag :**
There are lots of files to be changed. I found all the files which uses the `android_beta_landing_page` feature flag.
We need to remove all the methods that checks for the feature flag and the also remove the flag variable. Also remove the tests in the spec.ts files which checks the flags in their enabled/disabled states which might not be needed.

Here's an example of the changes to be made in the about page 
[Screencast from 2023-10-30 02-29-20.webm](https://github.com/oppia/oppia/assets/121742871/eb4842f8-b066-4ce8-9254-0a651a624a6c)


**The commented lines will be removed from the code**

These files have similar changes as above:

- `social-buttons.component.ts`
- `top-navigation-bar.component.ts`
- `android-page-root.component.ts`
- `splash-page.component.ts`
- `teach-page.component.ts`

All these files have their corresponding `spec.ts` file and HTML file which needs to changed in similar manner.
This makes the andorid beta landing page and its related components on other pages to be active always.
To completely eliminate the feature flag there are further changes in python files as shown below:

These are the changes:
[Screencast from 2023-10-30 02-17-14.webm](https://github.com/oppia/oppia/assets/121742871/7f337d63-24b7-4fba-b324-2a81d88715d1)

I have eliminated the `android_beta_landing_page` feature flag and this is screen recording of the site on my local machine:
[Screencast from 2023-10-30 03-00-39.webm](https://github.com/oppia/oppia/assets/121742871/cbe212a5-f0f3-4968-ac04-7d2204497bca)

I will be changing the `blog_pages` feature flag as it has similar changes.
@amaanlari Thanks. Can you show your proposed changes to the HTML/spec files for top-navigation-bar? If those look good we can assign you.
@seanlip 
HTML file changes:
![image](https://github.com/oppia/oppia/assets/121742871/a9a908e5-a62e-457c-a34f-01127ce14d8c)

spec file changes:
![image](https://github.com/oppia/oppia/assets/121742871/0288252b-2895-408f-96ff-55c075322b1f)

![image](https://github.com/oppia/oppia/assets/121742871/5070e8eb-aebf-4090-bd92-e3900b15390e)

Besides this change, we need to remove the commented lines in the screenshots above for the `blog_pages` 
Thanks. The HTML changes are not quite correct -- if `(blur) = null` then you should just get rid of the attr entirely, and in the following line you should move the `class="nav-content"` up by one line so it's on the same line as `<a`. Something to keep in mind when you remove stuff -- make sure dead code is dropped properly so that future devs don't wonder why it's left like that. 

But I think this is good enough to assign you to, so feel free to go for it :)

Also, one more important note: when you get rid of those feature flags, make sure to move them to the DEPRECATED_FEATURE_NAMES constant in the same file. This will prevent their reuse. I don't think you've actually done this in your video.
Can I give it a try? 
Can you assigne this issue to me
@tarunsamanta2k20 @princekumarg if you want to work on this issue, please follow our [instructions for taking up a good first issue](https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#choosing-a-good-first-issue). Specifically, make sure your comment "describes in more detail how you'd tackle the issue (e.g. explain which file(s) you would modify and what changes you would make). If your explanation makes sense, we'll assign the issue to you."
@U8NWXD according to me removing ANDROID_BETA_LANDING_PAGE and BLOG_PAGES from **platfrom_feature_list.py** can work as it is mentioned in that file "Features not added in the lists above won't be available to be enabled via the admin page." or they can also be added to DEPRECATED_FEATURE_NAMES. 
If this looks like a viable solution can you assign this issue to me?
@U8NWXD. I would like to work on this issue. My approach to this issue would be identifying the files which have android_beta_landing_page and blog_pages feature flags. According to my research on code base, there are 5 files which are having these feature flags under different folders. So deleting them would solve the issue. 

@U8NWXD I would like work on this issue...... can you assign it to me ?


> @U8NWXD I would like work on this issue...... can you assign it to me ?

Viable solution according to me:

Remove the Flags: Simply remove or comment out the lines of code that set or check these feature flags. This will ensure that the "android_beta_landing_page" and "blog_pages" are always active.
@Satyam298 @Sridevi139 your proposals would result in the pages never being active, but we want them to always be active. @divyanshsharma2280 your approach sounds good, but I already assigned you to #18921. Which would you rather work on?
I would work on this one (#18922).
@U8NWXD 

i  replicated this issue and fixed on my local .

my approach
commented **ANDROID_BETA_LANDING_PAGE** ( **AndroidBetaLandingPage** in ts  files)  ,(**BlogPages** in ts files )**BLOG_PAGES** and their references in  *.py files and *.ts.(I think we refer them in nearly 20 -25 files)

update test cases ( both .py and .ts files)

**if we dont comment in ts files frontend throws an error ( like feature does not exist)**


please let me know if i can take up this ? 




@U8NWXD can I please get this issue assigned to me? I think removing or commenting out android_beta_landing_page and blog_pages flags can solve the issue. 
@U8NWXD, I have worked on this issue on my local system.

My solution:
I commented android_beta_landing_page ( AndroidBetaLandingPage in ts files) , blog_pages (BlogPages in ts files ) and their references in *.py files and *.ts (there reference can be found in least 20 ). I also updated test cases ( both .py and .ts files)

Description:
commenting them in ts files is necessary to prevent errors ( like feature does not exist)

I would like to cork on this issue further, and kindly request to be assigned this issue.
Hi folks -- apologies for the late reply on this.

Just a note, commenting out lines is not OK. We don't want dead code in the codebase.

It is a bit hard to tell from the solution descriptions above whether the problem is properly understood. I suggest that, if you would like to take this up, showing a screenshot of your changes for one or two of the files. The first person to demonstrate that they understand what needs to be done here will be assigned the issue.
Hey @U8NWXD @seanlip 
`about-page.component.ts` file need to be changed
Below is the screenshot of the file, the code under red box is responsible for checking the feature flag. 
![image](https://github.com/oppia/oppia/assets/121742871/2a7e6d56-b563-4511-8167-e4f2350c6e50)

**I will delete this check as I think it is not needed** 
_Alternatively_, we can make this flag check return true. In that case we won't be able to remove the feature flag.

Similarly there are about 12 files which have the reference for the 'android_beta_landing_page' feature flag. I will search for all the checks and remove the feature flags for both `android_beta_landing_page` and `blog_pages`.

**I would like to work on this issue**

@amaanlari I don't think your solution is complete. If you delete that function then what happens to code which calls that function?

Please try doing this on your local machine and making sure everything works correctly. Submit an explanation with a clear description of the changes you make (and proof of correctness), and if it looks right we can assign you.
Hi @seanlip , 

**Changes made for `android_beta_landing_page` feature flag :**
There are lots of files to be changed. I found all the files which uses the `android_beta_landing_page` feature flag.
We need to remove all the methods that checks for the feature flag and the also remove the flag variable. Also remove the tests in the spec.ts files which checks the flags in their enabled/disabled states which might not be needed.

Here's an example of the changes to be made in the about page 
[Screencast from 2023-10-30 02-29-20.webm](https://github.com/oppia/oppia/assets/121742871/eb4842f8-b066-4ce8-9254-0a651a624a6c)


**The commented lines will be removed from the code**

These files have similar changes as above:

- `social-buttons.component.ts`
- `top-navigation-bar.component.ts`
- `android-page-root.component.ts`
- `splash-page.component.ts`
- `teach-page.component.ts`

All these files have their corresponding `spec.ts` file and HTML file which needs to changed in similar manner.
This makes the andorid beta landing page and its related components on other pages to be active always.
To completely eliminate the feature flag there are further changes in python files as shown below:

These are the changes:
[Screencast from 2023-10-30 02-17-14.webm](https://github.com/oppia/oppia/assets/121742871/7f337d63-24b7-4fba-b324-2a81d88715d1)

I have eliminated the `android_beta_landing_page` feature flag and this is screen recording of the site on my local machine:
[Screencast from 2023-10-30 03-00-39.webm](https://github.com/oppia/oppia/assets/121742871/cbe212a5-f0f3-4968-ac04-7d2204497bca)

I will be changing the `blog_pages` feature flag as it has similar changes.
@amaanlari Thanks. Can you show your proposed changes to the HTML/spec files for top-navigation-bar? If those look good we can assign you.
@seanlip 
HTML file changes:
![image](https://github.com/oppia/oppia/assets/121742871/a9a908e5-a62e-457c-a34f-01127ce14d8c)

spec file changes:
![image](https://github.com/oppia/oppia/assets/121742871/0288252b-2895-408f-96ff-55c075322b1f)

![image](https://github.com/oppia/oppia/assets/121742871/5070e8eb-aebf-4090-bd92-e3900b15390e)

Besides this change, we need to remove the commented lines in the screenshots above for the `blog_pages` 
Thanks. The HTML changes are not quite correct -- if `(blur) = null` then you should just get rid of the attr entirely, and in the following line you should move the `class="nav-content"` up by one line so it's on the same line as `<a`. Something to keep in mind when you remove stuff -- make sure dead code is dropped properly so that future devs don't wonder why it's left like that. 

But I think this is good enough to assign you to, so feel free to go for it :)

Also, one more important note: when you get rid of those feature flags, make sure to move them to the DEPRECATED_FEATURE_NAMES constant in the same file. This will prevent their reuse. I don't think you've actually done this in your video.

Resolving patch:
diff --git a/core/domain/platform_parameter_registry.py b/core/domain/platform_parameter_registry.py
--- a/core/domain/platform_parameter_registry.py
+++ b/core/domain/platform_parameter_registry.py
@@ -409,17 +409,6 @@ def _to_platform_parameter_model(
     platform_parameter_domain.FeatureStages.PROD,
 )
 
-Registry.create_feature_flag(
-    ParamNames.ANDROID_BETA_LANDING_PAGE,
-    'This flag is for Android beta promo landing page.',
-    platform_parameter_domain.FeatureStages.PROD)
-
-Registry.create_feature_flag(
-    ParamNames.BLOG_PAGES,
-    'This flag is for blog home page, blog author profile page and blog post' +
-    ' page.',
-    platform_parameter_domain.FeatureStages.PROD)
-
 Registry.create_feature_flag(
     ParamNames.DIAGNOSTIC_TEST,
     'This flag is for the diagnostic test functionality.',
diff --git a/core/platform_feature_list.py b/core/platform_feature_list.py
--- a/core/platform_feature_list.py
+++ b/core/platform_feature_list.py
@@ -62,8 +62,6 @@
     params.ParamNames.DUMMY_FEATURE_FLAG_FOR_E2E_TESTS,
     params.ParamNames.END_CHAPTER_CELEBRATION,
     params.ParamNames.CHECKPOINT_CELEBRATION,
-    params.ParamNames.ANDROID_BETA_LANDING_PAGE,
-    params.ParamNames.BLOG_PAGES,
     params.ParamNames.CONTRIBUTOR_DASHBOARD_ACCOMPLISHMENTS,
     params.ParamNames.DIAGNOSTIC_TEST,
     params.ParamNames.IS_IMPROVEMENTS_TAB_ENABLED,
@@ -74,6 +72,8 @@
 # completed and no longer gated because their functionality is permanently
 # built into the codebase.
 DEPRECATED_FEATURE_NAMES: List[ParamNames] = [
+    params.ParamNames.ANDROID_BETA_LANDING_PAGE,
+    params.ParamNames.BLOG_PAGES,
 ]
 
 ALL_PLATFORM_PARAMS_EXCEPT_FEATURE_FLAGS: List[ParamNames] = [


Test patch:
diff --git a/core/domain/platform_parameter_list_test.py b/core/domain/platform_parameter_list_test.py
--- a/core/domain/platform_parameter_list_test.py
+++ b/core/domain/platform_parameter_list_test.py
@@ -29,8 +29,6 @@ class ExistingPlatformParameterValidityTests(test_utils.GenericTestBase):
     """
 
     EXPECTED_PARAM_NAMES = ['always_ask_learners_for_answer_details',
-                            'android_beta_landing_page',
-                            'blog_pages',
                             'cd_admin_dashboard_new_ui',
                             'checkpoint_celebration',
                             'contributor_dashboard_accomplishments',