Skip to content
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
1 change: 1 addition & 0 deletions backend/src/Data/Transformers/CommentTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function __invoke( \WP_Comment $comment ) {
'author' => $comment->comment_author,
'authorEmail' => $comment->comment_author_email,
'authorIP' => $comment->comment_author_IP,
'authorUrl' => get_author_posts_url( $comment->user_id ),
'content' => $comment->comment_content,
'date' => $date,
'editUrl' => admin_url( 'comment.php?action=editcomment&c=' ) . $comment->comment_ID,
Expand Down
11 changes: 11 additions & 0 deletions backend/src/Hooks/Actions/OnEnqueueScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ public function generate_frontend_config() {

$current_user = $this->users->current( $this->user_transform );

$wp_comments = get_option( 'default_comment_status' );
if ( isset( $wp_comments ) ) {
if ( $wp_comments === 'closed' ) {
$wp_comment_status = 0;
} else {
$wp_comment_status = 1;
}
}


return [
'adminURLs' => $this->site->get_admin_urls(),
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
Expand All @@ -124,6 +134,7 @@ public function generate_frontend_config() {
'pluginURL' => FL_ASSISTANT_URL,
'taxonomies' => $this->posts->get_taxononies(),
'userRoles' => $this->users->get_roles(),
'wpCommentStatus' => $wp_comment_status,

/*
'integrations' => [
Expand Down
5 changes: 4 additions & 1 deletion src/apps/fl-comments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ import { registerApp } from 'assistant'
import { __ } from '@wordpress/i18n'
import { addQueryArgs } from 'assistant/utils/url'
import { currentUserCan } from 'assistant/utils/wordpress'
import { getSystemConfig } from 'data'
import { Page } from 'assistant/ui'
import { CommentsApp } from './app'
import Icon from './icon'

const { wpCommentStatus } = getSystemConfig()

registerApp( 'fl-comments', {
label: __( 'Comments' ),
root: CommentsApp,
icon: Icon,
enabled: currentUserCan( 'moderate_comments' ),
enabled: currentUserCan( 'moderate_comments' ) && 1 == wpCommentStatus ,
accent: {
color: '#FFCC00'
},
Expand Down
2 changes: 1 addition & 1 deletion src/render/app/side-bar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useMedia } from 'assistant/utils/react'
import './style.scss'

const Sidebar = ( { edge = 'right' } ) => {
const { window, isAppHidden } = useSystemState()
const { window, isAppHidden } = useSystemState()
const { isMobile, isCompactHeight, application } = Env.useEnvironment()
const {
toggleIsShowingUI,
Expand Down
5 changes: 5 additions & 0 deletions src/system/ui/pages/comment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const Comment = ( { location } ) => {
postId,
url,
editUrl,
authorUrl,
} = item
const { pluginURL } = getSystemConfig()
const hero = `${pluginURL}img/comment-hero-a.jpg`
Expand Down Expand Up @@ -248,6 +249,10 @@ export const Comment = ( { location } ) => {
type: 'text',
component: 'plain-text'
},
authorUrl: {
label: __( 'Author Url' ),
component: 'url'
},
date: {
label: __( 'Submitted On' ),
labelPlacement: 'beside',
Expand Down