diff --git a/Gemfile b/Gemfile
index 865d28a266..7f400d2a06 100644
--- a/Gemfile
+++ b/Gemfile
@@ -17,7 +17,7 @@ gem 'makara', '~> 0.4'
gem 'pghero', '~> 2.7'
gem 'dotenv-rails', '~> 2.7'
-gem 'aws-sdk-s3', '~> 1.84', require: false
+gem 'aws-sdk-s3', '~> 1.85', require: false
gem 'fog-core', '<= 2.1.0'
gem 'fog-openstack', '~> 0.3', require: false
gem 'paperclip', '~> 6.0'
@@ -125,7 +125,7 @@ group :test do
gem 'rspec-sidekiq', '~> 3.1'
gem 'simplecov', '~> 0.19', require: false
gem 'webmock', '~> 3.10'
- gem 'parallel_tests', '~> 3.3'
+ gem 'parallel_tests', '~> 3.4'
gem 'rspec_junit_formatter', '~> 0.4'
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 341e9c4bc5..f32fdec5f2 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -79,8 +79,8 @@ GEM
cocaine (~> 0.5.3)
awrence (1.1.1)
aws-eventstream (1.1.0)
- aws-partitions (1.393.0)
- aws-sdk-core (3.109.2)
+ aws-partitions (1.397.0)
+ aws-sdk-core (3.109.3)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
@@ -88,7 +88,7 @@ GEM
aws-sdk-kms (1.39.0)
aws-sdk-core (~> 3, >= 3.109.0)
aws-sigv4 (~> 1.1)
- aws-sdk-s3 (1.84.1)
+ aws-sdk-s3 (1.85.0)
aws-sdk-core (~> 3, >= 3.109.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
@@ -391,8 +391,8 @@ GEM
paperclip-av-transcoder (0.6.4)
av (~> 0.9.0)
paperclip (>= 2.5.2)
- parallel (1.20.0)
- parallel_tests (3.3.0)
+ parallel (1.20.1)
+ parallel_tests (3.4.0)
parallel
parser (2.7.2.0)
ast (~> 2.4.1)
@@ -479,7 +479,7 @@ GEM
rdf-normalize (0.4.0)
rdf (~> 3.1)
redcarpet (3.5.0)
- redis (4.2.2)
+ redis (4.2.5)
redis-actionpack (5.2.0)
actionpack (>= 5, < 7)
redis-rack (>= 2.1.0, < 3)
@@ -533,7 +533,7 @@ GEM
rspec-support (3.9.3)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
- rubocop (1.3.0)
+ rubocop (1.3.1)
parallel (~> 1.10)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
@@ -678,7 +678,7 @@ DEPENDENCIES
active_record_query_trace (~> 1.8)
addressable (~> 2.7)
annotate (~> 3.1)
- aws-sdk-s3 (~> 1.84)
+ aws-sdk-s3 (~> 1.85)
better_errors (~> 2.9)
binding_of_caller (~> 0.7)
blurhash (~> 0.1)
@@ -747,7 +747,7 @@ DEPENDENCIES
paperclip (~> 6.0)
paperclip-av-transcoder (~> 0.6)
parallel (~> 1.20)
- parallel_tests (~> 3.3)
+ parallel_tests (~> 3.4)
parslet
pg (~> 1.2)
pghero (~> 2.7)
diff --git a/app/controllers/api/v1/statuses/favourites_controller.rb b/app/controllers/api/v1/statuses/favourites_controller.rb
index 7afa822ed8..2e21ce6a06 100644
--- a/app/controllers/api/v1/statuses/favourites_controller.rb
+++ b/app/controllers/api/v1/statuses/favourites_controller.rb
@@ -5,7 +5,7 @@ class Api::V1::Statuses::FavouritesController < Api::BaseController
before_action -> { doorkeeper_authorize! :write, :'write:favourites' }
before_action :require_user!
- before_action :set_status
+ before_action :set_status, only: [:create]
def create
FavouriteService.new.call(current_account, @status)
@@ -13,8 +13,19 @@ class Api::V1::Statuses::FavouritesController < Api::BaseController
end
def destroy
- UnfavouriteWorker.perform_async(current_account.id, @status.id)
+ fav = current_account.favourites.find_by(status_id: params[:status_id])
+
+ if fav
+ @status = fav.status
+ UnfavouriteWorker.perform_async(current_account.id, @status.id)
+ else
+ @status = Status.find(params[:status_id])
+ authorize @status, :show?
+ end
+
render json: @status, serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new([@status], current_account.id, favourites_map: { @status.id => false })
+ rescue Mastodon::NotPermittedError
+ not_found
end
private
diff --git a/app/javascript/mastodon/actions/notifications.js b/app/javascript/mastodon/actions/notifications.js
index d40b65745b..93e18fba92 100644
--- a/app/javascript/mastodon/actions/notifications.js
+++ b/app/javascript/mastodon/actions/notifications.js
@@ -257,7 +257,7 @@ export function setupBrowserNotifications() {
if ('Notification' in window && 'permissions' in navigator) {
navigator.permissions.query({ name: 'notifications' }).then((status) => {
status.onchange = () => dispatch(setBrowserPermission(Notification.permission));
- });
+ }).catch(console.warn);
}
};
}
diff --git a/app/javascript/mastodon/components/modal_root.js b/app/javascript/mastodon/components/modal_root.js
index 6297b5e293..fe573ffdaf 100644
--- a/app/javascript/mastodon/components/modal_root.js
+++ b/app/javascript/mastodon/components/modal_root.js
@@ -9,11 +9,7 @@ export default class ModalRoot extends React.PureComponent {
onClose: PropTypes.func.isRequired,
};
- state = {
- revealed: !!this.props.children,
- };
-
- activeElement = this.state.revealed ? document.activeElement : null;
+ activeElement = this.props.children ? document.activeElement : null;
handleKeyUp = (e) => {
if ((e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27)
@@ -53,8 +49,6 @@ export default class ModalRoot extends React.PureComponent {
this.activeElement = document.activeElement;
this.getSiblings().forEach(sibling => sibling.setAttribute('inert', true));
- } else if (!nextProps.children) {
- this.setState({ revealed: false });
}
}
@@ -72,11 +66,6 @@ export default class ModalRoot extends React.PureComponent {
console.error(error);
});
}
- if (this.props.children) {
- requestAnimationFrame(() => {
- this.setState({ revealed: true });
- });
- }
}
componentWillUnmount () {
@@ -94,7 +83,6 @@ export default class ModalRoot extends React.PureComponent {
render () {
const { children, onClose } = this.props;
- const { revealed } = this.state;
const visible = !!children;
if (!visible) {
@@ -104,7 +92,7 @@ export default class ModalRoot extends React.PureComponent {
}
return (
-
+
{children}
diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js
index f4ed25f1eb..8f288bdf9b 100644
--- a/app/javascript/mastodon/components/status.js
+++ b/app/javascript/mastodon/components/status.js
@@ -391,6 +391,7 @@ class Status extends ImmutablePureComponent {
{Component => (