Skip to content

Commit 35e5c4f

Browse files
author
Joyce Mayorga
authored
Add local only posts (#8)
* Use backend from glitch-soc for instance-only toots * Base frontend on privacy dropdown * Add local_only indicator in the status action bar * Add local_only indicator to detailed status * Add backend support for local_only on status create Based off ThibG implementation on glitch #502 * Normalize translations ran yarn build:development && i18n-tasks normalize && yarn manage:translations && i18n-tasks remove-unused * Add local_only to admin screens * Hide local statuses from user atom and from unlogged users * Add local only icon to status page * Fix issue with toggle in mobile * Add default federation option to settings * Fix wrong configuration fetched * Change setting wording * Check for empty "last_status" before sorting DM column (mastodon#9207) * Check for empty "last_status" before sorting * Small touchups for codeclimate * Update resolve_url_service.rb (mastodon#9188) * Increase default column width from 330px to 350px (mastodon#9227) * Optimize the process of following someone (mastodon#9220) * Eliminate extra accounts select query from FollowService * Optimistically update follow state in web UI and hide loading bar Fix mastodon#6205 * Asynchronize NotifyService in FollowService And fix failing test * Skip Webfinger resolve routine when called from FollowService if possible If an account is ActivityPub, then webfinger re-resolving is not necessary when called from FollowService. Improve options of ResolveAccountService * Fix follow limit validator reporting lower number past threshold (mastodon#9230) * Fix follow limit validator reporting lower number past threshold * Avoid floating point follow limit * Fix form validation flash message color and input borders (mastodon#9235) * Fix form validation flash message color and input borders * Fix typo * Display amount of freed disk space in tootctl media remove (mastodon#9229) * Display amount of freed disk space in tootctl media remove Fix mastodon#9213 * Fix code style issue * Add "Show thread" link to self-replies (mastodon#9228) Fix mastodon#4716 * Fix nil error regression from mastodon#9229 in tootctl media remove (mastodon#9239) Fix mastodon#9237 * Improve ActiveRecord connection in on_worker_boot (mastodon#9238) This is how it looks in the example in the Puma README * Check that twitter:player is valid before using it (mastodon#9254) Fixes mastodon#9251 * Fix emoji update date processing (mastodon#9255) * Perform deep comparison for card data when receiving new props (mastodon#9270) Fixes mastodon#9226 * Fix null error introduced in mastodon#9270 (mastodon#9275) * Fix race condition causing shallow status with only a "favourited" attribute (mastodon#9272) Fixes mastodon#9231 * Fix "tootctl media remove" can't count the file size (mastodon#9288) * Fixed an issue where "tootctl media remove" can not count the file size. * Fixed the problem pointed out by codeclimate. * Remove intermediary arrays when creating hash maps from results (mastodon#9291) * Prevent multiple handlers for Delete of Actor from running (mastodon#9292) * Fix filter ID not being a string in REST API (mastodon#9303) * Update Nginx config for Nanobox apps (mastodon#9310) The Nanobox files have gotten out of sync, a touch, with what Masto needs for Nginx settings. This PR updates them accordingly. * WebSub: ATOM before RSS (mastodon#9302) Hello, The ATOM feed contains the hub declaration for WebSub, but the RSS version does not. RSS/ATOM readers will typically pick whichever version comes first, and will thus not see the WebSub feature. I therefore suggest putting the ATOM version first, as it is more feature-rich than its RSS counterpart is. Clients not compatible with ATOM would not pick it anyway due to the different type attribute. A more complicated alternative would be to declare the WebSub feature in the RSS version as well, using something like the following code, and ensuring that clients subscribed to the RSS version would receive PuSH updates just like those subscribed to the ATOM version. ````xml <rss version="2.0" xmlns:webfeeds="http://webfeeds.org/rss/1.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <atom:link rel="self" type="application/rss+xml" href="https://diaspodon.fr/users/test.rss"/> <atom:link rel="hub" href="https://diaspodon.fr/api/push"/> </channel> </rss> ``` * Touch account on successful response, change char shown when culled (mastodon#9293) Just the color is not enough change since not everyone uses colored terminals. Touching the account makes it so that the account is not in the threshold window in case of running again * Ignore JSON-LD profile in mime type comparison (mastodon#9179) Ignore JSON-LD profile in mime type comparison * Fix connect timeout not being enforced (mastodon#9329) * Fix connect timeout not being enforced The loop was catching the timeout exception that should stop execution, so the next IP would no longer be within a timed block, which led to requests taking much longer than 10 seconds. * Use timeout on each IP attempt, but limit to 2 attempts * Fix code style issue * Do not break Request#perform if no block given * Update method stub in spec for Request * Move timeout inside the begin/rescue block * Use Resolv::DNS with timeout of 1 to get IP addresses * Update Request spec to stub Resolv::DNS instead of Addrinfo * Fix Resolve::DNS stubs in Request spec * Bump version to 2.6.2 * add loglevel to ffmpeg in gif upload (mastodon#9368) * Allow hyphens in the middle of remote user names (mastodon#9345) Fixes mastodon#9309 This only allows hyphens in the middle of a username, much like dots, although I don't have a compelling reason to do so other than keeping the changes minimal. * Fix nil error when no DNS addresses are found for host (mastodon#9379) * Don't count suspended users in user count (mastodon#9380) Fix mastodon#7637 * Skip deliveries to inboxes that have already been marked as unavailable (mastodon#9358) * Fix TLS handshake timeout not being enforced (mastodon#9381) Follow-up to mastodon#9329 * Bump version to 2.6.3 * Remove npm-run-all dependency (mastodon#9401) Fix mastodon#9359 * Bump version to 2.6.4 * Preload common JSON-LD contexts (mastodon#9412) Fixes mastodon#9411 * Include replies to list owner and replies to list members in list statuses (mastodon#9324) * Bump version to 2.6.5 * Only stream local-only toots to logged-in users * Normalize translations * Bumps copyright year in README.md to 2019 (mastodon#9939) This is so incredibly small, but assuming this is a needed change. Might want to check year in other files. * Fix link color in high-contrast theme, add underlines (mastodon#9949) Improve sorting of default themes in the dropdown * Replace unlock-alt icon with unlock (mastodon#9952) * Allow most kinds of characters in URL query (fixes mastodon#8408) (mastodon#8447) * Allow unicode characters in URL query strings Fixes mastodon#8408 * Alternative approach to unicode support in urls Adds PoC/idea to approch this problem. * Fix authorized applications list page design (mastodon#9969) * Fix not showing custom emojis in share page emoji picker (mastodon#9970) * [UI] Fix whitespace being applied to div instead of p (mastodon#9968) * fix large line breaks * fix ascii art posts * Hide misleading “You will be sent a confirmation e-mail” hint from admin view (mastodon#9973) Thanks @wryk for noticing this issue. * Fix Tombstone.delete_all ArgumentError (mastodon#9978) * Only URLs extract with pre-escaped text (mastodon#9991) * [test] add japanese hashtag testcase * Only URLs extract with pre-escaped text ( mastodon#9989 ) * Fix URL linkifier grabbing full-width spaces and quotations (mastodon#9997) Fix mastodon#9993 Fix mastodon#5654 * Fix IntersectionObserverArticle not hiding some out-of-view items (mastodon#9982) IntersectionObserverArticle is made to save on RAM by avoiding fully rendering items that are far out of view. However, it did not work for items spawned outside the intersection observer. * Fix timeline jumps (mastodon#10001) * Avoid two-step rendering of statuses as much as possible Cache width shared by Video player, MediaGallery and Cards at the ScrollableList level, pass it down through StatusList and Notifications. * Adjust scroll when new preview cards appear * Adjust scroll when statuses above the current scroll position are deleted * Don't focus spiler input when disabled spoiler (mastodon#10017) * Move sending account Delete to anyone but the account's followers to the pull̀ queue (mastodon#10016) * Add support for IPv6 only MXes in Email validation (mastodon#10009) * Add support for IPv6 only MXes * Fixed email validator tests * Save IP address used for sign-up, not only sign-in (mastodon#10026) Fixes mastodon#9995 * Fix color of static page links in high contrast theme (mastodon#10028) * Fix hashtags select styling in default and high contrast themes (mastodon#10029) * Fix style regressions on landing page (mastodon#10030) * Add tight rate-limit for API deletions (mastodon#10042) Deletions take a lot of resources to execute and cause a lot of federation traffic, so it makes sense to decrease the number someone can queue up through the API. 30 per 30 minutes * Fix hashtag column not subscribing to stream on mount (mastodon#10040) Fix mastodon#9895 * Create Redisable#redis (mastodon#9633) * Create Redisable * Use #redis instead of Redis.current * Alternative handling of private self-boosts (mastodon#9998) * When self-boosting, embed original toot into Announce serialization * Process unknown self-boosts from Announce object if it is more than an URI * Add some self-boost specs * Only serialize private toots in self-Announces * Filter incoming Create activities by relation to local activity (mastodon#10005) Reject those from accounts with no local followers, from relays that are not enabled, which do not address local accounts and are not replies to accounts that do have local followers * Filter incoming Announce activities by relation to local activity (mastodon#10041) * Filter incoming Announce activities by relation to local activity Reject if announcer is not followed by local accounts, and is not from an enabled relay, and the object is not a local status Follow-up to mastodon#10005 * Fix tests * Add logging for rejected ActivityPub payloads and add tests (mastodon#10062) * Fix Announce activities of unknown statuses not fetching those statuses (mastodon#10065) Regression from mastodon#9998 * Fix relay enabling/disabling not resetting inbox availability status (mastodon#10048) Fix mastodon#10033 * Change robots.txt to exclude some URLs (mastodon#10037) - Exclude static assets - Exclude uploaded files - Exclude alternate versions of the profile page - Exclude media proxy URLs * Change robots.txt to exclude only media proxy URLs (mastodon#10038) * Revert "Change robots.txt to exclude some URLs (mastodon#10037)" This reverts commit 80161f4. * Let's block media_proxy /media_proxy/ is a dynamic route used for requesting uncached media, so it's probably bad to let crawlers use it * misleading comment * Improve image description user experience (mastodon#10036) * Add image descriptions to searchable post content. * Allow multi-line image descriptions. * Request image descriptions in the same query as posts when creating the search index. (see mastodon#10036 (comment)) * perf: run node directly when streaming (mastodon#10032) * Fix breaks when opening a reply tree in WebUI (mastodon#10046) fix mastodon#10045 * Change conversations to always show names of other participants (mastodon#10047) Fix mastodon#9190 * Change buttons on timeline preview to open the interaction dialog (mastodon#10054) Fix mastodon#9922 * Change error graphic to hover-to-play (mastodon#10055) Fix mastodon#6060 * Add registrations attribute to instance entity in REST API (mastodon#10060) Fix mastodon#9350 * Add vapid_key to the application entity in the REST API (mastodon#10058) Fix mastodon#8785 * Fix mutes, blocks, domain blocks and follow requests not paginating (mastodon#10057) Regression from mastodon#9581 * Fix crash on public hashtag pages when streaming fails (mastodon#10061) * Bump version to 2.7.2 * Do not leak local-only toots to remote mentioned users * Update .gitignore * Update Beach City version to 1.4
1 parent 62f2a68 commit 35e5c4f

92 files changed

Lines changed: 816 additions & 21 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,5 @@ yarn-debug.log
5858
# Ignore Docker option files
5959
docker-compose.override.yml
6060

61+
dump.rdb
62+
logfile

app/controllers/accounts_controller.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ def show
3434
format.atom do
3535
mark_cacheable!
3636

37-
@entries = @account.stream_entries.where(hidden: false).with_includes.paginate_by_max_id(PAGE_SIZE, params[:max_id], params[:since_id])
37+
@entries = @account.stream_entries.where(hidden: false).with_includes.without_local_only.paginate_by_max_id(PAGE_SIZE, params[:max_id], params[:since_id])
3838
render xml: OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.feed(@account, @entries.reject { |entry| entry.status.nil? }))
3939
end
4040

