From 047d8fd606de93ee9aa081b6fdf82d7cb2d61c62 Mon Sep 17 00:00:00 2001 From: Martin Tournoij Date: Mon, 25 Nov 2024 15:25:44 +0000 Subject: [PATCH] Always enable bookmarks It's been an "experimental feature" since 2021. And it seems simple enough? So just always enable it. --- aleph/settings.py | 6 ---- aleph/views/base_api.py | 3 -- .../configuration-options/options.yml | 5 --- ui/src/components/Navbar/Navbar.jsx | 31 ++++++++----------- ui/src/components/common/BookmarkButton.tsx | 8 +---- ui/src/selectors.js | 11 ------- 6 files changed, 14 insertions(+), 50 deletions(-) diff --git a/aleph/settings.py b/aleph/settings.py index ac54403bee..062d16afa0 100644 --- a/aleph/settings.py +++ b/aleph/settings.py @@ -300,12 +300,6 @@ def __init__(self) -> None: # XREF Model Selection self.XREF_MODEL = env.get("FTM_COMPARE_MODEL", None) - ############################################################################### - # Feature flags - self.ENABLE_EXPERIMENTAL_BOOKMARKS_FEATURE = env.get( - "ALEPH_ENABLE_EXPERIMENTAL_BOOKMARKS_FEATURE", False - ) - ############################################################################### # Feedback self.FEEDBACK_URL_DOCUMENTS = env.get("ALEPH_FEEDBACK_URL_DOCUMENTS", None) diff --git a/aleph/views/base_api.py b/aleph/views/base_api.py index f15b039cc2..146e3cdab0 100644 --- a/aleph/views/base_api.py +++ b/aleph/views/base_api.py @@ -80,9 +80,6 @@ def _metadata_locale(locale): "model": model.to_dict(), "token": None, "auth": auth, - "feature_flags": { - "bookmarks": as_bool(SETTINGS.ENABLE_EXPERIMENTAL_BOOKMARKS_FEATURE), - }, "feedback_urls": { "documents": SETTINGS.FEEDBACK_URL_DOCUMENTS, "timelines": SETTINGS.FEEDBACK_URL_TIMELINES, diff --git a/docs/src/pages/developers/reference/configuration-options/options.yml b/docs/src/pages/developers/reference/configuration-options/options.yml index f2fe16610a..799b080fba 100644 --- a/docs/src/pages/developers/reference/configuration-options/options.yml +++ b/docs/src/pages/developers/reference/configuration-options/options.yml @@ -243,11 +243,6 @@ email: - name: 'ALEPH_MAIL_DEBUG' defaultValue: 'false' -featureFlags: - - name: ALEPH_ENABLE_EXPERIMENTAL_BOOKMARKS_FEATURE - description: Enable experimental bookmarks feature. Bookmarks are stored client-side and users may accidentally delete them when clearing browser data. - defaultValue: 'false' - monitoring: - name: 'SENTRY_DSN' description: 'Sentry DSN. Refer to the [Sentry documentation](https://docs.sentry.io/platforms/python/configuration/options/#common-options) for details.' diff --git a/ui/src/components/Navbar/Navbar.jsx b/ui/src/components/Navbar/Navbar.jsx index e35ec17a6f..36fb5b9e5c 100644 --- a/ui/src/components/Navbar/Navbar.jsx +++ b/ui/src/components/Navbar/Navbar.jsx @@ -20,7 +20,6 @@ import { selectSession, selectPages, selectEntitiesResult, - selectExperimentalBookmarksFeatureEnabled, } from 'selectors'; import SearchAlert from 'components/SearchAlert/SearchAlert'; import { DialogToggleButton } from 'components/Toolbar'; @@ -96,7 +95,6 @@ export class Navbar extends React.Component { query, result, isHomepage, - bookmarksEnabled, intl, } = this.props; const { advancedSearchOpen, mobileSearchOpen } = this.state; @@ -211,21 +209,19 @@ export class Navbar extends React.Component { /> )} - {bookmarksEnabled && ( - - ), - icon: 'star', - minimal: true, - }} - Dialog={BookmarksDrawer} - /> - )} + + ), + icon: 'star', + minimal: true, + }} + Dialog={BookmarksDrawer} + /> {menuPages.map((page) => ( { metadata: selectMetadata(state), session: selectSession(state), pages: selectPages(state), - bookmarksEnabled: selectExperimentalBookmarksFeatureEnabled(state), }; }; diff --git a/ui/src/components/common/BookmarkButton.tsx b/ui/src/components/common/BookmarkButton.tsx index 734f0cba15..e57116c18e 100644 --- a/ui/src/components/common/BookmarkButton.tsx +++ b/ui/src/components/common/BookmarkButton.tsx @@ -1,10 +1,9 @@ import { FC } from 'react'; -import { useSelector, useDispatch } from 'react-redux'; +import { useDispatch } from 'react-redux'; import { FormattedMessage } from 'react-intl'; import { Button, ButtonProps } from '@blueprintjs/core'; import { Entity } from '@alephdata/followthemoney'; -import { selectExperimentalBookmarksFeatureEnabled } from 'selectors'; import { createBookmark, deleteBookmark } from 'actions/bookmarkActions'; type BookmarkButtonProps = ButtonProps & { @@ -13,13 +12,8 @@ type BookmarkButtonProps = ButtonProps & { const BookmarkButton: FC = ({ entity, ...props }) => { const dispatch = useDispatch(); - const enabled = useSelector(selectExperimentalBookmarksFeatureEnabled); const { bookmarked } = entity; - if (!enabled) { - return null; - } - const icon = bookmarked ? 'star' : 'star-empty'; const label = bookmarked ? ( diff --git a/ui/src/selectors.js b/ui/src/selectors.js index a4afd4cab1..850cd4e701 100644 --- a/ui/src/selectors.js +++ b/ui/src/selectors.js @@ -82,17 +82,6 @@ export function selectMetadata(state) { return metadata; } -export function selectFeatureFlags(state) { - return selectMetadata(state).feature_flags; -} - -export function selectExperimentalBookmarksFeatureEnabled(state) { - const loggedIn = !!selectSession(state).loggedIn; - const featureFlag = !!selectFeatureFlags(state).bookmarks; - - return loggedIn && featureFlag; -} - export function selectFeedbackUrls(state) { return selectMetadata(state)?.feedback_urls; }