Skip to content

Commit

Permalink
Add local only posts (#8)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Joyce Mayorga committed May 6, 2019
1 parent 62f2a68 commit 35e5c4f
Show file tree
Hide file tree
Showing 92 changed files with 816 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ yarn-debug.log
# Ignore Docker option files
docker-compose.override.yml

dump.rdb
logfile
10 changes: 7 additions & 3 deletions app/controllers/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ def show
format.atom do
mark_cacheable!

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

format.rss do
mark_cacheable!

@statuses = cache_collection(default_statuses.without_reblogs.without_replies.limit(PAGE_SIZE), Status)
@statuses = cache_collection(default_statuses.without_local_only.without_reblogs.without_replies.limit(PAGE_SIZE), Status)
render xml: RSS::AccountSerializer.render(@account, @statuses)
end

Expand Down Expand Up @@ -70,7 +70,11 @@ def filtered_statuses
end

def default_statuses
@account.statuses.where(visibility: [:public, :unlisted])
if current_user.nil?
@account.statuses.without_local_only.where(visibility: [:public, :unlisted])
else
@account.statuses.where(visibility: [:public, :unlisted])
end
end

def only_media_scope
Expand Down
1 change: 1 addition & 0 deletions app/controllers/api/v1/accounts/credentials_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def user_settings_params
'setting_default_privacy' => source_params.fetch(:privacy, @account.user.setting_default_privacy),
'setting_default_sensitive' => source_params.fetch(:sensitive, @account.user.setting_default_sensitive),
'setting_default_language' => source_params.fetch(:language, @account.user.setting_default_language),
'setting_default_federation' => source_params.fetch(:federation, @account.user.setting_default_federation),
}
end
end
4 changes: 3 additions & 1 deletion app/controllers/api/v1/statuses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def create
scheduled_at: status_params[:scheduled_at],
application: doorkeeper_token.application,
poll: status_params[:poll],
idempotency: request.headers['Idempotency-Key'])
idempotency: request.headers['Idempotency-Key'],
local_only: status_params[:local_only])

