Skip to content

Commit

Permalink
Merge commit '1483a3ddfe74e4fb81d87447a1781943eab86c60' into glitch-s…
Browse files Browse the repository at this point in the history
…oc/merge-upstream

Conflicts:
- `config/initializers/simple_form.rb`:
  Upstream added a new simple_form component, where we had an extra one.
  Kept both components.
  • Loading branch information
ClearlyClaire committed Jun 10, 2023
2 parents 9e66c07 + 1483a3d commit d8b0a73
Show file tree
Hide file tree
Showing 68 changed files with 837 additions and 159 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ module.exports = {
{ property: 'substring', message: 'Use .slice instead of .substring.' },
{ property: 'substr', message: 'Use .slice instead of .substr.' },
],
'no-restricted-syntax': [
'error',
{
// eslint-disable-next-line no-restricted-syntax
selector: 'Literal[value=/•/], JSXText[value=/•/]',
// eslint-disable-next-line no-restricted-syntax
message: "Use '·' (middle dot) instead of '•' (bullet)",
},
],
'no-self-assign': 'off',
'no-unused-expressions': 'error',
'no-unused-vars': 'off',
Expand Down
5 changes: 5 additions & 0 deletions .haml-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ exclude:
- 'vendor/**/*'
- lib/templates/haml/scaffold/_form.html.haml

require:
- ./lib/linter/haml_middle_dot.rb

linters:
AltText:
enabled: true
MiddleDot:
enabled: true
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require:
- rubocop-rspec
- rubocop-performance
- rubocop-capybara
- ./lib/linter/rubocop_middle_dot

AllCops:
TargetRubyVersion: 3.0 # Set to minimum supported version of CI
Expand Down Expand Up @@ -205,3 +206,6 @@ Style/TrailingCommaInArrayLiteral:
# https://docs.rubocop.org/rubocop/cops_style.html#styletrailingcommainhashliteral
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: 'comma'

Style/MiddleDot:
Enabled: true
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ gem 'dotenv-rails', '~> 2.8'
gem 'aws-sdk-s3', '~> 1.123', require: false
gem 'fog-core', '<= 2.4.0'
gem 'fog-openstack', '~> 0.3', require: false
gem 'kt-paperclip', '~> 7.1', github: 'kreeti/kt-paperclip', ref: '11abf222dc31bff71160a1d138b445214f434b2b'
gem 'kt-paperclip', '~> 7.2'
gem 'blurhash', '~> 0.1'

gem 'active_model_serializers', '~> 0.10'
Expand Down Expand Up @@ -60,7 +60,6 @@ gem 'kaminari', '~> 1.2'
gem 'link_header', '~> 0.0'
gem 'mime-types', '~> 3.4.1', require: 'mime/types/columnar'
gem 'nokogiri', '~> 1.15'
gem 'nsa', '~> 0.2'
gem 'oj', '~> 3.14'
gem 'ox', '~> 2.14'
gem 'parslet'
Expand Down
27 changes: 7 additions & 20 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,6 @@ GIT
hkdf (~> 0.2)
jwt (~> 2.0)

GIT
remote: https://github.com/kreeti/kt-paperclip.git
revision: 11abf222dc31bff71160a1d138b445214f434b2b
ref: 11abf222dc31bff71160a1d138b445214f434b2b
specs:
kt-paperclip (7.1.1)
activemodel (>= 4.2.0)
activesupport (>= 4.2.0)
marcel (~> 1.0.1)
mime-types
terrapin (~> 0.6.0)

