Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Checking if commercial features are enabled

Matt Roberts21542f9f5300
diff --git a/public/pages/Administration/pages/PrivacySettings.page.tsx b/public/pages/Administration/pages/PrivacySettings.page.tsx
index 0e21fcae8..b5d99cf25 100644
--- a/public/pages/Administration/pages/PrivacySettings.page.tsx
+++ b/public/pages/Administration/pages/PrivacySettings.page.tsx
@@ -70,13 +70,16 @@ export default class PrivacySettingsPage extends AdminBasePage<any, PrivacySetti
format. Links to feeds and autodiscovery metadata are shown on the site.
</p>
</Field>
- <Field label="Content Moderation">
- <Toggle disabled={!Fider.session.user.isAdministrator} active={this.state.isModerationEnabled} onToggle={this.moderationToggle} />
- <p className="text-muted mt-1">
- When enabled, new posts and comments will require approval from an administrator before being visible to other users. <br />
- Content creators can see their own unmoderated content, but it will be hidden from other users until approved.
- </p>
- </Field>
+ {/* Moderation requires commercial plan */}
+ {Fider.session.isCommercialEnabled && (
+ <Field label="Content Moderation">
+ <Toggle disabled={!Fider.session.user.isAdministrator} active={this.state.isModerationEnabled} onToggle={this.moderationToggle} />
+ <p className="text-muted mt-1">
+ When enabled, new posts and comments will require approval from an administrator before being visible to other users. <br />
+ Content creators can see their own unmoderated content, but it will be hidden from other users until approved.
+ </p>
+ </Field>
+ )}
</Form>
)
}
diff --git a/public/pages/Home/components/ShareFeedback.tsx b/public/pages/Home/components/ShareFeedback.tsx
index 4679e3151..9b905f5f0 100644
--- a/public/pages/Home/components/ShareFeedback.tsx
+++ b/public/pages/Home/components/ShareFeedback.tsx
@@ -203,6 +203,8 @@ export const ShareFeedback: React.FC<ShareFeedbackProps> = (props) => {
// We don't need to do anything special here
}
+ console.log("The session is", fider.session)
+
return (
<Modal.Window className="c-share-feedback" isOpen={isOpen} onClose={handleClose} size="fullscreen" center={false}>
<Modal.Header>
diff --git a/public/pages/ShowPost/ShowPost.page.tsx b/public/pages/ShowPost/ShowPost.page.tsx
index 7354efd40..56260bf9a 100644
--- a/public/pages/ShowPost/ShowPost.page.tsx
+++ b/public/pages/ShowPost/ShowPost.page.tsx
@@ -252,7 +252,7 @@ export default function ShowPostPage(props: ShowPostPageProps) {
<h1 className="text-large text-break">{props.post.title}</h1>
{/* Moderation status banner for unapproved posts */}
- {fider.session.tenant.isModerationEnabled && !props.post.isApproved && (
+ {fider.session.isModerationRequired && !props.post.isApproved && (
<div className="mt-4">
{fider.session.isAuthenticated && fider.session.user.id === props.post.user.id && (
<div className="text-muted text-sm p-3 bg-yellow-50 rounded border-l-4 border-yellow-500">
diff --git a/public/pages/ShowPost/components/CommentInput.tsx b/public/pages/ShowPost/components/CommentInput.tsx
index 578df79ed..988923ac6 100644
--- a/public/pages/ShowPost/components/CommentInput.tsx
+++ b/public/pages/ShowPost/components/CommentInput.tsx
@@ -104,7 +104,7 @@ export const CommentInput = (props: CommentInputProps) => {
onImageUploaded={handleImageUploaded}
/>
- {fider.session.tenant.isModerationEnabled && Fider.session.isAuthenticated && !Fider.session.user.isCollaborator && (
+ {fider.session.isModerationRequired && Fider.session.isAuthenticated && !Fider.session.user.isCollaborator && (
<div className="mt-2 text-muted text-sm p-2 bg-gray-50 rounded border-l-4 border-yellow-500">
<Trans id="comment.moderation.notice">Your comment will be reviewed by an administrator before being visible to other users.</Trans>
</div>
diff --git a/public/pages/ShowPost/components/ShowComment.tsx b/public/pages/ShowPost/components/ShowComment.tsx
index 0acfa8211..8f50b0d95 100644
--- a/public/pages/ShowPost/components/ShowComment.tsx
+++ b/public/pages/ShowPost/components/ShowComment.tsx
@@ -245,9 +245,9 @@ export const ShowComment = (props: ShowCommentProps) => {
) : (
<>
<Markdown text={comment.content} style="full" />
-
+
{/* Moderation status banner for unapproved comments */}
- {fider.session.tenant.isModerationEnabled && !comment.isApproved && (
+ {fider.session.isModerationRequired && !comment.isApproved && (
<div className="mt-3">
{fider.session.isAuthenticated && fider.session.user.id === comment.user.id && (
<div className="text-muted text-xs p-2 bg-yellow-50 rounded border-l-4 border-yellow-500">
@@ -256,7 +256,7 @@ export const ShowComment = (props: ShowCommentProps) => {
</Trans>
</div>
)}
-
+
{/* Admin moderation buttons */}
{fider.session.isAuthenticated && fider.session.user.isCollaborator && (
<div className="p-2 bg-blue-50 rounded border-l-4 border-blue-500">
@@ -264,9 +264,7 @@ export const ShowComment = (props: ShowCommentProps) => {
<Trans id="showpost.moderation.comment.admin.title">Comment Moderation</Trans>
</div>
<div className="text-xs text-blue-700 mb-2">
- <Trans id="showpost.moderation.comment.admin.description">
- This comment is awaiting your approval to be visible to all users.
- </Trans>
+ <Trans id="showpost.moderation.comment.admin.description">This comment is awaiting your approval to be visible to all users.</Trans>
</div>
<HStack spacing={1}>
<Button variant="primary" size="small" onClick={handleApproveComment}>
@@ -280,7 +278,7 @@ export const ShowComment = (props: ShowCommentProps) => {
)}
</div>
)}
-
+
<Reactions reactions={localReactionCounts} emojiSelectorRef={emojiSelectorRef} toggleReaction={toggleReaction} />
</>
)}
diff --git a/public/services/fider.ts b/public/services/fider.ts
index cbbcdfe60..c1c8ac886 100644
--- a/public/services/fider.ts
+++ b/public/services/fider.ts
@@ -7,6 +7,7 @@ export class FiderSession {
private pTenant: Tenant
private pUser: CurrentUser | undefined
private pProps: { [key: string]: any } = {}
+ private pSettings: SystemSettings
constructor(data: any) {
this.pPage = data.page
@@ -14,6 +15,7 @@ export class FiderSession {
this.pProps = data.props
this.pUser = data.user
this.pTenant = data.tenant
+ this.pSettings = data.settings
}
public get page(): string {
@@ -42,7 +44,11 @@ export class FiderSession {
}
public get isModerationRequired(): boolean {
- return this.pTenant.isModerationEnabled && this.isAuthenticated && this.pUser!.role === "visitor" && !this.pUser!.isVerified
+ return this.isCommercialEnabled && this.pTenant.isModerationEnabled && this.isAuthenticated && this.pUser!.role === "visitor" && !this.pUser!.isVerified
+ }
+
+ public get isCommercialEnabled(): boolean {
+ return this.pSettings.isCommercialEnabled
}
}