render json: @status, serializer: @status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer
end
Expand Down Expand Up @@ -85,6 +86,7 @@ def status_params
:spoiler_text,
:visibility,
:scheduled_at,
:local_only,
media_ids: [],
poll: [
:multiple,
Expand Down
1 change: 1 addition & 0 deletions app/controllers/settings/preferences_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def user_settings_params
:setting_default_privacy,
:setting_default_sensitive,
:setting_default_language,
:setting_default_federation,
:setting_unfollow_modal,
:setting_boost_modal,
:setting_delete_modal,
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/stream_entries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def show
end

format.atom do
unless @stream_entry.hidden?
unless @stream_entry.hidden? || @stream_entry.local_only?
skip_session!
expires_in 3.minutes, public: true
end
Expand Down Expand Up @@ -53,7 +53,7 @@ def set_stream_entry
@type = @stream_entry.activity_type.downcase

raise ActiveRecord::RecordNotFound if @stream_entry.activity.nil?
authorize @stream_entry.activity, :show? if @stream_entry.hidden?
authorize @stream_entry.activity, :show? if @stream_entry.hidden? || @stream_entry.local_only?
rescue Mastodon::NotPermittedError
# Reraise in order to get a 404
raise ActiveRecord::RecordNotFound
Expand Down
9 changes: 9 additions & 0 deletions app/javascript/mastodon/actions/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const COMPOSE_SENSITIVITY_CHANGE = 'COMPOSE_SENSITIVITY_CHANGE';
export const COMPOSE_SPOILERNESS_CHANGE = 'COMPOSE_SPOILERNESS_CHANGE';
export const COMPOSE_SPOILER_TEXT_CHANGE = 'COMPOSE_SPOILER_TEXT_CHANGE';
export const COMPOSE_VISIBILITY_CHANGE = 'COMPOSE_VISIBILITY_CHANGE';
export const COMPOSE_FEDERATION_CHANGE = 'COMPOSE_FEDERATION_CHANGE';
export const COMPOSE_LISTABILITY_CHANGE = 'COMPOSE_LISTABILITY_CHANGE';
export const COMPOSE_COMPOSING_CHANGE = 'COMPOSE_COMPOSING_CHANGE';

Expand Down Expand Up @@ -140,6 +141,7 @@ export function submitCompose(routerHistory) {
spoiler_text: getState().getIn(['compose', 'spoiler_text'], ''),
visibility: getState().getIn(['compose', 'privacy']),
poll: getState().getIn(['compose', 'poll'], null),
local_only: !getState().getIn(['compose', 'federation']),
}, {
headers: {
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),
Expand Down Expand Up @@ -489,6 +491,13 @@ export function changeComposeVisibility(value) {
};
};

export function changeComposeFederation(value) {
return {
type: COMPOSE_FEDERATION_CHANGE,
value,
};
};

export function insertEmojiCompose(position, emoji, needsSpace) {
return {
type: COMPOSE_EMOJI_INSERT,
Expand Down
5 changes: 5 additions & 0 deletions app/javascript/mastodon/components/status_action_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const messages = defineMessages({
reblog_private: { id: 'status.reblog_private', defaultMessage: 'Boost to original audience' },
cancel_reblog_private: { id: 'status.cancel_reblog_private', defaultMessage: 'Unboost' },
cannot_reblog: { id: 'status.cannot_reblog', defaultMessage: 'This post cannot be boosted' },
local_only: { id: 'status.local_only', defaultMessage: 'This post is only visible by other users of your instance' },
favourite: { id: 'status.favourite', defaultMessage: 'Favourite' },
open: { id: 'status.open', defaultMessage: 'Expand this status' },
report: { id: 'status.report', defaultMessage: 'Report @{name}' },
Expand Down Expand Up @@ -183,6 +184,7 @@ class StatusActionBar extends ImmutablePureComponent {
const mutingConversation = status.get('muted');
const anonymousAccess = !me;
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'));
const federated = !status.get('local_only');

let menu = [];
let reblogIcon = 'retweet';
Expand Down Expand Up @@ -257,6 +259,9 @@ class StatusActionBar extends ImmutablePureComponent {
<div className='status__action-bar-dropdown'>
<DropdownMenuContainer disabled={anonymousAccess} status={status} items={menu} icon='ellipsis-h' size={18} direction='right' title={intl.formatMessage(messages.more)} />
</div>
{ !federated &&
<IconButton className='status__action-bar-button' disabled title={intl.formatMessage(messages.local_only)} icon='chain-broken' />
}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import UploadButtonContainer from '../containers/upload_button_container';
import { defineMessages, injectIntl } from 'react-intl';
import SpoilerButtonContainer from '../containers/spoiler_button_container';
import PrivacyDropdownContainer from '../containers/privacy_dropdown_container';
import FederationDropdownContainer from '../containers/federation_dropdown_container';
import SensitiveButtonContainer from '../containers/sensitive_button_container';
import EmojiPickerDropdown from '../containers/emoji_picker_dropdown_container';
import PollFormContainer from '../containers/poll_form_container';
import UploadFormContainer from '../containers/upload_form_container';
Expand Down Expand Up @@ -43,6 +45,7 @@ class ComposeForm extends ImmutablePureComponent {
spoiler: PropTypes.bool,
privacy: PropTypes.string,
spoilerText: PropTypes.string,
federation: PropTypes.bool,
focusDate: PropTypes.instanceOf(Date),
caretPosition: PropTypes.number,
preselectDate: PropTypes.instanceOf(Date),
Expand Down Expand Up @@ -214,6 +217,7 @@ class ComposeForm extends ImmutablePureComponent {
<PollButtonContainer />
<PrivacyDropdownContainer />
<SpoilerButtonContainer />
<FederationDropdownContainer />
</div>
<div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div>
</div>
Expand Down
Loading

0 comments on commit 35e5c4f

Please sign in to comment.