Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge latest upstream from glitch-soc/mastodon/main #70

Merged
merged 29 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
285a691
Remove the search button from UI header when logged out (#25631)
ClearlyClaire Jun 28, 2023
4581a52
Change account search to match by text when opted-in (#25599)
jsgoldstein Jun 29, 2023
a209d1e
Fix ResolveURLService not resolving local URLs for remote content (#2…
ClearlyClaire Jun 29, 2023
c4a8c33
Remove `pkg-config` gem dependency (#25615)
renchap Jun 30, 2023
8bfbd19
Update Crowdin configuration file
Gargron Jun 30, 2023
9934949
Fix onboarding prompt being displayed because of disconnection gaps (…
ClearlyClaire Jun 30, 2023
78ba12f
Use an Immutable Record as the root state (#25584)
renchap Jun 30, 2023
c47cdf6
Add index to backups on `user_id` column (#25647)
mjankowski Jun 30, 2023
683ba5e
Fix rails `rewhere` deprecation warning in directories api controller…
mjankowski Jul 1, 2023
f8bd581
Remove unused routes (#25578)
mjankowski Jul 1, 2023
155fc45
Fixing an issue with a missing argument (#2261)
viviicat Jul 1, 2023
0139b1c
Update uri to version 0.12.2 (CVE fix) (#25657)
mjankowski Jul 1, 2023
cea9db5
Change local and federated timelines to be in a single firehose colum…
ClearlyClaire Jul 1, 2023
4fe2d7c
Fix HTTP 500 in `/api/v1/emails/check_confirmation` (#25595)
danielmbrasil Jul 1, 2023
50c2a03
Rails 7 update (#24241)
mjankowski Jul 2, 2023
0512537
Change dropdown icon above compose form from ellipsis to bars in web …
Gargron Jul 2, 2023
5b46345
Prevent duplicate concurrent calls of `/api/*/instance` in web UI (#2…
mgmn Jul 2, 2023
ba06a2f
Revert "Rails 7 update" (#25667)
Gargron Jul 2, 2023
44e98a2
Merge branch 'main' into glitch-soc/merge-upstream
ClearlyClaire Jul 2, 2023
b75aa6b
[Glitch] Remove the search button from UI header when logged out
ClearlyClaire Jun 28, 2023
2ba4773
[Glitch] Fix onboarding prompt being displayed because of disconnecti…
ClearlyClaire Jun 30, 2023
eb1cb82
[Glitch] Use an Immutable Record as the root state
renchap Jun 30, 2023
7cc2c1b
[Glitch] Change local and federated timelines to be in a single fireh…
ClearlyClaire Jul 1, 2023
c49e339
[Glitch] Change dropdown icon above compose form from ellipsis to bar…
Gargron Jul 2, 2023
587ddc2
[Glitch] Prevent duplicate concurrent calls of `/api/*/instance` in w…
mgmn Jul 2, 2023
9f3c3f5
Show local-only posts in “All” by default, and add back option to tog…
ClearlyClaire Jul 2, 2023
ed567c9
Merge pull request #2263 from ClearlyClaire/glitch-soc/merge-upstream
ClearlyClaire Jul 2, 2023
b422b5e
Fix showing local only toots in "All" (#2265)
Plastikmensch Jul 3, 2023
ed15893
Add regex filter back to firehose (#2266)
Plastikmensch Jul 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
source 'https://rubygems.org'
ruby '>= 3.0.0'

gem 'pkg-config', '~> 1.5'

gem 'puma', '~> 6.3'
gem 'rails', '~> 6.1.7'
gem 'sprockets', '~> 3.7.2'
Expand Down
4 changes: 1 addition & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,6 @@ GEM
pg (1.5.3)
pghero (3.3.3)
activerecord (>= 6)
pkg-config (1.5.1)
posix-spawn (0.3.15)
premailer (1.21.0)
addressable
Expand Down Expand Up @@ -717,7 +716,7 @@ GEM
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (2.4.2)
uri (0.12.1)
uri (0.12.2)
validate_email (0.1.6)
activemodel (>= 3.0)
mail (>= 2.2.5)
Expand Down Expand Up @@ -833,7 +832,6 @@ DEPENDENCIES
parslet
pg (~> 1.5)
pghero
pkg-config (~> 1.5)
posix-spawn
premailer-rails
private_address_check (~> 0.5)
Expand Down
52 changes: 38 additions & 14 deletions app/chewy/accounts_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,37 @@

class AccountsIndex < Chewy::Index
settings index: { refresh_interval: '30s' }, analysis: {
filter: {
english_stop: {
type: 'stop',
stopwords: '_english_',
},

english_stemmer: {
type: 'stemmer',
language: 'english',
},

english_possessive_stemmer: {
type: 'stemmer',
language: 'possessive_english',
},
},

analyzer: {
content: {
natural: {
tokenizer: 'uax_url_email',
filter: %w(
english_possessive_stemmer
lowercase
asciifolding
cjk_width
english_stop
english_stemmer
),
},

verbatim: {
tokenizer: 'whitespace',
filter: %w(lowercase asciifolding cjk_width),
},
Expand All @@ -26,18 +55,13 @@ class AccountsIndex < Chewy::Index
index_scope ::Account.searchable.includes(:account_stat)

root date_detection: false do
field :id, type: 'long'

field :display_name, type: 'text', analyzer: 'content' do
field :edge_ngram, type: 'text', analyzer: 'edge_ngram', search_analyzer: 'content'
end

field :acct, type: 'text', analyzer: 'content', value: ->(account) { [account.username, account.domain].compact.join('@') } do
field :edge_ngram, type: 'text', analyzer: 'edge_ngram', search_analyzer: 'content'
end

field :following_count, type: 'long', value: ->(account) { account.following_count }
field :followers_count, type: 'long', value: ->(account) { account.followers_count }
field :last_status_at, type: 'date', value: ->(account) { account.last_status_at || account.created_at }
field(:id, type: 'long')
field(:following_count, type: 'long')
field(:followers_count, type: 'long')
field(:properties, type: 'keyword', value: ->(account) { account.searchable_properties })
field(:last_status_at, type: 'date', value: ->(account) { account.last_status_at || account.created_at })
field(:display_name, type: 'text', analyzer: 'verbatim') { field :edge_ngram, type: 'text', analyzer: 'edge_ngram', search_analyzer: 'verbatim' }
field(:username, type: 'text', analyzer: 'verbatim', value: ->(account) { [account.username, account.domain].compact.join('@') }) { field :edge_ngram, type: 'text', analyzer: 'edge_ngram', search_analyzer: 'verbatim' }
field(:text, type: 'text', value: ->(account) { account.searchable_text }) { field :stemmed, type: 'text', analyzer: 'natural' }
end
end
34 changes: 29 additions & 5 deletions app/controllers/api/v1/directories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,35 @@ def set_accounts

def accounts_scope
Account.discoverable.tap do |scope|
scope.merge!(Account.local) if truthy_param?(:local)
scope.merge!(Account.by_recent_status) if params[:order].blank? || params[:order] == 'active'
scope.merge!(Account.order(id: :desc)) if params[:order] == 'new'
scope.merge!(Account.not_excluded_by_account(current_account)) if current_account
scope.merge!(Account.not_domain_blocked_by_account(current_account)) if current_account && !truthy_param?(:local)
scope.merge!(account_order_scope)
scope.merge!(local_account_scope) if local_accounts?
scope.merge!(account_exclusion_scope) if current_account
scope.merge!(account_domain_block_scope) if current_account && !local_accounts?
end
end

def local_accounts?
truthy_param?(:local)
end

def account_order_scope
case params[:order]
when 'new'
Account.order(id: :desc)
when 'active', nil
Account.by_recent_status
end
end

def local_account_scope
Account.local
end

def account_exclusion_scope
Account.not_excluded_by_account(current_account)
end

def account_domain_block_scope
Account.not_domain_blocked_by_account(current_account)
end
end
1 change: 1 addition & 0 deletions app/controllers/api/v1/emails/confirmations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Api::V1::Emails::ConfirmationsController < Api::BaseController
before_action -> { doorkeeper_authorize! :write, :'write:accounts' }, except: :check
before_action :require_user_owned_by_application!, except: :check
before_action :require_user_not_confirmed!, except: :check
before_action :require_authenticated_user!, only: :check

def create
current_user.update!(email: params[:email]) if params.key?(:email)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/theming_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def resolve_pack(data, pack_name, skin)
end

fallbacks.each do |fallback|
return resolve_pack(Themes.instance.flavour(fallback), pack_name) if Themes.instance.flavour(fallback)
return resolve_pack(Themes.instance.flavour(fallback), pack_name, skin) if Themes.instance.flavour(fallback)
end

nil
Expand Down
12 changes: 12 additions & 0 deletions app/javascript/flavours/glitch/actions/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export const SERVER_DOMAIN_BLOCKS_FETCH_SUCCESS = 'SERVER_DOMAIN_BLOCKS_FETCH_SU
export const SERVER_DOMAIN_BLOCKS_FETCH_FAIL = 'SERVER_DOMAIN_BLOCKS_FETCH_FAIL';

export const fetchServer = () => (dispatch, getState) => {
if (getState().getIn(['server', 'server', 'isLoading'])) {
return;
}

dispatch(fetchServerRequest());

api(getState)
Expand Down Expand Up @@ -66,6 +70,10 @@ const fetchServerTranslationLanguagesFail = error => ({
});

export const fetchExtendedDescription = () => (dispatch, getState) => {
if (getState().getIn(['server', 'extendedDescription', 'isLoading'])) {
return;
}

dispatch(fetchExtendedDescriptionRequest());

api(getState)
Expand All @@ -89,6 +97,10 @@ const fetchExtendedDescriptionFail = error => ({
});

export const fetchDomainBlocks = () => (dispatch, getState) => {
if (getState().getIn(['server', 'domainBlocks', 'isLoading'])) {
return;
}

dispatch(fetchDomainBlocksRequest());

api(getState)
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/flavours/glitch/features/about/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class About extends PureComponent {
</Section>

<Section title={intl.formatMessage(messages.rules)}>
{!isLoading && (server.get('rules').isEmpty() ? (
{!isLoading && (server.get('rules', []).isEmpty() ? (
<p><FormattedMessage id='about.not_available' defaultMessage='This information has not been made available on this server.' /></p>
) : (
<ol className='rules-list'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ActionBar extends PureComponent {
return (
<div className='compose__action-bar'>
<div className='compose__action-bar-dropdown'>
<DropdownMenuContainer items={menu} icon='ellipsis-v' size={18} direction='right' />
<DropdownMenuContainer items={menu} icon='bars' size={18} direction='right' />
</div>
</div>
);
Expand Down
Loading