Skip to content

Commit

Permalink
Merge pull request #2834 from ClearlyClaire/glitch-soc/merge-upstream
Browse files Browse the repository at this point in the history
Merge upstream changes up to c9ea91f
  • Loading branch information
ClearlyClaire authored Sep 3, 2024
2 parents c461a6a + 8e3c47a commit 664dfa6
Show file tree
Hide file tree
Showing 92 changed files with 854 additions and 502 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@ docker-compose.override.yml

# Ignore dotenv .local files
.env*.local

# Ignore local-only rspec configuration
.rspec-local
1 change: 0 additions & 1 deletion .profile

This file was deleted.

1 change: 0 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
--color
--require spec_helper
--format Fuubar
10 changes: 5 additions & 5 deletions Aptfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ffmpeg
libopenblas0-pthread
libpq-dev
libxdamage1
libxfixes3
libidn12
# for idn-ruby on heroku-24 stack

# use https://github.com/heroku/heroku-buildpack-activestorage-preview
# in place for ffmpeg and its dependent packages to reduce slag size
5 changes: 2 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ group :test do
# Adds RSpec Error/Warning annotations to GitHub PRs on the Files tab
gem 'rspec-github', '~> 2.4', require: false

# RSpec progress bar formatter
gem 'fuubar', '~> 2.5'

# RSpec helpers for email specs
gem 'email_spec'

Expand All @@ -154,6 +151,8 @@ group :test do
# Test harness fo rack components
gem 'rack-test', '~> 2.1'

gem 'shoulda-matchers'

# Coverage formatter for RSpec test if DISABLE_SIMPLECOV is false
gem 'simplecov', '~> 0.22', require: false
gem 'simplecov-lcov', '~> 0.8', require: false
Expand Down
11 changes: 5 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,6 @@ GEM
fugit (1.11.1)
et-orbi (~> 1, >= 1.2.11)
raabro (~> 1.4)
fuubar (2.5.1)
rspec-core (~> 3.0)
ruby-progressbar (~> 1.4)
globalid (1.2.1)
activesupport (>= 6.1)
google-protobuf (3.25.4)
Expand Down Expand Up @@ -714,7 +711,7 @@ GEM
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
Expand All @@ -724,7 +721,7 @@ GEM
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (7.0.0)
rspec-rails (7.0.1)
actionpack (>= 7.0)
activesupport (>= 7.0)
railties (>= 7.0)
Expand Down Expand Up @@ -793,6 +790,8 @@ GEM
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
semantic_range (3.0.0)
shoulda-matchers (6.3.1)
activesupport (>= 5.2.0)
sidekiq (6.5.12)
connection_pool (>= 2.2.5, < 3)
rack (~> 2.0)
Expand Down Expand Up @@ -949,7 +948,6 @@ DEPENDENCIES
flatware-rspec
fog-core (<= 2.5.0)
fog-openstack (~> 1.0)
fuubar (~> 2.5)
haml-rails (~> 2.0)
haml_lint
hcaptcha (~> 7.1)
Expand Down Expand Up @@ -1039,6 +1037,7 @@ DEPENDENCIES
sanitize (~> 6.0)
scenic (~> 1.7)
selenium-webdriver
shoulda-matchers
sidekiq (~> 6.5)
sidekiq-bulk (~> 0.2.0)
sidekiq-scheduler (~> 5.0)
Expand Down
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ worker: bundle exec sidekiq
#
# and let the main app use the separate app:
#
# heroku config:set STREAMING_API_BASE_URL=wss://<streaming-app>.herokuapp.com -a <main-app>
# heroku config:set STREAMING_API_BASE_URL=wss://<streaming-app-random>.herokuapp.com -a <main-app>
9 changes: 8 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,22 @@
}
},
"buildpacks": [
{
"url": "https://github.com/heroku/heroku-buildpack-activestorage-preview"
},
{
"url": "https://github.com/heroku/heroku-buildpack-apt"
},
{
"url": "heroku/nodejs"
},
{
"url": "heroku/ruby"
}
],
"scripts": {
"postdeploy": "bundle exec rails db:migrate && bundle exec rails db:seed"
},
"addons": ["heroku-postgresql", "heroku-redis"]
"addons": ["heroku-postgresql", "heroku-redis"],
"stack": "heroku-24"
}
50 changes: 50 additions & 0 deletions app/controllers/api/v2_alpha/notifications/accounts_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# frozen_string_literal: true

