Commit 41f48ea8 authored by mgabdev's avatar mgabdev

Added checks for status visiblity if group is private

• Added:
- checks for status visiblity if group is private
parent e1fb44af
......@@ -57,6 +57,7 @@ class Api::V1::StatusesController < Api::BaseController
text: status_params[:status],
markdown: markdown,
autoJoinGroup: status_params[:autoJoinGroup],
isPrivateGroup: status_params[:isPrivateGroup],
thread: status_params[:in_reply_to_id].blank? ? nil : Status.find(status_params[:in_reply_to_id]),
media_ids: status_params[:media_ids],
sensitive: status_params[:sensitive],
......@@ -113,6 +114,7 @@ class Api::V1::StatusesController < Api::BaseController
:status,
:markdown,
:autoJoinGroup,
:isPrivateGroup,
:in_reply_to_id,
:quote_of_id,
:sensitive,
......
......@@ -277,6 +277,7 @@ export function submitCompose(groupId, replyToId = null, router, isStandalone, a
let status = getState().getIn(['compose', 'text'], '');
let markdown = getState().getIn(['compose', 'markdown'], '');
const media = getState().getIn(['compose', 'media_attachments']);
const isPrivateGroup = !!groupId ? getState().getIn(['groups', groupId, 'is_private'], false) : false
const replacer = (match) => {
const hasProtocol = match.startsWith('https://') || match.startsWith('http://')
......@@ -334,6 +335,7 @@ export function submitCompose(groupId, replyToId = null, router, isStandalone, a
expires_at,
scheduled_at,
autoJoinGroup,
isPrivateGroup,
in_reply_to_id: inReplyToId,
quote_of_id: getState().getIn(['compose', 'quote_of_id'], null),
media_ids: media.map(item => item.get('id')),
......
......@@ -30,6 +30,7 @@ class PostStatusService < BaseService
@markdown = @options[:markdown] if @account.is_pro
@in_reply_to = @options[:thread]
@autoJoinGroup = @options[:autoJoinGroup] || false
@isPrivateGroup = @options[:isPrivateGroup] || false
return idempotency_duplicate if idempotency_given? && idempotency_duplicate?
......@@ -56,6 +57,7 @@ class PostStatusService < BaseService
@text = @options.delete(:spoiler_text) if @text.blank? && @options[:spoiler_text].present?
@visibility = @options[:visibility] || @account.user&.setting_default_privacy
@visibility = :unlisted if @visibility == :public && @account.silenced?
@visibility = :private_group if @isPrivateGroup
@expires_at = @options[:expires_at]&.to_datetime if @account.is_pro
@scheduled_at = @options[:scheduled_at]&.to_datetime
@scheduled_at = nil if scheduled_in_the_past?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment