Skip to content

Commit

Permalink
Merge latest upstream from glitch-soc/mastodon/main (#70)
Browse files Browse the repository at this point in the history
* Remove the search button from UI header when logged out (mastodon#25631)

* Change account search to match by text when opted-in (mastodon#25599)

Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>

* Fix ResolveURLService not resolving local URLs for remote content (mastodon#25637)

* Remove `pkg-config` gem dependency (mastodon#25615)

* Update Crowdin configuration file

* Fix onboarding prompt being displayed because of disconnection gaps (mastodon#25617)

* Use an Immutable Record as the root state (mastodon#25584)

* Add index to backups on `user_id` column (mastodon#25647)

* Fix rails `rewhere` deprecation warning in directories api controller (mastodon#25625)

* Remove unused routes (mastodon#25578)

* Fixing an issue with a missing argument (glitch-soc#2261)

undefined

* Update uri to version 0.12.2 (CVE fix) (mastodon#25657)

* Change local and federated timelines to be in a single firehose column (mastodon#25641)

* Fix HTTP 500 in `/api/v1/emails/check_confirmation` (mastodon#25595)

* Rails 7 update (mastodon#24241)

* Change dropdown icon above compose form from ellipsis to bars in web UI (mastodon#25661)

* Prevent duplicate concurrent calls of `/api/*/instance` in web UI (mastodon#25663)

* Revert "Rails 7 update" (mastodon#25667)

* [Glitch] Remove the search button from UI header when logged out

Port 285a691 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>

* [Glitch] Fix onboarding prompt being displayed because of disconnection gaps

Port 9934949 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>

* [Glitch] Use an Immutable Record as the root state

Port 78ba12f to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>

* [Glitch] Change local and federated timelines to be in a single firehose column

Port cea9db5 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>

* [Glitch] Change dropdown icon above compose form from ellipsis to bars in web UI

Port 0512537 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>

* [Glitch] Prevent duplicate concurrent calls of `/api/*/instance` in web UI

Port 5b46345 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>

* Show local-only posts in “All” by default, and add back option to toggle it

* Fix showing local only toots in "All" (glitch-soc#2265)

* Fix warnings about missing dependency in hooks

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>

* Add `allowLocalOnly` to timelineId

Without this local-only toots will never be loaded.

feedType is checked to be public to not show local-only toots in the "Remote" tab.

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>

---------

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>

* Add regex filter back to firehose (glitch-soc#2266)

* Add regex filter back to firehose

The regex filter will apply to all tabs and not be automatically applied when pinned.

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>

* Keep regex when pinned

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>

---------

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>

---------

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Co-authored-by: jsgoldstein <jakegoldstein95@gmail.com>
Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>
Co-authored-by: Renaud Chaput <renchap@gmail.com>
Co-authored-by: Matt Jankowski <matt@jankowski.online>
Co-authored-by: Vivianne <puttabutta@gmail.com>
Co-authored-by: Daniel M Brasil <danielmbrasil@protonmail.com>
Co-authored-by: mogaminsk <mgmnjp@icloud.com>
Co-authored-by: Plastikmensch <Plastikmensch@users.noreply.github.com>
  • Loading branch information
10 people authored Jul 3, 2023
1 parent 9d69381 commit 4691b00
Show file tree
Hide file tree
Showing 46 changed files with 869 additions and 96 deletions.
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

0 comments on commit 4691b00

Please sign in to comment.