class Api::V2Alpha::Notifications::AccountsController < Api::BaseController
before_action -> { doorkeeper_authorize! :read, :'read:notifications' }
before_action :require_user!
before_action :set_notifications!
after_action :insert_pagination_headers, only: :index

def index
@accounts = load_accounts
render json: @accounts, each_serializer: REST::AccountSerializer
end

private

def load_accounts
@paginated_notifications.map(&:from_account)
end

def set_notifications!
@paginated_notifications = begin
current_account
.notifications
.without_suspended
.where(group_key: params[:notification_group_key])
.includes(from_account: [:account_stat, :user])
.paginate_by_max_id(
limit_param(DEFAULT_ACCOUNTS_LIMIT),
params[:max_id],
params[:since_id]
)
end
end

def next_path
api_v2_alpha_notification_accounts_url pagination_params(max_id: pagination_max_id) if records_continue?
end

def prev_path
api_v2_alpha_notification_accounts_url pagination_params(min_id: pagination_since_id) unless @paginated_notifications.empty?
end

def pagination_collection
@paginated_notifications
end

def records_continue?
@paginated_notifications.size == limit_param(DEFAULT_ACCOUNTS_LIMIT)
end
end
4 changes: 2 additions & 2 deletions app/controllers/api/v2_alpha/notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def unread_count
end

def show
@notification = current_account.notifications.without_suspended.find_by!(group_key: params[:id])
@notification = current_account.notifications.without_suspended.find_by!(group_key: params[:group_key])
presenter = GroupedNotificationsPresenter.new(NotificationGroup.from_notifications([@notification]))
render json: presenter, serializer: REST::DedupNotificationGroupSerializer
end
Expand All @@ -57,7 +57,7 @@ def clear
end

def dismiss
current_account.notifications.where(group_key: params[:id]).destroy_all
current_account.notifications.where(group_key: params[:group_key]).destroy_all
render_empty
end

Expand Down
15 changes: 10 additions & 5 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,16 @@ def can?(action, record)
end

def material_symbol(icon, attributes = {})
inline_svg_tag(
"400-24px/#{icon}.svg",
class: ['icon', "material-#{icon}"].concat(attributes[:class].to_s.split),
role: :img,
data: attributes[:data]
safe_join(
[
inline_svg_tag(
"400-24px/#{icon}.svg",
class: ['icon', "material-#{icon}"].concat(attributes[:class].to_s.split),
role: :img,
data: attributes[:data]
),
' ',
]
)
end

Expand Down
4 changes: 1 addition & 3 deletions app/helpers/languages_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,7 @@ module LanguagesHelper

# Helper for self.sorted_locale_keys
private_class_method def self.locale_name_for_sorting(locale)
if locale.blank? || locale == 'und'
'000'
elsif (supported_locale = SUPPORTED_LOCALES[locale.to_sym])
if (supported_locale = SUPPORTED_LOCALES[locale.to_sym])
ASCIIFolding.new.fold(supported_locale[1]).downcase
elsif (regional_locale = REGIONAL_LOCALE_NAMES[locale.to_sym])
ASCIIFolding.new.fold(regional_locale).downcase
Expand Down
12 changes: 0 additions & 12 deletions app/javascript/flavours/glitch/actions/languages.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ class LanguageDropdown extends PureComponent {
frequentlyUsedLanguages: PropTypes.arrayOf(PropTypes.string),
intl: PropTypes.object.isRequired,
onChange: PropTypes.func,
onClose: PropTypes.func,
};

state = {
Expand All @@ -257,14 +256,11 @@ class LanguageDropdown extends PureComponent {
};

handleClose = () => {
const { value, onClose } = this.props;

if (this.state.open && this.activeElement) {
this.activeElement.focus({ preventScroll: true });
}

this.setState({ open: false });
onClose(value);
};

handleChange = value => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { connect } from 'react-redux';


import { changeComposeLanguage } from 'flavours/glitch/actions/compose';
import { useLanguage } from 'flavours/glitch/actions/languages';

import LanguageDropdown from '../components/language_dropdown';

Expand All @@ -28,11 +27,6 @@ const mapDispatchToProps = dispatch => ({
dispatch(changeComposeLanguage(value));
},

onClose (value) {
// eslint-disable-next-line react-hooks/rules-of-hooks -- this is not a react hook
dispatch(useLanguage(value));
},

});

export default connect(mapStateToProps, mapDispatchToProps)(LanguageDropdown);
4 changes: 2 additions & 2 deletions app/javascript/flavours/glitch/reducers/settings.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Map as ImmutableMap, fromJS } from 'immutable';

