Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always enable bookmarks #4011

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions aleph/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions aleph/views/base_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand Down
31 changes: 13 additions & 18 deletions ui/src/components/Navbar/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
selectSession,
selectPages,
selectEntitiesResult,
selectExperimentalBookmarksFeatureEnabled,
} from 'selectors';
import SearchAlert from 'components/SearchAlert/SearchAlert';
import { DialogToggleButton } from 'components/Toolbar';
Expand Down Expand Up @@ -96,7 +95,6 @@ export class Navbar extends React.Component {
query,
result,
isHomepage,
bookmarksEnabled,
intl,
} = this.props;
const { advancedSearchOpen, mobileSearchOpen } = this.state;
Expand Down Expand Up @@ -211,21 +209,19 @@ export class Navbar extends React.Component {
/>
</LinkButton>
)}
{bookmarksEnabled && (
<DialogToggleButton
buttonProps={{
text: (
<FormattedMessage
id="nav.bookmarks"
defaultMessage="Bookmarks"
/>
),
icon: 'star',
minimal: true,
}}
Dialog={BookmarksDrawer}
/>
)}
<DialogToggleButton
buttonProps={{
text: (
<FormattedMessage
id="nav.bookmarks"
defaultMessage="Bookmarks"
/>
),
icon: 'star',
minimal: true,
}}
Dialog={BookmarksDrawer}
/>
{menuPages.map((page) => (
<LinkButton
key={page.name}
Expand Down Expand Up @@ -278,7 +274,6 @@ const mapStateToProps = (state, ownProps) => {
metadata: selectMetadata(state),
session: selectSession(state),
pages: selectPages(state),
bookmarksEnabled: selectExperimentalBookmarksFeatureEnabled(state),
};
};

Expand Down
8 changes: 1 addition & 7 deletions ui/src/components/common/BookmarkButton.tsx
Original file line number Diff line number Diff line change
@@ -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 & {
Expand All @@ -13,13 +12,8 @@ type BookmarkButtonProps = ButtonProps & {

const BookmarkButton: FC<BookmarkButtonProps> = ({ 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 ? (
<FormattedMessage id="bookmarks.bookmarked" defaultMessage="Bookmarked" />
Expand Down
11 changes: 0 additions & 11 deletions ui/src/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down