4141
format.rss do
4242
mark_cacheable!
4343

44-
@statuses = cache_collection(default_statuses.without_reblogs.without_replies.limit(PAGE_SIZE), Status)
44+
@statuses = cache_collection(default_statuses.without_local_only.without_reblogs.without_replies.limit(PAGE_SIZE), Status)
4545
render xml: RSS::AccountSerializer.render(@account, @statuses)
4646
end
4747

@@ -70,7 +70,11 @@ def filtered_statuses
7070
end
7171

7272
def default_statuses
73-
@account.statuses.where(visibility: [:public, :unlisted])
73+
if current_user.nil?
74+
@account.statuses.without_local_only.where(visibility: [:public, :unlisted])
75+
else
76+
@account.statuses.where(visibility: [:public, :unlisted])
77+
end
7478
end
7579

7680
def only_media_scope

app/controllers/api/v1/accounts/credentials_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def user_settings_params
3333
'setting_default_privacy' => source_params.fetch(:privacy, @account.user.setting_default_privacy),
3434
'setting_default_sensitive' => source_params.fetch(:sensitive, @account.user.setting_default_sensitive),
3535
'setting_default_language' => source_params.fetch(:language, @account.user.setting_default_language),
36+
'setting_default_federation' => source_params.fetch(:federation, @account.user.setting_default_federation),
3637
}
3738
end
3839
end

