Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

Commit 7a35fdd

Browse files
authored
Merge pull request #266 from YoheiZuho/3.1.2
3.1.2
2 parents 3bbf9b5 + aa8568b commit 7a35fdd

33 files changed

+570
-393
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,32 @@ Changelog
33

44
All notable changes to this project will be documented in this file.
55

6+
## [v3.1.2] - 2020-02-27
7+
### Added
8+
9+
- Add `--reset-password` option to `tootctl accounts modify` ([ThibG](https://github.com/tootsuite/mastodon/pull/13126))
10+
- Add source-mapped stacktrace to error message in web UI ([ThibG](https://github.com/tootsuite/mastodon/pull/13082))
11+
12+
### Fixed
13+
14+
- Fix dismissing an announcement twice raising an obscure error ([ThibG](https://github.com/tootsuite/mastodon/pull/13124))
15+
- Fix misleading error when attempting to re-send a pending follow request ([ThibG](https://github.com/tootsuite/mastodon/pull/13133))
16+
- Fix backups failing when files are missing from media attachments ([ThibG](https://github.com/tootsuite/mastodon/pull/13146))
17+
- Fix duplicate accounts being created when fetching an account for its key only ([ThibG](https://github.com/tootsuite/mastodon/pull/13147))
18+
- Fix `/web` redirecting to `/web/web` in web UI ([ThibG](https://github.com/tootsuite/mastodon/pull/13128))
19+
- Fix previously OStatus-based accounts not being detected as ActivityPub ([ThibG](https://github.com/tootsuite/mastodon/pull/13129))
20+
- Fix account JSON/RSS not being cacheable due to wrong mime type comparison ([ThibG](https://github.com/tootsuite/mastodon/pull/13116))
21+
- Fix old browsers crashing because of missing `finally` polyfill in web UI ([ThibG](https://github.com/tootsuite/mastodon/pull/13115))
22+
- Fix account's bio not being shown if there are no proofs/fields in admin UI ([ThibG](https://github.com/tootsuite/mastodon/pull/13075))
23+
- Fix sign-ups without checked user agreement being accepted through the web form ([ThibG](https://github.com/tootsuite/mastodon/pull/13088))
24+
- Fix non-x64 architectures not being able to build Docker image because of hardcoded Node.js architecture ([SaraSmiseth](https://github.com/tootsuite/mastodon/pull/13081))
25+
- Fix invite request input not being shown on sign-up error if left empty ([ThibG](https://github.com/tootsuite/mastodon/pull/13089))
26+
- Fix some migration hints mentioning GitLab instead of Mastodon ([saper](https://github.com/tootsuite/mastodon/pull/13084))
27+
28+
### Security
29+
30+
- Fix leak of arbitrary statuses through unfavourite action in REST API ([Gargron](https://github.com/tootsuite/mastodon/pull/13161))
31+
632
## [3.1.1] - 2020-02-10
733
### Fixed
834

Dockerfile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,25 @@ SHELL ["bash", "-c"]
55

66
# Install Node v12 (LTS)
77
ENV NODE_VER="12.14.0"
8-
RUN echo "Etc/UTC" > /etc/localtime && \
8+
RUN ARCH= && \
9+
dpkgArch="$(dpkg --print-architecture)" && \
10+
case "${dpkgArch##*-}" in \
11+
amd64) ARCH='x64';; \
12+
ppc64el) ARCH='ppc64le';; \
13+
s390x) ARCH='s390x';; \
14+
arm64) ARCH='arm64';; \
15+
armhf) ARCH='armv7l';; \
16+
i386) ARCH='x86';; \
17+
*) echo "unsupported architecture"; exit 1 ;; \
18+
esac && \
19+
echo "Etc/UTC" > /etc/localtime && \
920
apt update && \
1021
apt -y install wget python && \
1122
cd ~ && \
12-
wget https://nodejs.org/download/release/v$NODE_VER/node-v$NODE_VER-linux-x64.tar.gz && \
13-
tar xf node-v$NODE_VER-linux-x64.tar.gz && \
14-
rm node-v$NODE_VER-linux-x64.tar.gz && \
15-
mv node-v$NODE_VER-linux-x64 /opt/node
23+
wget https://nodejs.org/download/release/v$NODE_VER/node-v$NODE_VER-linux-$ARCH.tar.gz && \
24+
tar xf node-v$NODE_VER-linux-$ARCH.tar.gz && \
25+
rm node-v$NODE_VER-linux-$ARCH.tar.gz && \
26+
mv node-v$NODE_VER-linux-$ARCH /opt/node
1627

1728
# Install jemalloc
1829
ENV JE_VER="5.2.1"

Gemfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ gem 'puma', '~> 4.3'
99
gem 'rails', '~> 5.2.4'
1010
gem 'sprockets', '~> 3.7.2'
1111
gem 'thor', '~> 0.20'
12-
gem 'rack', '~> 2.1.2'
12+
gem 'rack', '~> 2.2.2'
1313

1414
gem 'thwait', '~> 0.1.0'
1515
gem 'e2mmap', '~> 0.1.0'
@@ -101,7 +101,7 @@ gem 'webpacker', '~> 4.2'
101101
gem 'webpush'
102102

103103
gem 'json-ld'
104-
gem 'json-ld-preloaded', '~> 3.0'
104+
gem 'json-ld-preloaded', '~> 3.1'
105105
gem 'rdf-normalize', '~> 0.4'
106106

107107
gem 'redcarpet', "~> 3.4.0"
@@ -110,7 +110,7 @@ group :development, :test do
110110
gem 'fabrication', '~> 2.21'
111111
gem 'fuubar', '~> 2.5'
112112
gem 'i18n-tasks', '~> 0.9', require: false
113-
gem 'pry-byebug', '~> 3.7'
113+
gem 'pry-byebug', '~> 3.8'
114114
gem 'pry-rails', '~> 0.3'
115115
gem 'rspec-rails', '~> 3.9'
116116
end
@@ -120,13 +120,13 @@ group :production, :test do
120120
end
121121

122122
group :test do
123-
gem 'capybara', '~> 3.30'
123+
gem 'capybara', '~> 3.31'
124124
gem 'climate_control', '~> 0.2'
125125
gem 'faker', '~> 2.10'
126126
gem 'microformats', '~> 4.2'
127127
gem 'rails-controller-testing', '~> 1.0'
128128
gem 'rspec-sidekiq', '~> 3.0'
129-
gem 'simplecov', '~> 0.17', require: false
129+
gem 'simplecov', '~> 0.18', require: false
130130
gem 'webmock', '~> 3.8'
131131
gem 'parallel_tests', '~> 2.30'
132132
end
@@ -138,7 +138,7 @@ group :development do
138138
gem 'binding_of_caller', '~> 0.7'
139139
gem 'bullet', '~> 6.1'
140140
gem 'letter_opener', '~> 1.7'
141-
gem 'letter_opener_web', '~> 1.3'
141+
gem 'letter_opener_web', '~> 1.4'
142142
gem 'memory_profiler'
143143
gem 'rubocop', '~> 0.79', require: false
144144
gem 'rubocop-rails', '~> 2.4', require: false

Gemfile.lock

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ GEM
127127
bundler-audit (0.6.1)
128128
bundler (>= 1.2.0, < 3)
129129
thor (~> 0.18)
130-
byebug (11.0.0)
130+
byebug (11.1.1)
131131
capistrano (3.11.2)
132132
airbrussh (>= 1.0.0)
133133
i18n
@@ -144,7 +144,7 @@ GEM
144144
sshkit (~> 1.3)
145145
capistrano-yarn (2.0.2)
146146
capistrano (~> 3.0)
147-
capybara (3.30.0)
147+
capybara (3.31.0)
148148
addressable
149149
mini_mime (>= 0.1.3)
150150
nokogiri (~> 1.8)
@@ -311,10 +311,9 @@ GEM
311311
multi_json (~> 1.14)
312312
rack (~> 2.0)
313313
rdf (~> 3.1)
314-
json-ld-preloaded (3.0.6)
315-
json-ld (~> 3.0)
316-
multi_json (~> 1.12)
317-
rdf (~> 3.0)
314+
json-ld-preloaded (3.1.0)
315+
json-ld (~> 3.1)
316+
rdf (~> 3.1)
318317
jsonapi-renderer (0.2.2)
319318
jwt (2.1.0)
320319
kaminari (1.1.1)
@@ -333,7 +332,7 @@ GEM
333332
addressable (~> 2.3)
334333
letter_opener (1.7.0)
335334
launchy (~> 2.2)
336-
letter_opener_web (1.3.4)
335+
letter_opener_web (1.4.0)
337336
actionmailer (>= 3.2)
338337
letter_opener (~> 1.0)
339338
railties (>= 3.2)
@@ -375,7 +374,7 @@ GEM
375374
net-ssh (>= 2.6.5, < 6.0.0)
376375
net-ssh (5.2.0)
377376
nio4r (2.5.2)
378-
nokogiri (1.10.7)
377+
nokogiri (1.10.8)
379378
mini_portile2 (~> 2.4.0)
380379
nokogumbo (2.0.1)
381380
nokogiri (~> 1.8, >= 1.8.4)
@@ -418,7 +417,7 @@ GEM
418417
pg (1.2.2)
419418
pghero (2.4.1)
420419
activerecord (>= 5)
421-
pkg-config (1.4.0)
420+
pkg-config (1.4.1)
422421
premailer (1.11.1)
423422
addressable
424423
css_parser (>= 1.6.0)
@@ -430,7 +429,7 @@ GEM
430429
pry (0.12.2)
431430
coderay (~> 1.1.0)
432431
method_source (~> 0.9.0)
433-
pry-byebug (3.7.0)
432+
pry-byebug (3.8.0)
434433
byebug (~> 11.0)
435434
pry (~> 0.10)
436435
pry-rails (0.3.9)
@@ -441,7 +440,7 @@ GEM
441440
pundit (2.1.0)
442441
activesupport (>= 3.0.0)
443442
raabro (1.1.6)
444-
rack (2.1.2)
443+
rack (2.2.2)
445444
rack-attack (6.2.2)
446445
rack (>= 1.0, < 3)
447446
rack-cors (1.1.1)
@@ -551,7 +550,7 @@ GEM
551550
rainbow (>= 2.2.2, < 4.0)
552551
ruby-progressbar (~> 1.7)
553552
unicode-display_width (>= 1.4.0, < 1.7)
554-
rubocop-rails (2.4.1)
553+
rubocop-rails (2.4.2)
555554
rack (>= 1.1)
556555
rubocop (>= 0.72.0)
557556
ruby-progressbar (1.10.1)
@@ -585,11 +584,10 @@ GEM
585584
simple_form (5.0.1)
586585
actionpack (>= 5.0)
587586
activemodel (>= 5.0)
588-
simplecov (0.17.1)
587+
simplecov (0.18.2)
589588
docile (~> 1.1)
590-
json (>= 1.8, < 3)
591-
simplecov-html (~> 0.10.0)
592-
simplecov-html (0.10.2)
589+
simplecov-html (~> 0.11)
590+
simplecov-html (0.12.0)
593591
sprockets (3.7.2)
594592
concurrent-ruby (~> 1.0)
595593
rack (> 1, < 3)
@@ -681,7 +679,7 @@ DEPENDENCIES
681679
capistrano-rails (~> 1.4)
682680
capistrano-rbenv (~> 2.1)
683681
capistrano-yarn (~> 2.0)
684-
capybara (~> 3.30)
682+
capybara (~> 3.31)
685683
charlock_holmes (~> 0.7.7)
686684
chewy (~> 5.1)
687685
cld3 (~> 3.2.6)
@@ -715,10 +713,10 @@ DEPENDENCIES
715713
idn-ruby
716714
iso-639
717715
json-ld
718-
json-ld-preloaded (~> 3.0)
716+
json-ld-preloaded (~> 3.1)
719717
kaminari (~> 1.1)
720718
letter_opener (~> 1.7)
721-
letter_opener_web (~> 1.3)
719+
letter_opener_web (~> 1.4)
722720
link_header (~> 0.0)
723721
lograge (~> 0.11)
724722
makara (~> 0.4)
@@ -746,11 +744,11 @@ DEPENDENCIES
746744
posix-spawn!
747745
premailer-rails
748746
private_address_check (~> 0.5)
749-
pry-byebug (~> 3.7)
747+
pry-byebug (~> 3.8)
750748
pry-rails (~> 0.3)
751749
puma (~> 4.3)
752750
pundit (~> 2.1)
753-
rack (~> 2.1.2)
751+
rack (~> 2.2.2)
754752
rack-attack (~> 6.2)
755753
rack-cors (~> 1.1)
756754
rails (~> 5.2.4)
@@ -775,7 +773,7 @@ DEPENDENCIES
775773
sidekiq-unique-jobs (~> 6.0)
776774
simple-navigation (~> 4.1)
777775
simple_form (~> 5.0)
778-
simplecov (~> 0.17)
776+
simplecov (~> 0.18)
779777
sprockets (~> 3.7.2)
780778
sprockets-rails (~> 3.2)
781779
stackprof

app/controllers/accounts_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class AccountsController < ApplicationController
99
before_action :set_cache_headers
1010
before_action :set_body_classes
1111

12-
skip_around_action :set_locale, if: -> { [:json, :rss].include?(request.format) }
12+
skip_around_action :set_locale, if: -> { [:json, :rss].include?(request.format&.to_sym) }
1313
skip_before_action :require_functional!
1414

1515
def show

app/controllers/api/v1/announcements_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def index
1111
end
1212

1313
def dismiss
14-
AnnouncementMute.create!(account: current_account, announcement: @announcement)
14+
AnnouncementMute.find_or_create_by!(account: current_account, announcement: @announcement)
1515
render_empty
1616
end
1717

app/controllers/api/v1/statuses/bookmarks_controller.rb

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,28 @@ class Api::V1::Statuses::BookmarksController < Api::BaseController
55

66
before_action -> { doorkeeper_authorize! :write, :'write:bookmarks' }
77
before_action :require_user!
8+
before_action :set_status
89

910
respond_to :json
1011

1112
def create
12-
@status = bookmarked_status
13+
current_account.bookmarks.find_or_create_by!(account: current_account, status: @status)
1314
render json: @status, serializer: REST::StatusSerializer
1415
end
1516

1617
def destroy
17-
@status = requested_status
18-
@bookmarks_map = { @status.id => false }
18+
bookmark = current_account.bookmarks.find_by(status: @status)
19+
bookmark&.destroy!
1920

20-
bookmark = Bookmark.find_by!(account: current_user.account, status: @status)
21-
bookmark.destroy!
22-
23-
render json: @status, serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new([@status], current_user&.account_id, bookmarks_map: @bookmarks_map)
21+
render json: @status, serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new([@status], current_account.id, bookmarks_map: { @status.id => false })
2422
end
2523

2624
private
2725

28-
def bookmarked_status
29-
authorize_with current_user.account, requested_status, :show?
30-
31-
bookmark = Bookmark.find_or_create_by!(account: current_user.account, status: requested_status)
32-
33-
bookmark.status.reload
34-
end
35-
36-
def requested_status
37-
Status.find(params[:status_id])
26+
def set_status
27+
@status = Status.find(params[:status_id])
28+
authorize @status, :show?
29+
rescue Mastodon::NotPermittedError
30+
not_found
3831
end
3932
end

app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ def set_status
6969
@status = Status.find(params[:status_id])
7070
authorize @status, :show?
7171
rescue Mastodon::NotPermittedError
72-
# Reraise in order to get a 404 instead of a 403 error code
73-
raise ActiveRecord::RecordNotFound
72+
not_found
7473
end
7574

7675
def pagination_params(core_params)

app/controllers/api/v1/statuses/favourites_controller.rb

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,26 @@ class Api::V1::Statuses::FavouritesController < Api::BaseController
55

66
before_action -> { doorkeeper_authorize! :write, :'write:favourites' }
77
before_action :require_user!
8+
before_action :set_status
89

910
respond_to :json
1011

1112
def create
12-
@status = favourited_status
13+
FavouriteService.new.call(current_account, @status)
1314
render json: @status, serializer: REST::StatusSerializer
1415
end
1516

1617
def destroy
17-
@status = requested_status
18-
@favourites_map = { @status.id => false }
19-
20-
UnfavouriteWorker.perform_async(current_user.account_id, @status.id)
21-
22-
render json: @status, serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new([@status], current_user&.account_id, favourites_map: @favourites_map)
18+
UnfavouriteWorker.perform_async(current_account.id, @status.id)
19+
render json: @status, serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new([@status], current_account.id, favourites_map: { @status.id => false })
2320
end
2421

2522
private
2623

27-
def favourited_status
28-
service_result.status.reload
29-
end
30-
31-
def service_result
32-
FavouriteService.new.call(current_user.account, requested_status)
33-
end
34-
35-
def requested_status
36-
Status.find(params[:status_id])
24+
def set_status
25+
@status = Status.find(params[:status_id])
26+
authorize @status, :show?
27+
rescue Mastodon::NotPermittedError
28+
not_found
3729
end
3830
end

app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ def set_status
6666
@status = Status.find(params[:status_id])
6767
authorize @status, :show?
6868
rescue Mastodon::NotPermittedError
69-
# Reraise in order to get a 404 instead of a 403 error code
70-
raise ActiveRecord::RecordNotFound
69+
not_found
7170
end
7271

7372
def pagination_params(core_params)

0 commit comments

Comments
 (0)