Merge remote-tracking branch 'claire/glitch-soc/features/redesign-localonly-toots' into th-downstream

This commit is contained in:
Skye 2024-02-03 14:28:39 +09:00
commit 415c5eb2d4
Signed by: me
GPG key ID: 0104BC05F41B77B8
5 changed files with 9 additions and 7 deletions

View file

@ -70,7 +70,8 @@ class Api::V1::StatusesController < Api::BaseController
allowed_mentions: status_params[:allowed_mentions], allowed_mentions: status_params[:allowed_mentions],
idempotency: request.headers['Idempotency-Key'], idempotency: request.headers['Idempotency-Key'],
with_rate_limit: true, with_rate_limit: true,
quote_id: status_params[:quote_id].presence quote_id: status_params[:quote_id].presence,
local_only: status_params[:local_only])
) )
render json: @status, serializer: @status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer render json: @status, serializer: @status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer
@ -144,6 +145,7 @@ class Api::V1::StatusesController < Api::BaseController
:quote_id, :quote_id,
:content_type, :content_type,
allowed_mentions: [], allowed_mentions: [],
:local_only,
media_ids: [], media_ids: [],
media_attributes: [ media_attributes: [
:id, :id,

View file

@ -213,10 +213,6 @@ export function submitCompose(routerHistory) {
return; return;
} }
if (getState().getIn(['compose', 'advanced_options', 'do_not_federate'])) {
status = status + ' 👁️';
}
dispatch(submitComposeRequest()); dispatch(submitComposeRequest());
// If we're editing a post with media attachments, those have not // If we're editing a post with media attachments, those have not
@ -254,6 +250,7 @@ export function submitCompose(routerHistory) {
visibility: getState().getIn(['compose', 'privacy']), visibility: getState().getIn(['compose', 'privacy']),
poll: getState().getIn(['compose', 'poll'], null), poll: getState().getIn(['compose', 'poll'], null),
language: getState().getIn(['compose', 'language']), language: getState().getIn(['compose', 'language']),
local_only: getState().getIn(['compose', 'advanced_options', 'do_not_federate']),
}, },
headers: { headers: {
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']), 'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),

View file

@ -208,7 +208,7 @@ function continueThread (state, status) {
map.set('in_reply_to', status.id); map.set('in_reply_to', status.id);
map.update( map.update(
'advanced_options', 'advanced_options',
map => map.merge(new ImmutableMap({ do_not_federate: status.local_only })), map => map.merge(new ImmutableMap({ do_not_federate: !!status.local_only }))
); );
map.set('privacy', status.visibility); map.set('privacy', status.visibility);
map.set('sensitive', false); map.set('sensitive', false);

View file

@ -564,7 +564,9 @@ class Status < ApplicationRecord
def set_local_only def set_local_only
return unless account.domain.nil? && !attribute_changed?(:local_only) return unless account.domain.nil? && !attribute_changed?(:local_only)
self.local_only = marked_local_only? self.local_only = true if marked_local_only?
self.local_only = true if thread&.local_only? && self.local_only.nil?
self.local_only = reblog.local_only if reblog?
end end
def set_conversation def set_conversation

View file

@ -212,6 +212,7 @@ class PostStatusService < BaseService
content_type: @options[:content_type] || @account.user&.setting_default_content_type, content_type: @options[:content_type] || @account.user&.setting_default_content_type,
rate_limit: @options[:with_rate_limit], rate_limit: @options[:with_rate_limit],
quote_id: @options[:quote_id], quote_id: @options[:quote_id],
local_only: @options[:local_only],
}.compact }.compact
end end