Skip to content

Commit

Permalink
[B] Hide public RG option for unverified users
Browse files Browse the repository at this point in the history
  • Loading branch information
zdavis committed Feb 24, 2024
1 parent 3186287 commit 941a14b
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions client/src/frontend/components/reading-group/forms/Group/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { readingGroupsAPI, requests } from "api";
import config from "config";
import memoize from "lodash/memoize";
import withConfirmation from "hoc/withConfirmation";
import withCurrentUser from "hoc/withCurrentUser";
import { ClassNames } from "@emotion/react";
import { connect } from "react-redux";
import { select } from "utils/entityUtils";
Expand Down Expand Up @@ -119,15 +120,20 @@ class ReadingGroupForm extends React.PureComponent {
};

get privacyOptions() {
const { t, allowPublic } = this.props;
const publicOption = allowPublic
? [
{
label: t("forms.reading_group.privacy_options.public"),
value: "public"
}
]
: [];
const { t, allowPublic, currentUser } = this.props;

const established = currentUser?.attributes.established;
const trusted = currentUser?.attributes.trusted;

const publicOption =
allowPublic && (established || trusted)
? [
{
label: t("forms.reading_group.privacy_options.public"),
value: "public"
}
]
: [];

return [
...publicOption,
Expand Down Expand Up @@ -267,6 +273,10 @@ class ReadingGroupForm extends React.PureComponent {
}
}

export default withConfirmation(
withTranslation()(connect(ReadingGroupForm.mapStateToProps)(ReadingGroupForm))
export default withCurrentUser(
withConfirmation(
withTranslation()(
connect(ReadingGroupForm.mapStateToProps)(ReadingGroupForm)
)
)
);

0 comments on commit 941a14b

Please sign in to comment.