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

This commit is contained in:
Skye 2023-02-04 19:21:59 +09:00
commit efb7f0b66a
Signed by: me
GPG key ID: 0104BC05F41B77B8
5 changed files with 8 additions and 6 deletions

View file

@ -65,6 +65,7 @@ class Api::V1::StatusesController < Api::BaseController
poll: status_params[:poll], poll: status_params[:poll],
content_type: status_params[:content_type], content_type: status_params[:content_type],
idempotency: request.headers['Idempotency-Key'], idempotency: request.headers['Idempotency-Key'],
local_only: status_params[:local_only],
with_rate_limit: true, with_rate_limit: true,
quote_id: status_params[:quote_id].presence quote_id: status_params[:quote_id].presence
) )
@ -133,6 +134,7 @@ class Api::V1::StatusesController < Api::BaseController
:scheduled_at, :scheduled_at,
:quote_id, :quote_id,
:content_type, :content_type,
:local_only,
media_ids: [], media_ids: [],
media_attributes: [ media_attributes: [
:id, :id,

View file

@ -197,10 +197,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
@ -230,6 +226,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

@ -206,7 +206,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

@ -587,8 +587,10 @@ class Status < ApplicationRecord
def set_locality def set_locality
if account.domain.nil? && !attribute_changed?(:local_only) if account.domain.nil? && !attribute_changed?(:local_only)
self.local_only = marked_local_only? self.local_only = true if marked_local_only?
end end
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

@ -183,6 +183,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