From 129a97c1ee4fcc0d246c94e8762ea5d95ce91651 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Wed, 13 Jan 2021 22:28:09 -0500 Subject: [PATCH] Updated Status comments/context to be visible to logged in users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updated: - Status comments/context to be visible to logged in users --- app/controllers/api/v1/statuses_controller.rb | 2 +- app/javascript/gabsocial/actions/statuses.js | 4 ++-- app/javascript/gabsocial/components/status.js | 11 ++++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 0a3a7a20..4f7c25c0 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -5,7 +5,7 @@ class Api::V1::StatusesController < Api::BaseController before_action -> { authorize_if_got_token! :read, :'read:statuses' }, except: [:create, :update, :destroy] before_action -> { doorkeeper_authorize! :write, :'write:statuses' }, only: [:create, :update, :destroy] - before_action :require_user!, except: [:show, :comments, :context, :card] + before_action :require_user!, except: [:show] before_action :set_status, only: [:show, :comments, :context, :card, :update, :revisions] # This API was originally unlimited, pagination cannot be introduced without diff --git a/app/javascript/gabsocial/actions/statuses.js b/app/javascript/gabsocial/actions/statuses.js index 0a2f3a2c..03cdf83a 100644 --- a/app/javascript/gabsocial/actions/statuses.js +++ b/app/javascript/gabsocial/actions/statuses.js @@ -181,7 +181,7 @@ const deleteStatusFail = (id, error) => ({ * */ export const fetchContext = (id, ensureIsReply) => (dispatch, getState) => { - if (!id) return + if (!id || !me) return if (ensureIsReply) { const isReply = !!getState().getIn(['statuses', id, 'in_reply_to_id'], null) @@ -228,7 +228,7 @@ const fetchContextFail = (id, error) => ({ * */ export const fetchComments = (id) => (dispatch, getState) => { - if (!id) return + if (!id || !me) return debouncedFetchComments(id, dispatch, getState) } diff --git a/app/javascript/gabsocial/components/status.js b/app/javascript/gabsocial/components/status.js index 4395e098..29506161 100644 --- a/app/javascript/gabsocial/components/status.js +++ b/app/javascript/gabsocial/components/status.js @@ -517,7 +517,16 @@ class Status extends ImmutablePureComponent { } { - status.get('replies_count') > 0 && !isChild && !isNotification && !commentsLimited && + !me && status.get('replies_count') > 0 && !isChild && !isNotification && !commentsLimited && +