import { COLUMN_ADD, COLUMN_REMOVE, COLUMN_MOVE, COLUMN_PARAMS_CHANGE } from '../actions/columns';
import { COMPOSE_LANGUAGE_CHANGE } from '../actions/compose';
import { EMOJI_USE } from '../actions/emojis';
import { LANGUAGE_USE } from '../actions/languages';
import { LIST_DELETE_SUCCESS, LIST_FETCH_FAIL } from '../actions/lists';
import { NOTIFICATIONS_FILTER_SET } from '../actions/notifications';
import { SETTING_CHANGE, SETTING_SAVE } from '../actions/settings';
Expand Down Expand Up @@ -182,7 +182,7 @@ export default function settings(state = initialState, action) {
return changeColumnParams(state, action.uuid, action.path, action.value);
case EMOJI_USE:
return updateFrequentEmojis(state, action.emoji);
case LANGUAGE_USE:
case COMPOSE_LANGUAGE_CHANGE:
return updateFrequentLanguages(state, action.language);
case SETTING_SAVE:
return state.set('saved', true);
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/flavours/glitch/styles/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8112,7 +8112,7 @@ img.modal-warning {
}
}

.radio-button.checked::before {
.radio-button__input.checked::before {
position: absolute;
left: 2px;
top: 2px;
Expand Down
12 changes: 0 additions & 12 deletions app/javascript/mastodon/actions/languages.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ class LanguageDropdown extends PureComponent {
frequentlyUsedLanguages: PropTypes.arrayOf(PropTypes.string),
intl: PropTypes.object.isRequired,
onChange: PropTypes.func,
onClose: PropTypes.func,
};

state = {
Expand All @@ -257,14 +256,11 @@ class LanguageDropdown extends PureComponent {
};

handleClose = () => {
const { value, onClose } = this.props;

if (this.state.open && this.activeElement) {
this.activeElement.focus({ preventScroll: true });
}

this.setState({ open: false });
onClose(value);
};

handleChange = value => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { connect } from 'react-redux';


import { changeComposeLanguage } from 'mastodon/actions/compose';
import { useLanguage } from 'mastodon/actions/languages';

import LanguageDropdown from '../components/language_dropdown';

Expand All @@ -28,11 +27,6 @@ const mapDispatchToProps = dispatch => ({
dispatch(changeComposeLanguage(value));
},

onClose (value) {
// eslint-disable-next-line react-hooks/rules-of-hooks -- this is not a react hook
dispatch(useLanguage(value));
},

});

export default connect(mapStateToProps, mapDispatchToProps)(LanguageDropdown);
4 changes: 2 additions & 2 deletions app/javascript/mastodon/reducers/settings.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Map as ImmutableMap, fromJS } from 'immutable';

import { COLUMN_ADD, COLUMN_REMOVE, COLUMN_MOVE, COLUMN_PARAMS_CHANGE } from '../actions/columns';
import { COMPOSE_LANGUAGE_CHANGE } from '../actions/compose';
import { EMOJI_USE } from '../actions/emojis';
import { LANGUAGE_USE } from '../actions/languages';
import { LIST_DELETE_SUCCESS, LIST_FETCH_FAIL } from '../actions/lists';
import { NOTIFICATIONS_FILTER_SET } from '../actions/notifications';
import { SETTING_CHANGE, SETTING_SAVE } from '../actions/settings';
Expand Down Expand Up @@ -175,7 +175,7 @@ export default function settings(state = initialState, action) {
return changeColumnParams(state, action.uuid, action.path, action.value);
case EMOJI_USE:
return updateFrequentEmojis(state, action.emoji);
case LANGUAGE_USE:
case COMPOSE_LANGUAGE_CHANGE:
return updateFrequentLanguages(state, action.language);
case SETTING_SAVE:
return state.set('saved', true);
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/styles/mastodon/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7580,7 +7580,7 @@ a.status-card {
}
}

.radio-button.checked::before {
.radio-button__input.checked::before {
position: absolute;
left: 2px;
top: 2px;
Expand Down
Loading

0 comments on commit 664dfa6

Please sign in to comment.