GIT
remote: https://github.com/mastodon/rails-settings-cached.git
revision: 86328ef0bd04ce21cc0504ff5e334591e8c2ccab
Expand Down Expand Up @@ -380,6 +368,12 @@ GEM
activerecord
kaminari-core (= 1.2.2)
kaminari-core (1.2.2)
kt-paperclip (7.2.0)
activemodel (>= 4.2.0)
activesupport (>= 4.2.0)
marcel (~> 1.0.1)
mime-types
terrapin (~> 0.6.0)
launchy (2.5.2)
addressable (~> 2.8)
letter_opener (1.8.1)
Expand Down Expand Up @@ -442,11 +436,6 @@ GEM
nokogiri (1.15.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nsa (0.2.8)
activesupport (>= 4.2, < 7)
concurrent-ruby (~> 1.0, >= 1.0.2)
sidekiq (>= 3.5)
statsd-ruby (~> 1.4, >= 1.4.0)
oj (3.14.3)
omniauth (1.9.2)
hashie (>= 3.4.6)
Expand Down Expand Up @@ -682,7 +671,6 @@ GEM
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stackprof (0.2.25)
statsd-ruby (1.5.0)
stoplight (3.0.1)
redlock (~> 1.0)
strong_migrations (0.8.0)
Expand Down Expand Up @@ -819,7 +807,7 @@ DEPENDENCIES
json-ld-preloaded (~> 3.2)
json-schema (~> 4.0)
kaminari (~> 1.2)
kt-paperclip (~> 7.1)!
kt-paperclip (~> 7.2)
letter_opener (~> 1.8)
letter_opener_web (~> 2.0)
link_header (~> 0.0)
Expand All @@ -831,7 +819,6 @@ DEPENDENCIES
net-http (~> 0.3.2)
net-ldap (~> 0.18)
nokogiri (~> 1.15)
nsa (~> 0.2)
oj (~> 3.14)
omniauth (~> 1.9)
omniauth-cas (~> 2.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/lists_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ def set_list
end

def list_params
params.permit(:title, :replies_policy)
params.permit(:title, :replies_policy, :exclusive)
end
end
8 changes: 4 additions & 4 deletions app/controllers/backups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ class BackupsController < ApplicationController
def download
case Paperclip::Attachment.default_options[:storage]
when :s3
redirect_to @backup.dump.expiring_url(10)
redirect_to @backup.dump.expiring_url(10), allow_other_host: true
when :fog
if Paperclip::Attachment.default_options.dig(:fog_credentials, :openstack_temp_url_key).present?
redirect_to @backup.dump.expiring_url(Time.now.utc + 10)
redirect_to @backup.dump.expiring_url(Time.now.utc + 10), allow_other_host: true
else
redirect_to full_asset_url(@backup.dump.url)
redirect_to full_asset_url(@backup.dump.url), allow_other_host: true
end
when :filesystem
redirect_to full_asset_url(@backup.dump.url)
redirect_to full_asset_url(@backup.dump.url), allow_other_host: true
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/actions/importer/normalizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function normalizePollOptionTranslation(translation, poll) {

export function normalizeAnnouncement(announcement) {
const normalAnnouncement = { ...announcement };
const emojiMap = makeEmojiMap.emojis(normalAnnouncement);
const emojiMap = makeEmojiMap(normalAnnouncement.emojis);

normalAnnouncement.contentHtml = emojify(normalAnnouncement.content, emojiMap);

Expand Down
4 changes: 2 additions & 2 deletions app/javascript/mastodon/actions/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ export const createListFail = error => ({
error,
});

export const updateList = (id, title, shouldReset, replies_policy) => (dispatch, getState) => {
export const updateList = (id, title, shouldReset, isExclusive, replies_policy) => (dispatch, getState) => {
dispatch(updateListRequest(id));

api(getState).put(`/api/v1/lists/${id}`, { title, replies_policy }).then(({ data }) => {
api(getState).put(`/api/v1/lists/${id}`, { title, replies_policy, exclusive: typeof isExclusive === 'undefined' ? undefined : !!isExclusive }).then(({ data }) => {
dispatch(updateListSuccess(data));

if (shouldReset) {
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/features/explore/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Explore extends PureComponent {
<Search />
</div>

<div className='scrollable scrollable--flex'>
<div className='scrollable scrollable--flex' data-nosnippet>
{isSearching ? (
<SearchResults />
) : (
Expand Down
18 changes: 17 additions & 1 deletion app/javascript/mastodon/features/list_timeline/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { Helmet } from 'react-helmet';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';

import Toggle from 'react-toggle';

import { addColumn, removeColumn, moveColumn } from 'mastodon/actions/columns';
import { fetchList, deleteList, updateList } from 'mastodon/actions/lists';
import { openModal } from 'mastodon/actions/modal';
Expand Down Expand Up @@ -145,7 +147,13 @@ class ListTimeline extends PureComponent {
handleRepliesPolicyChange = ({ target }) => {
const { dispatch } = this.props;
const { id } = this.props.params;
dispatch(updateList(id, undefined, false, target.value));
dispatch(updateList(id, undefined, false, undefined, target.value));
};

onExclusiveToggle = ({ target }) => {
const { dispatch } = this.props;
const { id } = this.props.params;
dispatch(updateList(id, undefined, false, target.checked, undefined));
};

render () {
Expand All @@ -154,6 +162,7 @@ class ListTimeline extends PureComponent {
const pinned = !!columnId;
const title = list ? list.get('title') : id;
const replies_policy = list ? list.get('replies_policy') : undefined;
const isExclusive = list ? list.get('exclusive') : undefined;

if (typeof list === 'undefined') {
return (
Expand Down Expand Up @@ -191,6 +200,13 @@ class ListTimeline extends PureComponent {
</button>
</div>

<div className='setting-toggle'>
<Toggle id={`list-${id}-exclusive`} defaultChecked={isExclusive} onChange={this.onExclusiveToggle} />
<label htmlFor={`list-${id}-exclusive`} className='setting-toggle__label'>
<FormattedMessage id='lists.exclusive' defaultMessage='Hide these posts from home' />
</label>
</div>

{ replies_policy !== undefined && (
<div role='group' aria-labelledby={`list-${id}-replies-policy`}>
<span id={`list-${id}-replies-policy`} className='column-settings__section'>
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/features/onboarding/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Onboarding extends ImmutablePureComponent {

<div className='onboarding__steps'>
<Step onClick={this.handleProfileClick} href='/settings/profile' completed={(!account.get('avatar').endsWith('missing.png')) || (account.get('display_name').length > 0 && account.get('note').length > 0)} icon='address-book-o' label={<FormattedMessage id='onboarding.steps.setup_profile.title' defaultMessage='Customize your profile' />} description={<FormattedMessage id='onboarding.steps.setup_profile.body' defaultMessage='Others are more likely to interact with you with a filled out profile.' />} />
<Step onClick={this.handleFollowClick} completed={(account.get('following_count') * 1) >= 7} icon='user-plus' label={<FormattedMessage id='onboarding.steps.follow_people.title' defaultMessage='Follow {count, plural, one {one person} other {# people}}' values={{ count: 7 }} />} description={<FormattedMessage id='onboarding.steps.follow_people.body' defaultMessage="You curate your own feed. Let's fill it with interesting people." />} />
<Step onClick={this.handleFollowClick} completed={(account.get('following_count') * 1) >= 7} icon='user-plus' label={<FormattedMessage id='onboarding.steps.follow_people.title' defaultMessage='Find at least {count, plural, one {one person} other {# people}} to follow' values={{ count: 7 }} />} description={<FormattedMessage id='onboarding.steps.follow_people.body' defaultMessage="You curate your own home feed. Let's fill it with interesting people." />} />
<Step onClick={this.handleComposeClick} completed={(account.get('statuses_count') * 1) >= 1} icon='pencil-square-o' label={<FormattedMessage id='onboarding.steps.publish_status.title' defaultMessage='Make your first post' />} description={<FormattedMessage id='onboarding.steps.publish_status.body' defaultMessage='Say hello to the world.' />} />
<Step onClick={this.handleShareClick} completed={shareClicked} icon='copy' label={<FormattedMessage id='onboarding.steps.share_profile.title' defaultMessage='Share your profile' />} description={<FormattedMessage id='onboarding.steps.share_profile.body' defaultMessage='Let your friends know how to find you on Mastodon!' />} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class DetailedStatus extends ImmutablePureComponent {
} else if (this.context.router) {
reblogLink = (
<>
·
{' · '}
<Link to={`/@${status.getIn(['account', 'acct'])}/${status.get('id')}/reblogs`} className='detailed-status__link'>
<Icon id={reblogIcon} />
<span className='detailed-status__reblogs'>
Expand All @@ -229,7 +229,7 @@ class DetailedStatus extends ImmutablePureComponent {
} else {
reblogLink = (
<>
·
{' · '}
<a href={`/interact/${status.get('id')}?type=reblog`} className='detailed-status__link' onClick={this.handleModalLink}>
<Icon id={reblogIcon} />
<span className='detailed-status__reblogs'>
Expand Down Expand Up @@ -263,7 +263,7 @@ class DetailedStatus extends ImmutablePureComponent {
if (status.get('edited_at')) {
edited = (
<>
·
{' · '}
<EditedTimestamp statusId={status.get('id')} timestamp={status.get('edited_at')} />
</>
);
Expand Down
5 changes: 3 additions & 2 deletions app/javascript/mastodon/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@
"lists.delete": "Delete list",
"lists.edit": "Edit list",
"lists.edit.submit": "Change title",
"lists.exclusive": "Hide these posts from home",
"lists.new.create": "Add list",
"lists.new.title_placeholder": "New list title",
"lists.replies_policy.followed": "Any followed user",
Expand Down Expand Up @@ -460,8 +461,8 @@
"onboarding.start.lead": "Your new Mastodon account is ready to go. Here's how you can make the most of it:",
"onboarding.start.skip": "Want to skip right ahead?",
"onboarding.start.title": "You've made it!",
"onboarding.steps.follow_people.body": "You curate your own feed. Lets fill it with interesting people.",
"onboarding.steps.follow_people.title": "Follow {count, plural, one {one person} other {# people}}",
"onboarding.steps.follow_people.body": "You curate your own home feed. Let's fill it with interesting people.",
"onboarding.steps.follow_people.title": "Find at least {count, plural, one {one person} other {# people}} to follow",
"onboarding.steps.publish_status.body": "Say hello to the world.",
"onboarding.steps.publish_status.title": "Make your first post",
"onboarding.steps.setup_profile.body": "Others are more likely to interact with you with a filled out profile.",
Expand Down
1 change: 1 addition & 0 deletions app/javascript/mastodon/locales/intl_provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const IntlProvider: React.FC<
locale={locale}
messages={messages}
onError={onProviderError}
textComponent='span'
{...props}
>
{children}
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/mastodon/reducers/list_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const initialState = ImmutableMap({
isSubmitting: false,
isChanged: false,
title: '',
isExclusive: false,

accounts: ImmutableMap({
items: ImmutableList(),
Expand All @@ -46,6 +47,7 @@ export default function listEditorReducer(state = initialState, action) {
return state.withMutations(map => {
map.set('listId', action.list.get('id'));
map.set('title', action.list.get('title'));
map.set('isExclusive', action.list.get('is_exclusive'));
map.set('isSubmitting', false);
});
case LIST_EDITOR_TITLE_CHANGE:
Expand Down
14 changes: 2 additions & 12 deletions app/javascript/styles/mastodon/accounts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
display: block;
text-decoration: none;
color: inherit;
box-shadow: 0 0 15px rgba($base-shadow-color, 0.2);

@media screen and (max-width: $no-gap-breakpoint) {
box-shadow: none;
}
overflow: hidden;
border-radius: 4px;

&:hover,
&:active,
Expand All @@ -22,15 +19,13 @@
height: 130px;
position: relative;
background: darken($ui-base-color, 12%);
border-radius: 4px 4px 0 0;

img {
display: block;
width: 100%;
height: 100%;
margin: 0;
object-fit: cover;
border-radius: 4px 4px 0 0;
}

@media screen and (width <= 600px) {
Expand All @@ -45,11 +40,6 @@
justify-content: flex-start;
align-items: center;
background: lighten($ui-base-color, 4%);
border-radius: 0 0 4px 4px;

@media screen and (max-width: $no-gap-breakpoint) {
border-radius: 0;
}

.avatar {
flex: 0 0 auto;
Expand Down
4 changes: 4 additions & 0 deletions app/javascript/styles/mastodon/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ code {
color: $secondary-text-color;
margin-bottom: 30px;

&.invited-by {
margin-bottom: 15px;
}

a {
color: $highlight-text-color;
}
Expand Down

0 comments on commit d8b0a73

Please sign in to comment.