Skip to content

Commit

Permalink
Revert "Milestone 1.3 and 1.4: Adds blog homepage and post page front…
Browse files Browse the repository at this point in the history
…end" (oppia#16314)

Revert "Milestone 1.3 and 1.4: Adds blog homepage and post page frontend (oppia#16040)"

This reverts commit 116b42f.
  • Loading branch information
gp201 authored Oct 15, 2022
1 parent ff6d0f3 commit 4b85e4d
Show file tree
Hide file tree
Showing 72 changed files with 189 additions and 5,378 deletions.
3 changes: 0 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@
/core/controllers/blog_homepage*.py @oppia/lace-backend-reviewers
/core/templates/domain/blog/ @oppia/lace-frontend-reviewers
/core/templates/pages/blog-dashboard-page/ @oppia/lace-frontend-reviewers
/core/templates/pages/blog-home-page/ @oppia/lace-frontend-reviewers
/core/templates/pages/blog-post-page/ @oppia/lace-frontend-reviewers

# Collection project.
/core/controllers/collection*.py @oppia/lace-backend-reviewers
Expand Down Expand Up @@ -226,7 +224,6 @@
/core/templates/pages/exploration-editor-page/settings-tab/ @oppia/lace-frontend-reviewers
/core/templates/pages/exploration-player-page/ @oppia/lace-frontend-reviewers
/core/templates/components/state-editor/ @oppia/lace-frontend-reviewers
/core/templates/services/blog-search.service.ts @oppia/lace-frontend-reviewers
/core/templates/services/compute-graph.service.ts @oppia/lace-frontend-reviewers
/core/templates/services/context.service*.ts @oppia/lace-frontend-reviewers
/core/templates/services/editability.service*.ts @oppia/lace-frontend-reviewers
Expand Down
61 changes: 0 additions & 61 deletions assets/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6169,9 +6169,6 @@ export default {
// eslint-disable-next-line max-len
"DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR": "Check out this interactive lesson on Oppia - a free platform for teaching and learning!",

// eslint-disable-next-line max-len
"DEFUALT_BLOG_POST_SHARE_TWITTER_TEXT": "Check out this new blog post on Oppia!",

"OPPORTUNITY_TYPE_SKILL": "skill",
"OPPORTUNITY_TYPE_TRANSLATION": "translation",
"OPPORTUNITY_TYPE_VOICEOVER": "voiceover",
Expand Down Expand Up @@ -6709,64 +6706,6 @@ export default {
}
]
},
"BLOG_HOMEPAGE": {
"ROUTE": "blog",
"TITLE": "I18N_BLOG_HOME_PAGE_TITLE",
"META": [
{
"PROPERTY_TYPE": "itemprop",
"PROPERTY_VALUE": "description",
// eslint-disable-next-line max-len
"CONTENT": "Read the latest on what's new and exciting with Oppia."
},
{
"PROPERTY_TYPE": "itemprop",
"PROPERTY_VALUE": "og:description",
// eslint-disable-next-line max-len
"CONTENT": "Read the latest on what's new and exciting with Oppia."
}
]
},
"BLOG_HOMEPAGE_SEARCH": {
"ROUTE": "blog/search/find",
"TITLE": "I18N_BLOG_HOME_PAGE_TITLE",
"META": [
{
"PROPERTY_TYPE": "itemprop",
"PROPERTY_VALUE": "description",
// eslint-disable-next-line max-len
"CONTENT": "Read the latest on what's new and exciting with Oppia."
},
{
"PROPERTY_TYPE": "itemprop",
"PROPERTY_VALUE": "og:description",
// eslint-disable-next-line max-len
"CONTENT": "Read the latest on what's new and exciting with Oppia."
}
]
},
"BLOG_POST_PAGE": {
"ROUTE": "blog/:blog_post_url_fragment",
"TITLE": "I18N_BLOG_POST_PAGE_TITLE",
// Some routes contain url fragments, as syntax for url fragments are
// different for angular router and backend. They have to be registered
// manually in the backend. Please use angular router syntax here.
"MANUALLY_REGISTERED_WITH_BACKEND": true,
"META": [
{
"PROPERTY_TYPE": "itemprop",
"PROPERTY_VALUE": "description",
// eslint-disable-next-line max-len
"CONTENT": "Read the latest on what's new and exciting with Oppia."
},
{
"PROPERTY_TYPE": "itemprop",
"PROPERTY_VALUE": "og:description",
// eslint-disable-next-line max-len
"CONTENT": "Read the latest on what's new and exciting with Oppia."
}
]
},
"SPLASH": {
"ROUTE": "",
"TITLE": "Oppia | Free, Online and Interactive Lessons for Anyone",
Expand Down
16 changes: 0 additions & 16 deletions assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,6 @@
"I18N_BLOG_DASHBOARD_PAGE_NEW_POST_BUTTON": "New Post",
"I18N_BLOG_DASHBOARD_TAB_DRAFTS": "Drafts",
"I18N_BLOG_DASHBOARD_TAB_PUBLISHED": "Published",
"I18N_BLOG_HOME_PAGE_BREADCRUMB": "Blog",
"I18N_BLOG_HOME_PAGE_NO_RESULTS_FOUND": "Sorry, there are no blog posts to show.",
"I18N_BLOG_HOME_PAGE_OPPIA_DESCRIPTION": "Building a community to provide quality education for those who lack access to it.",
"I18N_BLOG_HOME_PAGE_POSTS_HEADING": "Latest Posts",
"I18N_BLOG_HOME_PAGE_POSTS_NUMBER_DISPLAY": "Displaying <[startingNumber]> - <[endingNumber]> of <[totalNumber]> posts",
"I18N_BLOG_HOME_PAGE_QUERY_SEARCH_HEADING": "Keywords",
"I18N_BLOG_HOME_PAGE_TAGS_SEARCH_HEADING": "Tags",
"I18N_BLOG_HOME_PAGE_TAG_FILTER_HOLDER_TEXT": "Choose Tags",
"I18N_BLOG_HOME_PAGE_TITLE": "Oppia Blog | Oppia",
"I18N_BLOG_HOME_PAGE_WELCOME_HEADING": "Welcome to the Oppia Blog!",
"I18N_BLOG_HOME_SEARCH_PAGE_POSTS_HEADING": "Showing Search Results",
"I18N_BLOG_HOME_SEARCH_PAGE_POSTS_NUMBER_DISPLAY": "Displaying <[startingNumber]> - <[endingNumber]> of total search results.",
"I18N_BLOG_HOME_SEARCH_PAGE_POSTS_NUMBER_OUT_OF_TOTAL_DISPLAY": "Displaying <[startingNumber]> - <[endingNumber]> of <[totalNumber]> posts.",
"I18N_BLOG_POST_EDITOR_ADD_THUMBNAIL_TEXT": "Add Thumbnail Image",
"I18N_BLOG_POST_EDITOR_BODY_HEADING": "Body",
"I18N_BLOG_POST_EDITOR_CANCEL_BUTTON_TEXT": "Cancel",
Expand All @@ -136,9 +123,6 @@
"I18N_BLOG_POST_EDITOR_TAGS_LIMIT_SPECIFICATION_SUFFIX": "more tags can still be added.",
"I18N_BLOG_POST_EDITOR_THUMBNAIL_HEADING": "Thumbnail",
"I18N_BLOG_POST_EDITOR_TITLE_HEADING": "Title",
"I18N_BLOG_POST_PAGE_RECOMMENDATION_SECTON_HEADING": "Suggested For You.",
"I18N_BLOG_POST_PAGE_TAGS_HEADING": "Tags",
"I18N_BLOG_POST_PAGE_TITLE": "<[blogPostTitle]> | Blog | Oppia",
"I18N_BLOG_POST_THUMBNAIL_PICTURE_DRAG": "Choose a file or drag it here",
"I18N_BLOG_POST_THUMBNAIL_PICTURE_ERROR": "Error: Could not read image file.",
"I18N_BLOG_POST_THUMBNAIL_PICTURE_UPLOAD": "Add a thumbnail",
Expand Down
16 changes: 0 additions & 16 deletions assets/i18n/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,6 @@
"I18N_BLOG_DASHBOARD_PAGE_NEW_POST_BUTTON": "Button on Oppia's Blog Dashboard Page. - When user clicks on the button a new blog post is created.",
"I18N_BLOG_DASHBOARD_TAB_DRAFTS": "Tab button on Oppia's Blog Dashboard Page. -When user clicks on the button, all the blog post cards for blog posts which are yet to be published are visible.",
"I18N_BLOG_DASHBOARD_TAB_PUBLISHED": "Tab button on Oppia's Blog Dashboard Page. -When user clicks on the button, all the blog post cards for blog posts published by the user are visible.",
"I18N_BLOG_HOME_PAGE_BREADCRUMB": "Text displayed in the Blog Homepage page. - Text shown in the top left corner of the nav bar.\n{{identical|Blog}}",
"I18N_BLOG_HOME_PAGE_NO_RESULTS_FOUND": "Text displayed in the blog home page - Text that says no results are found if blog posts related to search are not found",
"I18N_BLOG_HOME_PAGE_OPPIA_DESCRIPTION": "Text displayed in the blog home page - Subheading below Blog Homepage heading describing Oppia community.",
"I18N_BLOG_HOME_PAGE_POSTS_HEADING": "Text displayed in the blog home page - Heading above latests posts being shown on blog homepage.",
"I18N_BLOG_HOME_PAGE_POSTS_NUMBER_DISPLAY": "Text displayed in the blog home page - Text that displays the number of blog posts being displayed on the blog homepage out of total blog posts.",
"I18N_BLOG_HOME_PAGE_QUERY_SEARCH_HEADING": "Text displayed in the blog home page - Heading above search query field in blog homepage.",
"I18N_BLOG_HOME_PAGE_TAGS_SEARCH_HEADING": "Text displayed in the blog home page - Heading above tags filter field in blog homepage.",
"I18N_BLOG_HOME_PAGE_TAG_FILTER_HOLDER_TEXT": "Text displayed in the blog home page - Placeholder Text inside tags filter field in blog homepage.",
"I18N_BLOG_HOME_PAGE_TITLE": "Title displayed on the browser tab when on the blog home page.",
"I18N_BLOG_HOME_PAGE_WELCOME_HEADING": "Text displayed in the blog home page - Heading on Blog Homepage-Welcome to the Oppia Blog!",
"I18N_BLOG_HOME_SEARCH_PAGE_POSTS_HEADING": "Text displayed in the blog home page afer search- Heading above search results being shown on blog homepage search results page.",
"I18N_BLOG_HOME_SEARCH_PAGE_POSTS_NUMBER_DISPLAY": "Text displayed in the blog home page after search for blog posts is performed - Text that displays the number of blog posts being displayed on the search results page.",
"I18N_BLOG_HOME_SEARCH_PAGE_POSTS_NUMBER_OUT_OF_TOTAL_DISPLAY": "Text displayed in the blog home page after search for blog posts is performed - Text that displays the number of blog posts being displayed on the search results page out of the total search results.",
"I18N_BLOG_POST_EDITOR_ADD_THUMBNAIL_TEXT": "Text displayed in the blog post editor page. - Text of the button that allows the user to upload thumbnail image for the blog post.",
"I18N_BLOG_POST_EDITOR_BODY_HEADING": "Text displayed in the blog post editor page. -Heading Text before the input field to enter blog post content.",
"I18N_BLOG_POST_EDITOR_CANCEL_BUTTON_TEXT": "Button displayed in the blog post editor page. - Text of the cancel button of the dialog shown to upload a thumbnail image or in RTE.\n{{Identical|Cancel}}",
Expand All @@ -136,9 +123,6 @@
"I18N_BLOG_POST_EDITOR_TAGS_LIMIT_SPECIFICATION_SUFFIX": "Text displayed in the blog post editor page. - Text below Tags heading which highlights the number of tags that can still be added.",
"I18N_BLOG_POST_EDITOR_THUMBNAIL_HEADING": "Text displayed in the blog post editor page. - Text beside the thumbnail uploader in blog post editor on small screens.",
"I18N_BLOG_POST_EDITOR_TITLE_HEADING": "Text displayed in the blog post editor page. -Heading Text before the input field to enter blog post heading.",
"I18N_BLOG_POST_PAGE_RECOMMENDATION_SECTON_HEADING": "Text displayed in the blog post page. - Heading of the blog post recommendation section.",
"I18N_BLOG_POST_PAGE_TAGS_HEADING": "Text displayed in the blog post page. - Heading Text beside tags under which the blog post is categorized.",
"I18N_BLOG_POST_PAGE_TITLE": "Title displayed on the browser tab when on the blog post page.",
"I18N_BLOG_POST_THUMBNAIL_PICTURE_DRAG": "Text displayed in the blog post editor page. - Text of the dialog shown to upload a thumbnail when the user has uploaded an image that is too big and needs to be cropped.",
"I18N_BLOG_POST_THUMBNAIL_PICTURE_ERROR": "Text displayed in the blog post editor page. - Error text of the dialog shown to upload a thumbnail image. This error is shown when the file uploaded by the user is not an image.",
"I18N_BLOG_POST_THUMBNAIL_PICTURE_UPLOAD": "Text displayed in the blog post editor page. - Text of the dailog that opens when the user clicks to upload thumbnail image for the blog post.",
Expand Down
3 changes: 0 additions & 3 deletions assets/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
<url>
<loc>https://www.oppia.org/community-library</loc>
</url>
<url>
<loc>https://www.oppia.org/blog</loc>
</url>
<url>
<loc>https://www.oppia.org/contact</loc>
</url>
Expand Down
60 changes: 0 additions & 60 deletions core/controllers/access_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from core import feconf
from core.controllers import acl_decorators
from core.controllers import base
from core.domain import blog_services
from core.domain import classroom_services
from core.domain import user_services

Expand Down Expand Up @@ -144,62 +143,3 @@ class ReleaseCoordinatorAccessValidationHandler(base.BaseHandler):
def get(self) -> None:
"""Handles GET requests."""
pass


class BlogHomePageAccessValidationHandler(base.BaseHandler):
"""Validates access to blog home page."""

GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_JSON

# Type[str, Any] is used to match the type defined for this attribute in
# its parent class `base.BaseHandler`.
URL_PATH_ARGS_SCHEMAS: Dict[str, Any] = {}

# Type[str, Any] is used to match the type defined for this attribute in
# its parent class `base.BaseHandler`.
HANDLER_ARGS_SCHEMAS: Dict[str, Any] = {
'GET': {}
}

# Using type ignore[misc] here because untyped decorator makes function
# "get" also untyped.
@acl_decorators.can_access_blog_dashboard # type: ignore[misc]
def get(self) -> None:
"""Validates access to blog home page."""
pass


class BlogPostPageAccessValidationHandler(base.BaseHandler):
"""Validates whether request made to correct blog post route."""

GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_JSON

# Type[str, Any] is used to match the type defined for this attribute in
# its parent class `base.BaseHandler`.
URL_PATH_ARGS_SCHEMAS: Dict[str, Any] = {}
# Type[str, Any] is used to match the type defined for this attribute in
# its parent class `base.BaseHandler`.
HANDLER_ARGS_SCHEMAS: Dict[str, Any] = {
'GET': {
'blog_post_url_fragment': {
'schema': {
'type': 'basestring'
}
}
}
}

# Using type ignore[misc] here because untyped decorator makes function
# "get" also untyped.
@acl_decorators.can_access_blog_dashboard # type: ignore[misc]
def get(self) -> None:
# Please use type casting here instead of type ignore[union-attr] once
# this attribute `normalized_request` has been type annotated in the
# parent class BaseHandler.
blog_post_url_fragment = self.normalized_request.get( # type: ignore[union-attr]
'blog_post_url_fragment')
blog_post = blog_services.get_blog_post_by_url_fragment( # type: ignore[no-untyped-call]
blog_post_url_fragment)

if not blog_post:
raise self.PageNotFoundException
108 changes: 0 additions & 108 deletions core/controllers/access_validators_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,10 @@

from __future__ import annotations

import datetime

from core import feconf
from core.domain import config_services
from core.platform import models
from core.storage.blog import gae_models as blog_models
from core.tests import test_utils

(blog_models,) = models.Registry.import_models([models.Names.BLOG])

ACCESS_VALIDATION_HANDLER_PREFIX = feconf.ACCESS_VALIDATION_HANDLER_PREFIX


Expand Down Expand Up @@ -160,105 +154,3 @@ def test_normal_user_can_manage_account(self) -> None:
self.get_html_response( # type: ignore[no-untyped-call]
'%s/can_manage_own_account' % ACCESS_VALIDATION_HANDLER_PREFIX)
self.logout()


class BlogHomePageAccessValidationHandlerTests(test_utils.GenericTestBase):
"""Checks the access to the blog home page and its rendering."""

def test_blog_home_page_access_without_logging_in(self):
self.get_json(
'%s/can_access_blog_home_page' %
ACCESS_VALIDATION_HANDLER_PREFIX, expected_status_int=401)

def test_blog_home_page_access_without_having_rights(self):
self.signup(self.VIEWER_EMAIL, self.VIEWER_USERNAME)
self.login(self.VIEWER_EMAIL)
self.get_json(
'%s/can_access_blog_home_page' %
ACCESS_VALIDATION_HANDLER_PREFIX, expected_status_int=401)
self.logout()

def test_blog_home_page_access_as_blog_admin(self):
self.signup(self.BLOG_ADMIN_EMAIL, self.BLOG_ADMIN_USERNAME)
self.add_user_role(
self.BLOG_ADMIN_USERNAME, feconf.ROLE_ID_BLOG_ADMIN)
self.login(self.BLOG_ADMIN_EMAIL)
self.get_html_response(
'%s/can_access_blog_home_page' %
ACCESS_VALIDATION_HANDLER_PREFIX, expected_status_int=200)
self.logout()

def test_blog_home_page_access_as_blog_post_editor(self):
self.signup(self.BLOG_EDITOR_EMAIL, self.BLOG_EDITOR_USERNAME)
self.add_user_role(
self.BLOG_EDITOR_USERNAME, feconf.ROLE_ID_BLOG_POST_EDITOR)
self.login(self.BLOG_EDITOR_EMAIL)
self.get_html_response(
'%s/can_access_blog_home_page' %
ACCESS_VALIDATION_HANDLER_PREFIX, expected_status_int=200)
self.logout()


class BlogPostPageAccessValidationHandlerTests(test_utils.GenericTestBase):
"""Checks the access to the blog post page and its rendering."""

def setUp(self) -> None:
super().setUp()
blog_post_model = blog_models.BlogPostModel(
id='blog_one',
author_id='user_1',
content='content',
title='title',
published_on=datetime.datetime.utcnow(),
url_fragment='sample-url',
tags=['news'],
thumbnail_filename='thumbnail.svg',
)
blog_post_model.update_timestamps()
blog_post_model.put()

def test_blog_post_page_access_without_logging_in(self):
self.get_json(
'%s/can_access_blog_post_page?blog_post_url_fragment=sample-url' %
ACCESS_VALIDATION_HANDLER_PREFIX, expected_status_int=401)

def test_blog_post_page_access_without_having_rights(self):
self.signup(self.VIEWER_EMAIL, self.VIEWER_USERNAME)
self.login(self.VIEWER_EMAIL)
self.get_json(
'%s/can_access_blog_post_page?blog_post_url_fragment=sample-url' %
ACCESS_VALIDATION_HANDLER_PREFIX, expected_status_int=401)
self.logout()

def test_blog_post_page_access_as_blog_admin(self):
self.signup(self.BLOG_ADMIN_EMAIL, self.BLOG_ADMIN_USERNAME)
self.add_user_role(
self.BLOG_ADMIN_USERNAME, feconf.ROLE_ID_BLOG_ADMIN)
self.login(self.BLOG_ADMIN_EMAIL)
self.get_html_response(
'%s/can_access_blog_post_page?blog_post_url_fragment=sample-url' %
ACCESS_VALIDATION_HANDLER_PREFIX, expected_status_int=200)
self.logout()

def test_blog_post_page_access_as_blog_post_editor(self):
self.signup(self.BLOG_EDITOR_EMAIL, self.BLOG_EDITOR_USERNAME)
self.add_user_role(
self.BLOG_EDITOR_USERNAME, feconf.ROLE_ID_BLOG_POST_EDITOR)
self.login(self.BLOG_EDITOR_EMAIL)
self.get_html_response(
'%s/can_access_blog_post_page?blog_post_url_fragment=sample-url' %
ACCESS_VALIDATION_HANDLER_PREFIX, expected_status_int=200)
self.logout()

def test_validation_returns_false_if_blog_post_is_not_available(
self
) -> None:
self.signup(self.BLOG_EDITOR_EMAIL, self.BLOG_EDITOR_USERNAME)
self.add_user_role(
self.BLOG_EDITOR_USERNAME, feconf.ROLE_ID_BLOG_POST_EDITOR)
self.login(self.BLOG_EDITOR_EMAIL)

self.get_json( # type: ignore[no-untyped-call]
'%s/can_access_blog_post_page?blog_post_url_fragment=invalid-url' %
ACCESS_VALIDATION_HANDLER_PREFIX, expected_status_int=404)
self.logout()
Loading

0 comments on commit 4b85e4d

Please sign in to comment.