app/controllers/api/v1/statuses_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ def create
5454
scheduled_at: status_params[:scheduled_at],
5555
application: doorkeeper_token.application,
5656
poll: status_params[:poll],
57-
idempotency: request.headers['Idempotency-Key'])
57+
idempotency: request.headers['Idempotency-Key'],
58+
local_only: status_params[:local_only])
5859

5960
render json: @status, serializer: @status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer
6061
end
@@ -85,6 +86,7 @@ def status_params
8586
:spoiler_text,
8687
:visibility,
8788
:scheduled_at,
89+
:local_only,
8890
media_ids: [],
8991
poll: [
9092
:multiple,

app/controllers/settings/preferences_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def user_settings_params
3636
:setting_default_privacy,
3737
:setting_default_sensitive,
3838
:setting_default_language,
39+
:setting_default_federation,
3940
:setting_unfollow_modal,
4041
:setting_boost_modal,
4142
:setting_delete_modal,

app/controllers/stream_entries_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def show
1919
end
2020

2121
format.atom do
22-
unless @stream_entry.hidden?
22+
unless @stream_entry.hidden? || @stream_entry.local_only?
2323
skip_session!
2424
expires_in 3.minutes, public: true
2525
end
@@ -53,7 +53,7 @@ def set_stream_entry
5353
@type = @stream_entry.activity_type.downcase
5454

5555
raise ActiveRecord::RecordNotFound if @stream_entry.activity.nil?
56-
authorize @stream_entry.activity, :show? if @stream_entry.hidden?
56+
authorize @stream_entry.activity, :show? if @stream_entry.hidden? || @stream_entry.local_only?
5757
rescue Mastodon::NotPermittedError
5858
# Reraise in order to get a 404
5959
raise ActiveRecord::RecordNotFound

app/javascript/mastodon/actions/compose.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const COMPOSE_SENSITIVITY_CHANGE = 'COMPOSE_SENSITIVITY_CHANGE';
4242
export const COMPOSE_SPOILERNESS_CHANGE = 'COMPOSE_SPOILERNESS_CHANGE';
4343
export const COMPOSE_SPOILER_TEXT_CHANGE = 'COMPOSE_SPOILER_TEXT_CHANGE';
4444
export const COMPOSE_VISIBILITY_CHANGE = 'COMPOSE_VISIBILITY_CHANGE';
45+
export const COMPOSE_FEDERATION_CHANGE = 'COMPOSE_FEDERATION_CHANGE';
4546
export const COMPOSE_LISTABILITY_CHANGE = 'COMPOSE_LISTABILITY_CHANGE';
4647
export const COMPOSE_COMPOSING_CHANGE = 'COMPOSE_COMPOSING_CHANGE';
4748

@@ -140,6 +141,7 @@ export function submitCompose(routerHistory) {
140141
spoiler_text: getState().getIn(['compose', 'spoiler_text'], ''),
141142
visibility: getState().getIn(['compose', 'privacy']),
142143
poll: getState().getIn(['compose', 'poll'], null),
144+
local_only: !getState().getIn(['compose', 'federation']),
143145
}, {
144146
headers: {
145147
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),
@@ -489,6 +491,13 @@ export function changeComposeVisibility(value) {
489491
};
490492
};
491493

494+
export function changeComposeFederation(value) {
495+
return {
496+
type: COMPOSE_FEDERATION_CHANGE,
497+
value,
498+
};
499+
};
500+
492501
export function insertEmojiCompose(position, emoji, needsSpace) {
493502
return {
494503
type: COMPOSE_EMOJI_INSERT,

app/javascript/mastodon/components/status_action_bar.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const messages = defineMessages({
2222
reblog_private: { id: 'status.reblog_private', defaultMessage: 'Boost to original audience' },
2323
cancel_reblog_private: { id: 'status.cancel_reblog_private', defaultMessage: 'Unboost' },
2424
cannot_reblog: { id: 'status.cannot_reblog', defaultMessage: 'This post cannot be boosted' },
25+
local_only: { id: 'status.local_only', defaultMessage: 'This post is only visible by other users of your instance' },
2526
favourite: { id: 'status.favourite', defaultMessage: 'Favourite' },
2627
open: { id: 'status.open', defaultMessage: 'Expand this status' },
2728
report: { id: 'status.report', defaultMessage: 'Report @{name}' },
@@ -183,6 +184,7 @@ class StatusActionBar extends ImmutablePureComponent {
183184
const mutingConversation = status.get('muted');
184185
const anonymousAccess = !me;
185186
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'));
187+
const federated = !status.get('local_only');
186188

187189
let menu = [];
188190
let reblogIcon = 'retweet';
@@ -257,6 +259,9 @@ class StatusActionBar extends ImmutablePureComponent {
257259
<div className='status__action-bar-dropdown'>
258260
<DropdownMenuContainer disabled={anonymousAccess} status={status} items={menu} icon='ellipsis-h' size={18} direction='right' title={intl.formatMessage(messages.more)} />
259261
</div>
262+
{ !federated &&
263+
<IconButton className='status__action-bar-button' disabled title={intl.formatMessage(messages.local_only)} icon='chain-broken' />
264+
}
260265
</div>
261266
);
262267
}

app/javascript/mastodon/features/compose/components/compose_form.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import UploadButtonContainer from '../containers/upload_button_container';
1010
import { defineMessages, injectIntl } from 'react-intl';
1111
import SpoilerButtonContainer from '../containers/spoiler_button_container';
1212
import PrivacyDropdownContainer from '../containers/privacy_dropdown_container';
13+
import FederationDropdownContainer from '../containers/federation_dropdown_container';
14+
import SensitiveButtonContainer from '../containers/sensitive_button_container';
1315
import EmojiPickerDropdown from '../containers/emoji_picker_dropdown_container';
1416
import PollFormContainer from '../containers/poll_form_container';
1517
import UploadFormContainer from '../containers/upload_form_container';
@@ -43,6 +45,7 @@ class ComposeForm extends ImmutablePureComponent {
4345
spoiler: PropTypes.bool,
4446
privacy: PropTypes.string,
4547
spoilerText: PropTypes.string,
48+
federation: PropTypes.bool,
4649
focusDate: PropTypes.instanceOf(Date),
4750
caretPosition: PropTypes.number,
4851
preselectDate: PropTypes.instanceOf(Date),
@@ -214,6 +217,7 @@ class ComposeForm extends ImmutablePureComponent {
214217
<PollButtonContainer />
215218
<PrivacyDropdownContainer />
216219
<SpoilerButtonContainer />
220+
<FederationDropdownContainer />
217221
</div>
218222
<div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div>
219223
</div>

0 commit comments

Comments
 (0)