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

View file

@ -197,10 +197,6 @@ export function submitCompose(routerHistory) {
return;
}
if (getState().getIn(['compose', 'advanced_options', 'do_not_federate'])) {
status = status + ' 👁️';
}
dispatch(submitComposeRequest());
// 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']),
poll: getState().getIn(['compose', 'poll'], null),
language: getState().getIn(['compose', 'language']),
local_only: getState().getIn(['compose', 'advanced_options', 'do_not_federate']),
},
headers: {
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),

View file

@ -206,7 +206,7 @@ function continueThread (state, status) {
map.set('in_reply_to', status.id);
map.update(
'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('sensitive', false);

View file

@ -587,8 +587,10 @@ class Status < ApplicationRecord
def set_locality
if account.domain.nil? && !attribute_changed?(:local_only)
self.local_only = marked_local_only?
self.local_only = true if marked_local_only?
end
self.local_only = true if thread&.local_only? && self.local_only.nil?
self.local_only = reblog.local_only if reblog?
end
def set_conversation

View file

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