Browse Source

Merge tag 'v2.4.0rc1' into asonix/changes

Riley Trautman 1 year ago
parent
commit
356b0d1740
100 changed files with 1999 additions and 845 deletions
  1. 191
    0
      .circleci/config.yml
  2. 1
    0
      .dockerignore
  3. 3
    3
      .env.nanobox
  4. 13
    0
      .env.production.sample
  5. 6
    0
      .env.test
  6. 3
    0
      .eslintrc.yml
  7. 2
    1
      .gitignore
  8. 0
    59
      .travis.yml
  9. 5
    0
      CONTRIBUTING.md
  10. 1
    1
      Dockerfile
  11. 51
    45
      Gemfile
  12. 261
    231
      Gemfile.lock
  13. 2
    2
      README.md
  14. 8
    2
      app/controllers/accounts_controller.rb
  15. 1
    1
      app/controllers/activitypub/collections_controller.rb
  16. 45
    9
      app/controllers/activitypub/outboxes_controller.rb
  17. 12
    1
      app/controllers/admin/accounts_controller.rb
  18. 49
    0
      app/controllers/admin/change_emails_controller.rb
  19. 19
    0
      app/controllers/admin/confirmations_controller.rb
  20. 56
    0
      app/controllers/admin/report_notes_controller.rb
  21. 12
    21
      app/controllers/admin/reported_statuses_controller.rb
  22. 26
    10
      app/controllers/admin/reports_controller.rb
  23. 12
    25
      app/controllers/admin/statuses_controller.rb
  24. 3
    1
      app/controllers/api/base_controller.rb
  25. 13
    1
      app/controllers/api/v1/accounts/credentials_controller.rb
  26. 1
    1
      app/controllers/api/v1/accounts/follower_accounts_controller.rb
  27. 1
    1
      app/controllers/api/v1/accounts/following_accounts_controller.rb
  28. 1
    1
      app/controllers/api/v1/accounts/statuses_controller.rb
  29. 5
    0
      app/controllers/api/v1/accounts_controller.rb
  30. 1
    1
      app/controllers/api/v1/blocks_controller.rb
  31. 1
    1
      app/controllers/api/v1/domain_blocks_controller.rb
  32. 1
    1
      app/controllers/api/v1/favourites_controller.rb
  33. 1
    1
      app/controllers/api/v1/follow_requests_controller.rb
  34. 1
    1
      app/controllers/api/v1/lists/accounts_controller.rb
  35. 1
    1
      app/controllers/api/v1/mutes_controller.rb
  36. 1
    1
      app/controllers/api/v1/notifications_controller.rb
  37. 1
    1
      app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb
  38. 2
    2
      app/controllers/api/v1/statuses/pins_controller.rb
  39. 1
    1
      app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb
  40. 3
    3
      app/controllers/api/v1/statuses_controller.rb
  41. 60
    0
      app/controllers/api/v1/timelines/direct_controller.rb
  42. 1
    1
      app/controllers/api/v1/timelines/home_controller.rb
  43. 1
    1
      app/controllers/api/v1/timelines/list_controller.rb
  44. 1
    1
      app/controllers/api/v1/timelines/public_controller.rb
  45. 1
    1
      app/controllers/api/v1/timelines/tag_controller.rb
  46. 9
    0
      app/controllers/api/web/base_controller.rb
  47. 8
    5
      app/controllers/api/web/embeds_controller.rb
  48. 17
    11
      app/controllers/api/web/push_subscriptions_controller.rb
  49. 1
    1
      app/controllers/api/web/settings_controller.rb
  50. 2
    2
      app/controllers/application_controller.rb
  51. 6
    2
      app/controllers/concerns/localized.rb
  52. 21
    0
      app/controllers/concerns/remote_account_controller_concern.rb
  53. 16
    14
      app/controllers/follower_accounts_controller.rb
  54. 16
    14
      app/controllers/following_accounts_controller.rb
  55. 5
    0
      app/controllers/home_controller.rb
  56. 39
    0
      app/controllers/remote_unfollows.rb
  57. 1
    3
      app/controllers/settings/follower_domains_controller.rb
  58. 4
    2
      app/controllers/settings/profiles_controller.rb
  59. 79
    2
      app/controllers/statuses_controller.rb
  60. 2
    2
      app/controllers/stream_entries_controller.rb
  61. 10
    1
      app/controllers/tags_controller.rb
  62. 16
    0
      app/helpers/admin/account_moderation_notes_helper.rb
  63. 4
    2
      app/helpers/admin/action_logs_helper.rb
  64. 4
    0
      app/helpers/application_helper.rb
  65. 23
    4
      app/helpers/jsonld_helper.rb
  66. 5
    1
      app/helpers/settings_helper.rb
  67. 21
    8
      app/helpers/stream_entries_helper.rb
  68. 39
    4
      app/javascript/mastodon/actions/accounts.js
  69. 25
    0
      app/javascript/mastodon/actions/alerts.js
  70. 3
    0
      app/javascript/mastodon/actions/blocks.js
  71. 40
    27
      app/javascript/mastodon/actions/compose.js
  72. 37
    0
      app/javascript/mastodon/actions/custom_emojis.js
  73. 57
    9
      app/javascript/mastodon/actions/domain_blocks.js
  74. 3
    0
      app/javascript/mastodon/actions/favourites.js
  75. 77
    0
      app/javascript/mastodon/actions/importer/index.js
  76. 63
    0
      app/javascript/mastodon/actions/importer/normalizer.js
  77. 21
    18
      app/javascript/mastodon/actions/interactions.js
  78. 10
    5
      app/javascript/mastodon/actions/lists.js
  79. 3
    0
      app/javascript/mastodon/actions/mutes.js
  80. 39
    87
      app/javascript/mastodon/actions/notifications.js
  81. 2
    0
      app/javascript/mastodon/actions/pin_statuses.js
  82. 13
    21
      app/javascript/mastodon/actions/push_notifications/registerer.js
  83. 9
    2
      app/javascript/mastodon/actions/search.js
  84. 4
    1
      app/javascript/mastodon/actions/settings.js
  85. 65
    5
      app/javascript/mastodon/actions/statuses.js
  86. 2
    0
      app/javascript/mastodon/actions/store.js
  87. 5
    9
      app/javascript/mastodon/actions/streaming.js
  88. 18
    97
      app/javascript/mastodon/actions/timelines.js
  89. 21
    0
      app/javascript/mastodon/base_polyfills.js
  90. 10
    0
      app/javascript/mastodon/compare_id.js
  91. 11
    13
      app/javascript/mastodon/components/autosuggest_textarea.js
  92. 42
    0
      app/javascript/mastodon/components/domain.js
  93. 43
    5
      app/javascript/mastodon/components/dropdown_menu.js
  94. 33
    0
      app/javascript/mastodon/components/load_gap.js
  95. 3
    2
      app/javascript/mastodon/components/load_more.js
  96. 1
    5
      app/javascript/mastodon/components/media_gallery.js
  97. 84
    0
      app/javascript/mastodon/components/modal_root.js
  98. 11
    4
      app/javascript/mastodon/components/relative_timestamp.js
  99. 15
    23
      app/javascript/mastodon/components/scrollable_list.js
  100. 0
    0
      app/javascript/mastodon/components/status.js

+ 191
- 0
.circleci/config.yml View File

@@ -0,0 +1,191 @@
1
+version: 2
2
+
3
+aliases:
4
+  - &defaults
5
+    docker:
6
+      - image: circleci/ruby:2.5.1-stretch-node
7
+        environment: &ruby_environment
8
+          BUNDLE_APP_CONFIG: ./.bundle/
9
+          DB_HOST: localhost
10
+          DB_USER: root
11
+          RAILS_ENV: test
12
+          PARALLEL_TEST_PROCESSORS: 4
13
+          ALLOW_NOPAM: true
14
+    working_directory: ~/projects/mastodon/
15
+
16
+  - &attach_workspace
17
+    attach_workspace:
18
+      at: ~/projects/
19
+
20
+  - &persist_to_workspace
21
+    persist_to_workspace:
22
+      root: ~/projects/
23
+      paths:
24
+        - ./mastodon/
25
+
26
+  - &restore_ruby_dependencies
27
+    restore_cache:
28
+      keys:
29
+        - v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
30
+        - v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-
31
+        - v2-ruby-dependencies-
32
+
33
+  - &install_steps
34
+    steps:
35
+      - checkout
36
+      - *attach_workspace
37
+
38
+      - restore_cache:
39
+          keys:
40
+            - v1-node-dependencies-{{ checksum "yarn.lock" }}
41
+            - v1-node-dependencies-
42
+      - run: yarn install --frozen-lockfile
43
+      - save_cache:
44
+          key: v1-node-dependencies-{{ checksum "yarn.lock" }}
45
+          paths:
46
+            - ./node_modules/
47
+
48
+      - *persist_to_workspace
49
+
50
+  - &install_system_dependencies
51
+      run:
52
+        name: Install system dependencies
53
+        command: |
54
+          sudo apt-get update
55
+          sudo apt-get install -y libicu-dev libidn11-dev libprotobuf-dev protobuf-compiler
56
+
57
+  - &install_ruby_dependencies
58
+      steps:
59
+        - *attach_workspace
60
+
61
+        - *install_system_dependencies
62
+
63
+        - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
64
+        - *restore_ruby_dependencies
65
+        - run: bundle install --clean --jobs 16 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without development production
66
+        - save_cache:
67
+            key: v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
68
+            paths:
69
+              - ./.bundle/
70
+              - ./vendor/bundle/
71
+
72
+  - &test_steps
73
+      steps:
74
+        - *attach_workspace
75
+
76
+        - *install_system_dependencies
77
+        - run: sudo apt-get install -y ffmpeg
78
+
79
+        - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
80
+        - *restore_ruby_dependencies
81
+
82
+        - restore_cache:
83
+            keys:
84
+              - precompiled-assets-{{ .Branch }}-{{ .Revision }}
85
+              - precompiled-assets-{{ .Branch }}-
86
+              - precompiled-assets-
87
+
88
+        - run:
89
+            name: Prepare Tests
90
+            command: ./bin/rails parallel:create parallel:load_schema parallel:prepare
91
+        - run:
92
+            name: Run Tests
93
+            command: ./bin/retry bundle exec parallel_test ./spec/ --group-by filesize --type rspec
94
+
95
+jobs:
96
+  install:
97
+    <<: *defaults
98
+    <<: *install_steps
99
+
100
+  install-ruby2.5:
101
+    <<: *defaults
102
+    <<: *install_ruby_dependencies
103
+
104
+  install-ruby2.4:
105
+    <<: *defaults
106
+    docker:
107
+      - image: circleci/ruby:2.4.4-stretch-node
108
+        environment: *ruby_environment
109
+    <<: *install_ruby_dependencies
110
+
111
+  build:
112
+    <<: *defaults
113
+    steps:
114
+      - *attach_workspace
115
+      - *install_system_dependencies
116
+      - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
117
+      - *restore_ruby_dependencies
118
+      - run: ./bin/rails assets:precompile
119
+      - save_cache:
120
+          key: precompiled-assets-{{ .Branch }}-{{ .Revision }}
121
+          paths:
122
+            - ./public/assets
123
+            - ./public/packs-test/
124
+
125
+  test-ruby2.5:
126
+    <<: *defaults
127
+    docker:
128
+      - image: circleci/ruby:2.5.1-stretch-node
129
+        environment: *ruby_environment
130
+      - image: circleci/postgres:10.3-alpine
131
+        environment:
132
+          POSTGRES_USER: root
133
+      - image: circleci/redis:4.0.9-alpine
134
+    <<: *test_steps
135
+
136
+  test-ruby2.4:
137
+    <<: *defaults
138
+    docker:
139
+      - image: circleci/ruby:2.4.4-stretch-node
140
+        environment: *ruby_environment
141
+      - image: circleci/postgres:10.3-alpine
142
+        environment:
143
+          POSTGRES_USER: root
144
+      - image: circleci/redis:4.0.9-alpine
145
+    <<: *test_steps
146
+
147
+  test-webui:
148
+    <<: *defaults
149
+    docker:
150
+      - image: circleci/node:8.11.1-stretch
151
+    steps:
152
+      - *attach_workspace
153
+      - run: ./bin/retry yarn test:jest
154
+
155
+  check-i18n:
156
+    <<: *defaults
157
+    steps:
158
+      - *attach_workspace
159
+      - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
160
+      - *restore_ruby_dependencies
161
+      - run: bundle exec i18n-tasks check-normalized
162
+      - run: bundle exec i18n-tasks unused
163
+
164
+workflows:
165
+  version: 2
166
+  build-and-test:
167
+    jobs:
168
+      - install
169
+      - install-ruby2.5:
170
+          requires:
171
+            - install
172
+      - install-ruby2.4:
173
+          requires:
174
+            - install
175
+      - build:
176
+          requires:
177
+            - install-ruby2.5
178
+      - test-ruby2.5:
179
+          requires:
180
+            - install-ruby2.5
181
+            - build
182
+      - test-ruby2.4:
183
+          requires:
184
+            - install-ruby2.4
185
+            - build
186
+      - test-webui:
187
+          requires:
188
+            - install
189
+      - check-i18n:
190
+          requires:
191
+            - install-ruby2.5

+ 1
- 0
.dockerignore View File

@@ -11,3 +11,4 @@ vendor/bundle
11 11
 *~
12 12
 postgres
13 13
 redis
14
+elasticsearch

+ 3
- 3
.env.nanobox View File

@@ -14,9 +14,9 @@ DB_PORT=5432
14 14
 DATABASE_URL=postgresql://$DATA_DB_USER:$DATA_DB_PASS@$DATA_DB_HOST/gonano
15 15
 
16 16
 # Optional ElasticSearch configuration
17
-# ES_ENABLED=true
18
-# ES_HOST=localhost
19
-# ES_PORT=9200
17
+ES_ENABLED=true
18
+ES_HOST=$DATA_ELASTIC_HOST
19
+ES_PORT=9200
20 20
 
21 21
 # Optimizations
22 22
 LD_PRELOAD=/data/lib/libjemalloc.so

+ 13
- 0
.env.production.sample View File

@@ -81,6 +81,10 @@ SMTP_FROM_ADDRESS=notifications@example.com
81 81
 # PAPERCLIP_ROOT_URL=/system
82 82
 
83 83
 # Optional asset host for multi-server setups
84
+# The asset host must allow cross origin request from WEB_DOMAIN or LOCAL_DOMAIN
85
+# if WEB_DOMAIN is not set. For example, the server may have the
86
+# following header field:
87
+# Access-Control-Allow-Origin: https://example.com/
84 88
 # CDN_HOST=https://assets.example.com
85 89
 
86 90
 # S3 (optional)
@@ -109,6 +113,8 @@ SMTP_FROM_ADDRESS=notifications@example.com
109 113
 # For Keystone V3, the value for SWIFT_TENANT should be the project name
110 114
 # SWIFT_TENANT=
111 115
 # SWIFT_PASSWORD=
116
+# Some OpenStack V3 providers require PROJECT_ID (optional)
117
+# SWIFT_PROJECT_ID=
112 118
 # Keystone V2 and V3 URLs are supported. Use a V3 URL if possible to avoid
113 119
 # issues with token rate-limiting during high load.
114 120
 # SWIFT_AUTH_URL=
@@ -210,3 +216,10 @@ STREAMING_CLUSTER_NUM=1
210 216
 # SAML_UID_ATTRIBUTE="urn:oid:0.9.2342.19200300.100.1.1"
211 217
 # SAML_ATTRIBUTES_STATEMENTS_VERIFIED=
212 218
 # SAML_ATTRIBUTES_STATEMENTS_VERIFIED_EMAIL=
219
+
220
+# Use HTTP proxy for outgoing request (optional)
221
+# http_proxy=http://gateway.local:8118
222
+# Access control for hidden service.
223
+# ALLOW_ACCESS_TO_HIDDEN_SERVICE=true
224
+# If you use transparent proxy to access to hidden service, uncomment following for skipping private address check.
225
+# HIDDEN_SERVICE_VIA_TRANSPARENT_PROXY=true

+ 6
- 0
.env.test View File

@@ -1,3 +1,9 @@
1
+# Node.js
2
+NODE_ENV=test
1 3
 # Federation
2 4
 LOCAL_DOMAIN=cb6e6126.ngrok.io
3 5
 LOCAL_HTTPS=true
6
+# test pam authentication
7
+PAM_ENABLED=true
8
+PAM_DEFAULT_SERVICE=pam_test
9
+PAM_CONTROLLED_SERVICE=pam_test_controlled

+ 3
- 0
.eslintrc.yml View File

@@ -13,6 +13,7 @@ plugins:
13 13
 - react
14 14
 - jsx-a11y
15 15
 - import
16
+- promise
16 17
 
17 18
 parserOptions:
18 19
   sourceType: module
@@ -152,3 +153,5 @@ rules:
152 153
     - "app/javascript/**/__tests__/**"
153 154
   import/no-unresolved: error
154 155
   import/no-webpack-loader-syntax: error
156
+
157
+  promise/catch-or-return: error

+ 2
- 1
.gitignore View File

@@ -36,9 +36,10 @@ config/deploy/*
36 36
 .vscode/
37 37
 .idea/
38 38
 
39
-# Ignore postgres + redis volume optionally created by docker-compose
39
+# Ignore postgres + redis + elasticsearch volume optionally created by docker-compose
40 40
 postgres
41 41
 redis
42
+elasticsearch
42 43
 
43 44
 # Ignore Apple files
44 45
 .DS_Store

+ 0
- 59
.travis.yml View File

@@ -1,59 +0,0 @@
1
-language: ruby
2
-cache:
3
-  bundler: true
4
-  yarn: true
5
-  directories:
6
-    - node_modules
7
-    - public/assets
8
-    - public/packs-test
9
-    - tmp/cache/babel-loader
10
-dist: trusty
11
-sudo: false
12
-branches:
13
-  only:
14
-    - master
15
-
16
-notifications:
17
-  email: false
18
-
19
-env:
20
-  global:
21
-    - LOCAL_DOMAIN=cb6e6126.ngrok.io
22
-    - LOCAL_HTTPS=true
23
-    - RAILS_ENV=test
24
-    - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
25
-    - PARALLEL_TEST_PROCESSORS=2
26
-
27
-addons:
28
-  postgresql: 9.4
29
-  apt:
30
-    sources:
31
-      - trusty-media
32
-      - sourceline: deb https://dl.yarnpkg.com/debian/ stable main
33
-        key_url: https://dl.yarnpkg.com/debian/pubkey.gpg
34
-    packages:
35
-      - ffmpeg
36
-      - libicu-dev
37
-      - libprotobuf-dev
38
-      - protobuf-compiler
39
-      - yarn
40
-
41
-rvm:
42
-  - 2.4.2
43
-  - 2.5.0
44
-
45
-services:
46
-  - redis-server
47
-
48
-install:
49
-  - nvm install
50
-  - bundle install --path=vendor/bundle --without development production --retry=3 --jobs=16
51
-  - yarn install
52
-
53
-before_script:
54
-  - ./bin/rails parallel:create parallel:load_schema parallel:prepare assets:precompile
55
-
56
-script:
57
-  - travis_retry bundle exec parallel_test spec/ --group-by filesize --type rspec
58
-  - yarn run test:jest
59
-  - bundle exec i18n-tasks check-normalized && bundle exec i18n-tasks unused

+ 5
- 0
CONTRIBUTING.md View File

@@ -49,3 +49,8 @@ It is expected that you have a working development environment set up (see back-
49 49
 * If you are introducing new strings, they must be using localization methods
50 50
 
51 51
 If the JavaScript or CSS assets won't compile due to a syntax error, it's a good sign that the pull request isn't ready for submission yet.
52
+
53
+## Translate
54
+
55
+You can contribute to translating Mastodon via Weblate at [weblate.joinmastodon.org](https://weblate.joinmastodon.org/).
56
+[![Mastodon translation statistics by language](https://weblate.joinmastodon.org/widgets/mastodon/-/multi-auto.svg)](https://weblate.joinmastodon.org/)

+ 1
- 1
Dockerfile View File

@@ -1,4 +1,4 @@
1
-FROM ruby:2.4.3-alpine3.6
1
+FROM ruby:2.4.4-alpine3.6
2 2
 
3 3
 LABEL maintainer="https://github.com/tootsuite/mastodon" \
4 4
       description="Your self-hosted, globally interconnected microblogging community"

+ 51
- 45
Gemfile View File

@@ -3,29 +3,29 @@
3 3
 source 'https://rubygems.org'
4 4
 ruby '>= 2.3.0', '< 2.6.0'
5 5
 
6
-gem 'pkg-config', '~> 1.2'
6
+gem 'pkg-config', '~> 1.3'
7 7
 
8
-gem 'puma', '~> 3.10'
9
-gem 'rails', '~> 5.1.4'
8
+gem 'puma', '~> 3.11'
9
+gem 'rails', '~> 5.2.0'
10 10
 
11 11
 gem 'hamlit-rails', '~> 0.2'
12
-gem 'pg', '~> 0.20'
13
-gem 'pghero', '~> 1.7'
14
-gem 'dotenv-rails', '~> 2.2'
12
+gem 'pg', '~> 1.0'
13
+gem 'pghero', '~> 2.1'
14
+gem 'dotenv-rails', '~> 2.2', '< 2.3'
15 15
 
16
-gem 'aws-sdk', '~> 2.10', require: false
16
+gem 'aws-sdk-s3', '~> 1.9', require: false
17 17
 gem 'fog-core', '~> 1.45'
18
-gem 'fog-local', '~> 0.4', require: false
18
+gem 'fog-local', '~> 0.5', require: false
19 19
 gem 'fog-openstack', '~> 0.1', require: false
20
-gem 'paperclip', '~> 5.1'
20
+gem 'paperclip', '~> 6.0'
21 21
 gem 'paperclip-av-transcoder', '~> 0.6'
22 22
 gem 'streamio-ffmpeg', '~> 3.0'
23 23
 
24 24
 gem 'active_model_serializers', '~> 0.10'
25 25
 gem 'addressable', '~> 2.5'
26
-gem 'bootsnap'
26
+gem 'bootsnap', '~> 1.3'
27 27
 gem 'browser'
28
-gem 'charlock_holmes', '~> 0.7.5'
28
+gem 'charlock_holmes', '~> 0.7.6'
29 29
 gem 'iso-639'
30 30
 gem 'chewy', '~> 5.0'
31 31
 gem 'cld3', '~> 3.2.0'
@@ -33,67 +33,70 @@ gem 'devise', '~> 4.4'
33 33
 gem 'devise-two-factor', '~> 3.0'
34 34
 
35 35
 group :pam_authentication, optional: true do
36
-  gem 'devise_pam_authenticatable2', '~> 9.0'
36
+  gem 'devise_pam_authenticatable2', '~> 9.1'
37 37
 end
38
+
38 39
 gem 'net-ldap', '~> 0.10'
39 40
 gem 'omniauth-cas', '~> 1.1'
40 41
 gem 'omniauth-saml', '~> 1.10'
41 42
 gem 'omniauth', '~> 1.2'
42 43
 
43
-gem 'doorkeeper', '~> 4.2'
44
+gem 'doorkeeper', '~> 4.3'
44 45
 gem 'fast_blank', '~> 1.0'
45 46
 gem 'fastimage'
46 47
 gem 'goldfinger', '~> 2.1'
47 48
 gem 'hiredis', '~> 0.6'
48 49
 gem 'redis-namespace', '~> 1.5'
49 50
 gem 'htmlentities', '~> 4.3'
50
-gem 'http', '~> 3.0'
51
+gem 'http', '~> 3.2'
51 52
 gem 'http_accept_language', '~> 2.1'
52
-gem 'httplog', '~> 0.99'
53
+gem 'httplog', '~> 1.0'
53 54
 gem 'idn-ruby', require: 'idn'
54 55
 gem 'kaminari', '~> 1.1'
55 56
 gem 'link_header', '~> 0.0'
56
-gem 'mime-types', '~> 3.1'
57
+gem 'mime-types', '~> 3.1', require: 'mime/types/columnar'
57 58
 gem 'nokogiri', '~> 1.8'
58 59
 gem 'nsa', '~> 0.2'
59
-gem 'oj', '~> 3.3'
60
+gem 'oj', '~> 3.5'
60 61
 gem 'ostatus2', '~> 2.0'
61
-gem 'ox', '~> 2.8'
62
+gem 'ox', '~> 2.9'
63
+gem 'posix-spawn', '~> 0.3'
62 64
 gem 'pundit', '~> 1.1'
63 65
 gem 'premailer-rails'
64
-gem 'rack-attack', '~> 5.0'
65
-gem 'rack-cors', '~> 0.4', require: 'rack/cors'
66
+gem 'rack-attack', '~> 5.2'
67
+gem 'rack-cors', '~> 1.0', require: 'rack/cors'
66 68
 gem 'rack-timeout', '~> 0.4'
67
-gem 'rails-i18n', '~> 5.0'
69
+gem 'rails-i18n', '~> 5.1'
68 70
 gem 'rails-settings-cached', '~> 0.6'
69
-gem 'redis', '~> 3.3', require: ['redis', 'redis/connection/hiredis']
71
+gem 'redis', '~> 4.0', require: ['redis', 'redis/connection/hiredis']
70 72
 gem 'mario-redis-lock', '~> 1.2', require: 'redis_lock'
71 73
 gem 'rqrcode', '~> 0.10'
72
-gem 'ruby-oembed', '~> 0.12', require: 'oembed'
73 74
 gem 'ruby-progressbar', '~> 1.4'
74
-gem 'sanitize', '~> 4.6.4'
75
-gem 'sidekiq', '~> 5.0'
76
-gem 'sidekiq-scheduler', '~> 2.1'
75
+gem 'sanitize', '~> 4.6'
76
+gem 'sidekiq', '~> 5.1'
77
+gem 'sidekiq-scheduler', '~> 2.2'
77 78
 gem 'sidekiq-unique-jobs', '~> 5.0'
78 79
 gem 'sidekiq-bulk', '~>0.1.1'
79 80
 gem 'simple-navigation', '~> 4.0'
80
-gem 'simple_form', '~> 3.4'
81
+gem 'simple_form', '~> 4.0'
81 82
 gem 'sprockets-rails', '~> 3.2', require: 'sprockets/railtie'
82
-gem 'strong_migrations'
83
-gem 'tty-command'
84
-gem 'tty-prompt'
83
+gem 'stoplight', '~> 2.1.3'
84
+gem 'strong_migrations', '~> 0.2'
85
+gem 'tty-command', '~> 0.8', require: false
86
+gem 'tty-prompt', '~> 0.16', require: false
85 87
 gem 'twitter-text', '~> 1.14'
86
-gem 'tzinfo-data', '~> 1.2017'
87
-gem 'webpacker', '~> 3.0'
88
+gem 'tzinfo-data', '~> 1.2018'
89
+gem 'webpacker', '~> 3.4'
88 90
 gem 'webpush'
89 91
 
90
-gem 'json-ld-preloaded', '~> 2.2.1'
91
-gem 'rdf-normalize', '~> 0.3.1'
92
+gem 'json-ld', '~> 2.2'
93
+gem 'rdf-normalize', '~> 0.3'
92 94
 
93 95
 group :development, :test do
94
-  gem 'fabrication', '~> 2.18'
96
+  gem 'fabrication', '~> 2.20'
95 97
   gem 'fuubar', '~> 2.2'
96 98
   gem 'i18n-tasks', '~> 0.9', require: false
99
+  gem 'pry-byebug', '~> 3.6'
97 100
   gem 'pry-rails', '~> 0.3'
98 101
   gem 'rspec-rails', '~> 3.7'
99 102
 end
@@ -103,15 +106,15 @@ group :production, :test do
103 106
 end
104 107
 
105 108
 group :test do
106
-  gem 'capybara', '~> 2.15'
109
+  gem 'capybara', '~> 2.18'
107 110
   gem 'climate_control', '~> 0.2'
108
-  gem 'faker', '~> 1.7'
111
+  gem 'faker', '~> 1.8'
109 112
   gem 'microformats', '~> 4.0'
110 113
   gem 'rails-controller-testing', '~> 1.0'
111 114
   gem 'rspec-sidekiq', '~> 3.0'
112
-  gem 'simplecov', '~> 0.14', require: false
113
-  gem 'webmock', '~> 3.0'
114
-  gem 'parallel_tests', '~> 2.17'
115
+  gem 'simplecov', '~> 0.16', require: false
116
+  gem 'webmock', '~> 3.3'
117
+  gem 'parallel_tests', '~> 2.21'
115 118
 end
116 119
 
117 120
 group :development do
@@ -119,22 +122,25 @@ group :development do
119 122
   gem 'annotate', '~> 2.7'
120 123
   gem 'better_errors', '~> 2.4'
121 124
   gem 'binding_of_caller', '~> 0.7'
122
-  gem 'bullet', '~> 5.5'
125
+  gem 'bullet', '~> 5.7'
123 126
   gem 'letter_opener', '~> 1.4'
124 127
   gem 'letter_opener_web', '~> 1.3'
125 128
   gem 'memory_profiler'
126
-  gem 'rubocop', require: false
127
-  gem 'brakeman', '~> 4.0', require: false
129
+  gem 'rubocop', '~> 0.55', require: false
130
+  gem 'brakeman', '~> 4.2', require: false
128 131
   gem 'bundler-audit', '~> 0.6', require: false
129
-  gem 'scss_lint', '~> 0.55', require: false
132
+  gem 'scss_lint', '~> 0.57', require: false
130 133
 
131 134
   gem 'capistrano', '~> 3.10'
132 135
   gem 'capistrano-rails', '~> 1.3'
133 136
   gem 'capistrano-rbenv', '~> 2.1'
134 137
   gem 'capistrano-yarn', '~> 2.0'
138
+
139
+  gem 'derailed_benchmarks'
140
+  gem 'stackprof'
135 141
 end
136 142
 
137 143
 group :production do
138
-  gem 'lograge', '~> 0.7'
144
+  gem 'lograge', '~> 0.10'
139 145
   gem 'redis-rails', '~> 5.0'
140 146
 end

+ 261
- 231
Gemfile.lock View File

@@ -1,25 +1,25 @@
1 1
 GEM
2 2
   remote: https://rubygems.org/
3 3
   specs:
4
-    actioncable (5.1.4)
5
-      actionpack (= 5.1.4)
4
+    actioncable (5.2.0)
5
+      actionpack (= 5.2.0)
6 6
       nio4r (~> 2.0)
7
-      websocket-driver (~> 0.6.1)
8
-    actionmailer (5.1.4)
9
-      actionpack (= 5.1.4)
10
-      actionview (= 5.1.4)
11
-      activejob (= 5.1.4)
7
+      websocket-driver (>= 0.6.1)
8
+    actionmailer (5.2.0)
9
+      actionpack (= 5.2.0)
10
+      actionview (= 5.2.0)
11
+      activejob (= 5.2.0)
12 12
       mail (~> 2.5, >= 2.5.4)
13 13
       rails-dom-testing (~> 2.0)
14
-    actionpack (5.1.4)
15
-      actionview (= 5.1.4)
16
-      activesupport (= 5.1.4)
14
+    actionpack (5.2.0)
15
+      actionview (= 5.2.0)
16
+      activesupport (= 5.2.0)
17 17
       rack (~> 2.0)
18 18
       rack-test (>= 0.6.3)
19 19
       rails-dom-testing (~> 2.0)
20 20
       rails-html-sanitizer (~> 1.0, >= 1.0.2)
21
-    actionview (5.1.4)
22
-      activesupport (= 5.1.4)
21
+    actionview (5.2.0)
22
+      activesupport (= 5.2.0)
23 23
       builder (~> 3.1)
24 24
       erubi (~> 1.4)
25 25
       rails-dom-testing (~> 2.0)
@@ -30,60 +30,71 @@ GEM
30 30
       case_transform (>= 0.2)
31 31
       jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
32 32
     active_record_query_trace (1.5.4)
33
-    activejob (5.1.4)
34
-      activesupport (= 5.1.4)
33
+    activejob (5.2.0)
34
+      activesupport (= 5.2.0)
35 35
       globalid (>= 0.3.6)
36
-    activemodel (5.1.4)
37
-      activesupport (= 5.1.4)
38
-    activerecord (5.1.4)
39
-      activemodel (= 5.1.4)
40
-      activesupport (= 5.1.4)
41
-      arel (~> 8.0)
42
-    activesupport (5.1.4)
36
+    activemodel (5.2.0)
37
+      activesupport (= 5.2.0)
38
+    activerecord (5.2.0)
39
+      activemodel (= 5.2.0)
40
+      activesupport (= 5.2.0)
41
+      arel (>= 9.0)
42
+    activestorage (5.2.0)
43
+      actionpack (= 5.2.0)
44
+      activerecord (= 5.2.0)
45
+      marcel (~> 0.3.1)
46
+    activesupport (5.2.0)
43 47
       concurrent-ruby (~> 1.0, >= 1.0.2)
44
-      i18n (~> 0.7)
48
+      i18n (>= 0.7, < 2)
45 49
       minitest (~> 5.1)
46 50
       tzinfo (~> 1.1)
47 51
     addressable (2.5.2)
48 52
       public_suffix (>= 2.0.2, < 4.0)
49 53
     airbrussh (1.3.0)
50 54
       sshkit (>= 1.6.1, != 1.7.0)
51
-    annotate (2.7.2)
55
+    annotate (2.7.3)
52 56
       activerecord (>= 3.2, < 6.0)
53 57
       rake (>= 10.4, < 13.0)
54
-    arel (8.0.0)
55
-    ast (2.3.0)
56
-    attr_encrypted (3.0.3)
58
+    arel (9.0.0)
59
+    ast (2.4.0)
60
+    attr_encrypted (3.1.0)
57 61
       encryptor (~> 3.0.0)
58 62
     av (0.9.0)
59 63
       cocaine (~> 0.5.3)
60
-    aws-sdk (2.10.100)
61
-      aws-sdk-resources (= 2.10.100)
62
-    aws-sdk-core (2.10.100)
64
+    aws-partitions (1.80.0)
65
+    aws-sdk-core (3.19.0)
66
+      aws-partitions (~> 1.0)
63 67
       aws-sigv4 (~> 1.0)
64 68
       jmespath (~> 1.0)
65
-    aws-sdk-resources (2.10.100)
66
-      aws-sdk-core (= 2.10.100)
69
+    aws-sdk-kms (1.5.0)
70
+      aws-sdk-core (~> 3)
71
+      aws-sigv4 (~> 1.0)
72
+    aws-sdk-s3 (1.9.1)
73
+      aws-sdk-core (~> 3)
74
+      aws-sdk-kms (~> 1)
75
+      aws-sigv4 (~> 1.0)
67 76
     aws-sigv4 (1.0.2)
68 77
     bcrypt (3.1.11)
78
+    benchmark-ips (2.7.2)
69 79
     better_errors (2.4.0)
70 80
       coderay (>= 1.0.0)
71 81
       erubi (>= 1.0.0)
72 82
       rack (>= 0.9.0)
73 83
     binding_of_caller (0.8.0)
74 84
       debug_inspector (>= 0.0.1)
75
-    bootsnap (1.1.5)
85
+    bootsnap (1.3.0)
76 86
       msgpack (~> 1.0)
77
-    brakeman (4.0.1)
78
-    browser (2.5.2)
87
+    brakeman (4.2.1)
88
+    browser (2.5.3)
79 89
     builder (3.2.3)
80
-    bullet (5.6.1)
90
+    bullet (5.7.5)
81 91
       activesupport (>= 3.0.0)
82
-      uniform_notifier (~> 1.10.0)
92
+      uniform_notifier (~> 1.11.0)
83 93
     bundler-audit (0.6.0)
84 94
       bundler (~> 1.2)
85 95
       thor (~> 0.18)
86
-    capistrano (3.10.0)
96
+    byebug (10.0.2)
97
+    capistrano (3.10.2)
87 98
       airbrussh (>= 1.0.0)
88 99
       i18n
89 100
       rake (>= 10.0.0)
@@ -99,21 +110,21 @@ GEM
99 110
       sshkit (~> 1.3)
100 111
     capistrano-yarn (2.0.2)
101 112
       capistrano (~> 3.0)
102
-    capybara (2.16.1)
113
+    capybara (2.18.0)
103 114
       addressable
104 115
       mini_mime (>= 0.1.3)
105 116
       nokogiri (>= 1.3.3)
106 117
       rack (>= 1.0.0)
107 118
       rack-test (>= 0.5.4)
108
-      xpath (~> 2.0)
119
+      xpath (>= 2.0, < 4.0)
109 120
     case_transform (0.2)
110 121
       activesupport
111
-    charlock_holmes (0.7.5)
122
+    charlock_holmes (0.7.6)
112 123
     chewy (5.0.0)
113 124
       activesupport (>= 4.0)
114 125
       elasticsearch (>= 2.0.0)
115 126
       elasticsearch-dsl
116
-    chunky_png (1.3.8)
127
+    chunky_png (1.3.10)
117 128
     cld3 (3.2.2)
118 129
       ffi (>= 1.1.0, < 1.10.0)
119 130
     climate_control (0.2.0)
@@ -125,62 +136,69 @@ GEM
125 136
     connection_pool (2.2.1)
126 137
     crack (0.4.3)
127 138
       safe_yaml (~> 1.0.0)
128
-    crass (1.0.3)
139
+    crass (1.0.4)
129 140
     css_parser (1.6.0)
130 141
       addressable
131 142
     debug_inspector (0.0.3)
132
-    devise (4.4.0)
143
+    derailed_benchmarks (1.3.4)
144
+      benchmark-ips (~> 2)
145
+      get_process_mem (~> 0)
146
+      heapy (~> 0)
147
+      memory_profiler (~> 0)
148
+      rack (>= 1)
149
+      rake (> 10, < 13)
150
+      thor (~> 0.19)
151
+    devise (4.4.3)
133 152
       bcrypt (~> 3.0)
134 153
       orm_adapter (~> 0.1)
135
-      railties (>= 4.1.0, < 5.2)
154
+      railties (>= 4.1.0, < 6.0)
136 155
       responders
137 156
       warden (~> 1.2.3)
138
-    devise-two-factor (3.0.2)
139
-      activesupport (< 5.2)
157
+    devise-two-factor (3.0.3)
158
+      activesupport (< 5.3)
140 159
       attr_encrypted (>= 1.3, < 4, != 2)
141 160
       devise (~> 4.0)
142
-      railties (< 5.2)
161
+      railties (< 5.3)
143 162
       rotp (~> 2.0)
144
-    devise_pam_authenticatable2 (9.0.0)
163
+    devise_pam_authenticatable2 (9.1.0)
145 164
       devise (>= 4.0.0)
146
-      rpam2 (~> 3.0)
165
+      rpam2 (~> 4.0)
147 166
     diff-lcs (1.3)
148
-    docile (1.1.5)
149
-    domain_name (0.5.20170404)
167
+    docile (1.3.0)
168
+    domain_name (0.5.20180417)
150 169
       unf (>= 0.0.5, < 1.0.0)
151
-    doorkeeper (4.2.6)
170
+    doorkeeper (4.3.2)
152 171
       railties (>= 4.2)
153
-    dotenv (2.2.1)
154
-    dotenv-rails (2.2.1)
155
-      dotenv (= 2.2.1)
156
-      railties (>= 3.2, < 5.2)
157
-    easy_translate (0.5.0)
158
-      json
172
+    dotenv (2.2.2)
173
+    dotenv-rails (2.2.2)
174
+      dotenv (= 2.2.2)
175
+      railties (>= 3.2, < 6.0)
176
+    easy_translate (0.5.1)
159 177
       thread
160 178
       thread_safe
161
-    elasticsearch (6.0.1)
162
-      elasticsearch-api (= 6.0.1)
163
-      elasticsearch-transport (= 6.0.1)
164
-    elasticsearch-api (6.0.1)
179
+    elasticsearch (6.0.2)
180
+      elasticsearch-api (= 6.0.2)
181
+      elasticsearch-transport (= 6.0.2)
182
+    elasticsearch-api (6.0.2)
165 183
       multi_json
166 184
     elasticsearch-dsl (0.1.5)
167
-    elasticsearch-transport (6.0.1)
185
+    elasticsearch-transport (6.0.2)
168 186
       faraday
169 187
       multi_json
170 188
     encryptor (3.0.0)
171 189
     equatable (0.5.0)
172
-    erubi (1.7.0)
173
-    et-orbi (1.0.8)
190
+    erubi (1.7.1)
191
+    et-orbi (1.1.0)
174 192
       tzinfo
175
-    excon (0.59.0)
176
-    fabrication (2.18.0)
177
-    faker (1.8.4)
178
-      i18n (~> 0.5)
179
-    faraday (0.14.0)
193
+    excon (0.62.0)
194
+    fabrication (2.20.1)
195
+    faker (1.8.7)
196
+      i18n (>= 0.7)
197
+    faraday (0.15.0)
180 198
       multipart-post (>= 1.2, < 3)
181 199
     fast_blank (1.0.0)
182 200
     fastimage (2.1.1)
183
-    ffi (1.9.18)
201
+    ffi (1.9.23)
184 202
     fog-core (1.45.0)
185 203
       builder
186 204
       excon (~> 0.58)
@@ -188,16 +206,17 @@ GEM
188 206
     fog-json (1.0.2)
189 207
       fog-core (~> 1.0)
190 208
       multi_json (~> 1.10)
191
-    fog-local (0.4.0)
192
-      fog-core (~> 1.27)
193
-    fog-openstack (0.1.22)
194
-      fog-core (>= 1.40)
209
+    fog-local (0.5.0)
210
+      fog-core (>= 1.27, < 3.0)
211
+    fog-openstack (0.1.25)
212
+      fog-core (~> 1.40)
195 213
       fog-json (>= 1.0)
196 214
       ipaddress (>= 0.8)
197 215
     formatador (0.2.5)
198
-    fuubar (2.2.0)
216
+    fuubar (2.3.1)
199 217
       rspec-core (~> 3.0)
200 218
       ruby-progressbar (~> 1.4)
219
+    get_process_mem (0.2.1)
201 220
     globalid (0.4.1)
202 221
       activesupport (>= 4.2.0)
203 222
     goldfinger (2.1.0)
@@ -205,7 +224,7 @@ GEM
205 224
       http (~> 3.0)
206 225
       nokogiri (~> 1.8)
207 226
       oj (~> 3.0)
208
-    hamlit (2.8.5)
227
+    hamlit (2.8.8)
209 228
       temple (>= 0.8.0)
210 229
       thor
211 230
       tilt
@@ -218,48 +237,45 @@ GEM
218 237
       concurrent-ruby (~> 1.0)
219 238
     hashdiff (0.3.7)
220 239
     hashie (3.5.7)
240
+    heapy (0.1.3)
221 241
     highline (1.7.10)
222 242
     hiredis (0.6.1)
223 243
     hitimes (1.2.6)
224 244
     hkdf (0.3.0)
225 245
     htmlentities (4.3.4)
226
-    http (3.0.0)
246
+    http (3.2.0)
227 247
       addressable (~> 2.3)
228 248
       http-cookie (~> 1.0)
229
-      http-form_data (>= 2.0.0.pre.pre2, < 3)
249
+      http-form_data (~> 2.0)
230 250
       http_parser.rb (~> 0.6.0)
231 251
     http-cookie (1.0.3)
232 252
       domain_name (~> 0.5)
233
-    http-form_data (2.0.0)
253
+    http-form_data (2.1.0)
234 254
     http_accept_language (2.1.1)
235 255
     http_parser.rb (0.6.0)
236
-    httplog (0.99.7)
237
-      colorize
238
-      rack
239
-    i18n (0.9.3)
256
+    httplog (1.0.2)
257
+      colorize (~> 0.8)
258
+      rack (>= 1.0)
259
+    i18n (1.0.1)
240 260
       concurrent-ruby (~> 1.0)
241
-    i18n-tasks (0.9.19)
261
+    i18n-tasks (0.9.21)
242 262
       activesupport (>= 4.0.2)
243 263
       ast (>= 2.1.0)
244
-      easy_translate (>= 0.5.0)
264
+      easy_translate (>= 0.5.1)
245 265
       erubi
246 266
       highline (>= 1.7.3)
247 267
       i18n
248 268
       parser (>= 2.2.3.0)
249
-      rainbow (~> 2.2)
269
+      rainbow (>= 2.2.2, < 4.0)
250 270
       terminal-table (>= 1.5.1)
251 271
     idn-ruby (0.1.0)
252 272
     ipaddress (0.8.3)
253 273
     iso-639 (0.2.8)
254
-    jmespath (1.3.1)
274
+    jmespath (1.4.0)
255 275
     json (2.1.0)
256
-    json-ld (2.1.7)
276
+    json-ld (2.2.1)
257 277
       multi_json (~> 1.12)
258
-      rdf (~> 2.2, >= 2.2.8)
259
-    json-ld-preloaded (2.2.2)
260
-      json-ld (~> 2.1, >= 2.1.5)
261
-      multi_json (~> 1.11)
262
-      rdf (~> 2.2)
278
+      rdf (>= 2.2.8, < 4.0)
263 279
     jsonapi-renderer (0.2.0)
264 280
     jwt (2.1.0)
265 281
     kaminari (1.1.1)
@@ -276,25 +292,27 @@ GEM
276 292
     kaminari-core (1.1.1)
277 293
     launchy (2.4.3)
278 294
       addressable (~> 2.3)
279
-    letter_opener (1.4.1)
295
+    letter_opener (1.6.0)
280 296
       launchy (~> 2.2)
281
-    letter_opener_web (1.3.1)
297
+    letter_opener_web (1.3.4)
282 298
       actionmailer (>= 3.2)
283 299
       letter_opener (~> 1.0)
284 300
       railties (>= 3.2)
285 301
     link_header (0.0.8)
286
-    lograge (0.7.1)
287
-      actionpack (>= 4, < 5.2)
288
-      activesupport (>= 4, < 5.2)
289
-      railties (>= 4, < 5.2)
302
+    lograge (0.10.0)
303
+      actionpack (>= 4)
304
+      activesupport (>= 4)
305
+      railties (>= 4)
290 306
       request_store (~> 1.0)
291
-    loofah (2.2.1)
307
+    loofah (2.2.2)
292 308
       crass (~> 1.0.2)
293 309
       nokogiri (>= 1.5.9)
294 310
     mail (2.7.0)
295 311
       mini_mime (>= 0.1.1)
296
-    mario-redis-lock (1.2.0)
297
-      redis (~> 3, >= 3.0.5)
312
+    marcel (0.3.2)
313
+      mimemagic (~> 0.3.2)
314
+    mario-redis-lock (1.2.1)
315
+      redis (>= 3.0.5)
298 316
     memory_profiler (0.9.10)
299 317
     method_source (0.9.0)
300 318
     microformats (4.0.7)
@@ -307,15 +325,15 @@ GEM
307 325
     mini_mime (1.0.0)
308 326
     mini_portile2 (2.3.0)
309 327
     minitest (5.11.3)
310
-    msgpack (1.1.0)
311
-    multi_json (1.12.2)
328
+    msgpack (1.2.4)
329
+    multi_json (1.13.1)
312 330
     multipart-post (2.0.0)
313 331
     necromancer (0.4.0)
314 332
     net-ldap (0.16.1)
315 333
     net-scp (1.2.1)
316 334
       net-ssh (>= 2.6.5)
317 335
     net-ssh (4.2.0)
318
-    nio4r (2.1.0)
336
+    nio4r (2.3.0)
319 337
     nokogiri (1.8.2)
320 338
       mini_portile2 (~> 2.3.0)
321 339
     nokogumbo (1.5.0)
@@ -325,7 +343,7 @@ GEM
325 343
       concurrent-ruby (~> 1.0.0)
326 344
       sidekiq (>= 3.5.0)
327 345
       statsd-ruby (~> 1.2.0)
328
-    oj (3.3.10)
346
+    oj (3.5.1)
329 347
     omniauth (1.8.1)
330 348
       hashie (>= 3.4.6, < 3.6.0)
331 349
       rack (>= 1.6.2, < 3)
@@ -341,68 +359,73 @@ GEM
341 359
       addressable (~> 2.5)
342 360
       http (~> 3.0)
343 361
       nokogiri (~> 1.8)
344
-    ox (2.8.2)
345
-    paperclip (5.2.1)
362
+    ox (2.9.2)
363
+    paperclip (6.0.0)
346 364
       activemodel (>= 4.2.0)
347 365
       activesupport (>= 4.2.0)
348
-      cocaine (~> 0.5.5)
349 366
       mime-types
350 367
       mimemagic (~> 0.3.0)
368
+      terrapin (~> 0.6.0)
351 369
     paperclip-av-transcoder (0.6.4)
352 370
       av (~> 0.9.0)
353 371
       paperclip (>= 2.5.2)
354
-    parallel (1.12.0)
355
-    parallel_tests (2.19.0)
372
+    parallel (1.12.1)
373
+    parallel_tests (2.21.3)
356 374
       parallel
357
-    parser (2.4.0.2)
358
-      ast (~> 2.3)
375
+    parser (2.5.1.0)
376
+      ast (~> 2.4.0)
359 377
     pastel (0.7.2)
360 378
       equatable (~> 0.5.0)
361 379
       tty-color (~> 0.4.0)
362
-    pg (0.21.0)
363
-    pghero (1.7.0)
380
+    pg (1.0.0)
381
+    pghero (2.1.0)
364 382
       activerecord
365
-    pkg-config (1.2.8)
383
+    pkg-config (1.3.0)
384
+    posix-spawn (0.3.13)
366 385
     powerpack (0.1.1)
367 386
     premailer (1.11.1)
368 387
       addressable
369 388
       css_parser (>= 1.6.0)
370 389
       htmlentities (>= 4.0.0)
371
-    premailer-rails (1.10.1)
390
+    premailer-rails (1.10.2)
372 391
       actionmailer (>= 3, < 6)
373 392
       premailer (~> 1.7, >= 1.7.9)
374 393
     private_address_check (0.4.1)
375 394
     pry (0.11.3)
376 395
       coderay (~> 1.1.0)
377 396
       method_source (~> 0.9.0)
397
+    pry-byebug (3.6.0)
398
+      byebug (~> 10.0)
399
+      pry (~> 0.10)
378 400
     pry-rails (0.3.6)
379 401
       pry (>= 0.10.4)
380
-    public_suffix (3.0.1)
381
-    puma (3.11.0)
402
+    public_suffix (3.0.2)
403
+    puma (3.11.4)
382 404
     pundit (1.1.0)
383 405
       activesupport (>= 3.0.0)
384
-    rack (2.0.3)
385
-    rack-attack (5.0.1)
406
+    rack (2.0.4)
407
+    rack-attack (5.2.0)
386 408
       rack
387
-    rack-cors (0.4.1)
388
-    rack-protection (2.0.0)
409
+    rack-cors (1.0.2)
410
+    rack-protection (2.0.1)
389 411
       rack
390
-    rack-proxy (0.6.2)
412
+    rack-proxy (0.6.4)
391 413
       rack
392
-    rack-test (0.8.2)
414
+    rack-test (1.0.0)
393 415
       rack (>= 1.0, < 3)
394 416
     rack-timeout (0.4.2)
395
-    rails (5.1.4)
396
-      actioncable (= 5.1.4)
397
-      actionmailer (= 5.1.4)
398
-      actionpack (= 5.1.4)
399
-      actionview (= 5.1.4)
400
-      activejob (= 5.1.4)
401
-      activemodel (= 5.1.4)
402
-      activerecord (= 5.1.4)
403
-      activesupport (= 5.1.4)
417
+    rails (5.2.0)
418
+      actioncable (= 5.2.0)
419
+      actionmailer (= 5.2.0)
420
+      actionpack (= 5.2.0)
421
+      actionview (= 5.2.0)
422
+      activejob (= 5.2.0)
423
+      activemodel (= 5.2.0)
424
+      activerecord (= 5.2.0)
425
+      activestorage (= 5.2.0)
426
+      activesupport (= 5.2.0)
404 427
       bundler (>= 1.3.0)
405
-      railties (= 5.1.4)
428
+      railties (= 5.2.0)
406 429
       sprockets-rails (>= 2.0.0)
407 430
     rails-controller-testing (1.0.2)
408 431
       actionpack (~> 5.x, >= 5.0.1)
@@ -411,31 +434,30 @@ GEM
411 434
     rails-dom-testing (2.0.3)
412 435
       activesupport (>= 4.2.0)
413 436
       nokogiri (>= 1.6)
414
-    rails-html-sanitizer (1.0.3)
415
-      loofah (~> 2.0)
416
-    rails-i18n (5.0.4)
417
-      i18n (~> 0.7)
418
-      railties (~> 5.0)
437
+    rails-html-sanitizer (1.0.4)
438
+      loofah (~> 2.2, >= 2.2.2)
439
+    rails-i18n (5.1.1)
440
+      i18n (>= 0.7, < 2)
441
+      railties (>= 5.0, < 6)
419 442
     rails-settings-cached (0.6.6)
420 443
       rails (>= 4.2.0)
421
-    railties (5.1.4)
422
-      actionpack (= 5.1.4)
423
-      activesupport (= 5.1.4)
444
+    railties (5.2.0)
445
+      actionpack (= 5.2.0)
446
+      activesupport (= 5.2.0)
424 447
       method_source
425 448
       rake (>= 0.8.7)
426 449
       thor (>= 0.18.1, < 2.0)
427
-    rainbow (2.2.2)
428
-      rake
429
-    rake (12.3.0)
430
-    rb-fsevent (0.10.2)
450
+    rainbow (3.0.0)
451
+    rake (12.3.1)
452
+    rb-fsevent (0.10.3)
431 453
     rb-inotify (0.9.10)
432 454
       ffi (>= 0.5.0, < 2)
433
-    rdf (2.2.12)
455
+    rdf (3.0.2)
434 456
       hamster (~> 3.0)
435 457
       link_header (~> 0.0, >= 0.0.8)
436
-    rdf-normalize (0.3.2)
437
-      rdf (~> 2.0)
438
-    redis (3.3.5)
458
+    rdf-normalize (0.3.3)
459
+      rdf (>= 2.2, < 4.0)
460
+    redis (4.0.1)
439 461
     redis-actionpack (5.0.2)
440 462
       actionpack (>= 4.0, < 6)
441 463
       redis-rack (>= 1, < 3)
@@ -445,24 +467,25 @@ GEM
445 467
       redis-store (>= 1.3, < 2)
446 468
     redis-namespace (1.6.0)
447 469
       redis (>= 3.0.4)
448
-    redis-rack (2.0.3)
470
+    redis-rack (2.0.4)
449 471
       rack (>= 1.5, < 3)
450 472
       redis-store (>= 1.2, < 2)
451 473
     redis-rails (5.0.2)
452 474
       redis-actionpack (>= 5.0, < 6)
453 475
       redis-activesupport (>= 5.0, < 6)
454 476
       redis-store (>= 1.2, < 2)
455
-    redis-store (1.4.1)
477
+    redis-store (1.5.0)
456 478
       redis (>= 2.2, < 5)
457
-    request_store (1.3.2)
479
+    request_store (1.4.1)
480
+      rack (>= 1.4)
458 481
     responders (2.4.0)
459 482
       actionpack (>= 4.2.0, < 5.3)
460 483
       railties (>= 4.2.0, < 5.3)
461 484
     rotp (2.1.2)
462
-    rpam2 (3.1.0)
485
+    rpam2 (4.0.2)
463 486
     rqrcode (0.10.1)
464 487
       chunky_png (~> 1.0)
465
-    rspec-core (3.7.0)
488
+    rspec-core (3.7.1)
466 489
       rspec-support (~> 3.7.0)
467 490
     rspec-expectations (3.7.0)
468 491
       diff-lcs (>= 1.2.0, < 2.0)
@@ -481,15 +504,14 @@ GEM
481 504
     rspec-sidekiq (3.0.3)
482 505
       rspec-core (~> 3.0, >= 3.0.0)
483 506
       sidekiq (>= 2.4.0)
484
-    rspec-support (3.7.0)
485
-    rubocop (0.51.0)
507
+    rspec-support (3.7.1)
508
+    rubocop (0.55.0)
486 509
       parallel (~> 1.10)
487
-      parser (>= 2.3.3.1, < 3.0)
510
+      parser (>= 2.5)
488 511
       powerpack (~> 0.1)
489
-      rainbow (>= 2.2.2, < 3.0)
512
+      rainbow (>= 2.2.2, < 4.0)
490 513
       ruby-progressbar (~> 1.7)
491 514
       unicode-display_width (~> 1.0, >= 1.0.1)
492
-    ruby-oembed (0.12.0)
493 515
     ruby-progressbar (1.9.0)
494 516
     ruby-saml (1.7.2)
495 517
       nokogiri (>= 1.5.10)
@@ -500,23 +522,23 @@ GEM
500 522
       crass (~> 1.0.2)
501 523
       nokogiri (>= 1.4.4)
502 524
       nokogumbo (~> 1.4)
503
-    sass (3.5.3)
525
+    sass (3.5.6)
504 526
       sass-listen (~> 4.0.0)
505 527
     sass-listen (4.0.0)
506 528
       rb-fsevent (~> 0.9, >= 0.9.4)
507 529
       rb-inotify (~> 0.9, >= 0.9.7)
508
-    scss_lint (0.56.0)
530
+    scss_lint (0.57.0)
509 531
       rake (>= 0.9, < 13)
510
-      sass (~> 3.5.3)
511
-    sidekiq (5.0.5)
532
+      sass (~> 3.5.5)
533
+    sidekiq (5.1.3)
512 534
       concurrent-ruby (~> 1.0)
513 535
       connection_pool (~> 2.2, >= 2.2.0)
514 536
       rack-protection (>= 1.5.0)
515
-      redis (>= 3.3.4, < 5)
537
+      redis (>= 3.3.5, < 5)
516 538
     sidekiq-bulk (0.1.1)
517 539
       activesupport
518 540
       sidekiq
519
-    sidekiq-scheduler (2.1.10)
541
+    sidekiq-scheduler (2.2.1)
520 542
       redis (>= 3, < 5)
521 543
       rufus-scheduler (~> 3.2)
522 544
       sidekiq (>= 3)
@@ -526,11 +548,11 @@ GEM
526 548
       thor (~> 0)
527 549
     simple-navigation (4.0.5)
528 550
       activesupport (>= 2.3.2)
529
-    simple_form (3.5.0)
530
-      actionpack (> 4, < 5.2)
531
-      activemodel (> 4, < 5.2)
532
-    simplecov (0.15.1)
533
-      docile (~> 1.1.0)
551
+    simple_form (4.0.0)
552
+      actionpack (> 4)
553
+      activemodel (> 4)
554
+    simplecov (0.16.1)
555
+      docile (~> 1.1)
534 556
       json (>= 1.8, < 3)
535 557
       simplecov-html (~> 0.10.0)
536 558
     simplecov-html (0.10.2)
@@ -541,17 +563,21 @@ GEM
541 563
       actionpack (>= 4.0)
542 564
       activesupport (>= 4.0)
543 565
       sprockets (>= 3.0.0)
544
-    sshkit (1.15.1)
566
+    sshkit (1.16.0)
545 567
       net-scp (>= 1.1.2)
546 568
       net-ssh (>= 2.8.0)
569
+    stackprof (0.2.11)
547 570
     statsd-ruby (1.2.1)
571
+    stoplight (2.1.3)
548 572
     streamio-ffmpeg (3.0.2)
549 573
       multi_json (~> 1.8)
550
-    strong_migrations (0.1.9)
574
+    strong_migrations (0.2.2)
551 575
       activerecord (>= 3.2.0)
552 576
     temple (0.8.0)
553 577
     terminal-table (1.8.0)
554 578
       unicode-display_width (~> 1.1, >= 1.1.1)
579
+    terrapin (0.6.0)
580
+      climate_control (>= 0.0.3, < 1.0)
555 581
     thor (0.20.0)
556 582
     thread (0.2.2)
557 583
     thread_safe (0.3.6)
@@ -559,10 +585,10 @@ GEM
559 585
     timers (4.1.2)
560 586
       hitimes
561 587
     tty-color (0.4.2)
562
-    tty-command (0.7.0)
588
+    tty-command (0.8.0)
563 589
       pastel (~> 0.7.0)
564 590
     tty-cursor (0.5.0)
565
-    tty-prompt (0.15.0)
591
+    tty-prompt (0.16.0)
566 592
       necromancer (~> 0.4.0)
567 593
       pastel (~> 0.7.0)
568 594
       timers (~> 4.0)
@@ -575,34 +601,34 @@ GEM
575 601
     tty-screen (0.6.4)
576 602
     twitter-text (1.14.7)
577 603
       unf (~> 0.1.0)
578
-    tzinfo (1.2.4)
604
+    tzinfo (1.2.5)
579 605
       thread_safe (~> 0.1)
580
-    tzinfo-data (1.2017.3)
606
+    tzinfo-data (1.2018.4)
581 607
       tzinfo (>= 1.0.0)
582 608
     unf (0.1.4)
583 609
       unf_ext
584
-    unf_ext (0.0.7.4)
585
-    unicode-display_width (1.3.0)
586
-    uniform_notifier (1.10.0)
610
+    unf_ext (0.0.7.5)
611
+    unicode-display_width (1.3.2)
612
+    uniform_notifier (1.11.0)
587 613
     warden (1.2.7)
588 614
       rack (>= 1.0)
589
-    webmock (3.1.1)
615
+    webmock (3.3.0)
590 616
       addressable (>= 2.3.6)
591 617
       crack (>= 0.3.2)
592 618
       hashdiff
593
-    webpacker (3.0.2)
619
+    webpacker (3.4.3)
594 620
       activesupport (>= 4.2)
595 621
       rack-proxy (>= 0.6.1)
596 622
       railties (>= 4.2)
597 623
     webpush (0.3.3)
598 624
       hkdf (~> 0.2)
599 625
       jwt (~> 2.0)
600
-    websocket-driver (0.6.5)
626
+    websocket-driver (0.7.0)
601 627
       websocket-extensions (>= 0.1.0)
602 628
     websocket-extensions (0.1.3)
603 629
     wisper (2.0.0)
604
-    xpath (2.1.0)
605
-      nokogiri (~> 1.3)
630
+    xpath (3.0.0)
631
+      nokogiri (~> 1.8)
606 632
 
607 633
 PLATFORMS
608 634
   ruby
@@ -612,52 +638,53 @@ DEPENDENCIES
612 638
   active_record_query_trace (~> 1.5)
613 639
   addressable (~> 2.5)
614 640
   annotate (~> 2.7)
615
-  aws-sdk (~> 2.10)
641
+  aws-sdk-s3 (~> 1.9)
616 642
   better_errors (~> 2.4)
617 643
   binding_of_caller (~> 0.7)
618
-  bootsnap
619
-  brakeman (~> 4.0)
644
+  bootsnap (~> 1.3)
645
+  brakeman (~> 4.2)
620 646
   browser
621
-  bullet (~> 5.5)
647
+  bullet (~> 5.7)
622 648
   bundler-audit (~> 0.6)
623 649
   capistrano (~> 3.10)
624 650
   capistrano-rails (~> 1.3)
625 651
   capistrano-rbenv (~> 2.1)
626 652
   capistrano-yarn (~> 2.0)
627
-  capybara (~> 2.15)
628
-  charlock_holmes (~> 0.7.5)
653
+  capybara (~> 2.18)
654
+  charlock_holmes (~> 0.7.6)
629 655
   chewy (~> 5.0)
630 656
   cld3 (~> 3.2.0)
631 657
   climate_control (~> 0.2)
658
+  derailed_benchmarks
632 659
   devise (~> 4.4)
633 660
   devise-two-factor (~> 3.0)
634
-  devise_pam_authenticatable2 (~> 9.0)
635
-  doorkeeper (~> 4.2)
636
-  dotenv-rails (~> 2.2)
637
-  fabrication (~> 2.18)
638
-  faker (~> 1.7)
661
+  devise_pam_authenticatable2 (~> 9.1)
662
+  doorkeeper (~> 4.3)
663
+  dotenv-rails (~> 2.2, < 2.3)
664
+  fabrication (~> 2.20)
665
+  faker (~> 1.8)
639 666
   fast_blank (~> 1.0)
640 667
   fastimage
641 668
   fog-core (~> 1.45)
642
-  fog-local (~> 0.4)
669
+  fog-local (~> 0.5)
643 670
   fog-openstack (~> 0.1)
644 671
   fuubar (~> 2.2)
645 672
   goldfinger (~> 2.1)
646 673
   hamlit-rails (~> 0.2)
647 674
   hiredis (~> 0.6)
648 675
   htmlentities (~> 4.3)
649
-  http (~> 3.0)
676
+  http (~> 3.2)
650 677
   http_accept_language (~> 2.1)
651
-  httplog (~> 0.99)
678
+  httplog (~> 1.0)
652 679
   i18n-tasks (~> 0.9)
653 680
   idn-ruby
654 681
   iso-639
655
-  json-ld-preloaded (~> 2.2.1)
682
+  json-ld (~> 2.2)
656 683
   kaminari (~> 1.1)
657 684
   letter_opener (~> 1.4)
658 685
   letter_opener_web (~> 1.3)
659 686
   link_header (~> 0.0)
660
-  lograge (~> 0.7)
687
+  lograge (~> 0.10)
661 688
   mario-redis-lock (~> 1.2)
662 689
   memory_profiler
663 690
   microformats (~> 4.0)
@@ -665,58 +692,61 @@ DEPENDENCIES
665 692
   net-ldap (~> 0.10)
666 693
   nokogiri (~> 1.8)
667 694
   nsa (~> 0.2)
668
-  oj (~> 3.3)
695
+  oj (~> 3.5)
669 696
   omniauth (~> 1.2)
670 697
   omniauth-cas (~> 1.1)
671 698
   omniauth-saml (~> 1.10)
672 699
   ostatus2 (~> 2.0)
673
-  ox (~> 2.8)
674
-  paperclip (~> 5.1)
700
+  ox (~> 2.9)
701
+  paperclip (~> 6.0)
675 702
   paperclip-av-transcoder (~> 0.6)
676
-  parallel_tests (~> 2.17)
677
-  pg (~> 0.20)
678
-  pghero (~> 1.7)
679
-  pkg-config (~> 1.2)
703
+  parallel_tests (~> 2.21)
704
+  pg (~> 1.0)
705
+  pghero (~> 2.1)
706
+  pkg-config (~> 1.3)
707
+  posix-spawn (~> 0.3)
680 708
   premailer-rails
681 709
   private_address_check (~> 0.4.1)
710
+  pry-byebug (~> 3.6)
682 711
   pry-rails (~> 0.3)
683
-  puma (~> 3.10)
712
+  puma (~> 3.11)
684 713
   pundit (~> 1.1)
685
-  rack-attack (~> 5.0)
686
-  rack-cors (~> 0.4)
714
+  rack-attack (~> 5.2)
715
+  rack-cors (~> 1.0)
687 716
   rack-timeout (~> 0.4)
688
-  rails (~> 5.1.4)
717
+  rails (~> 5.2.0)
689 718
   rails-controller-testing (~> 1.0)
690
-  rails-i18n (~> 5.0)
719
+  rails-i18n (~> 5.1)
691 720
   rails-settings-cached (~> 0.6)
692
-  rdf-normalize (~> 0.3.1)
693
-  redis (~> 3.3)
721
+  rdf-normalize (~> 0.3)
722
+  redis (~> 4.0)
694 723
   redis-namespace (~> 1.5)
695 724
   redis-rails (~> 5.0)
696 725
   rqrcode (~> 0.10)
697 726
   rspec-rails (~> 3.7)
698 727
   rspec-sidekiq (~> 3.0)
699
-  rubocop
700
-  ruby-oembed (~> 0.12)
728
+  rubocop (~> 0.55)
701 729
   ruby-progressbar (~> 1.4)
702
-  sanitize (~> 4.6.4)
703
-  scss_lint (~> 0.55)
704
-  sidekiq (~> 5.0)
730
+  sanitize (~> 4.6)
731
+  scss_lint (~> 0.57)
732
+  sidekiq (~> 5.1)
705 733
   sidekiq-bulk (~> 0.1.1)
706
-  sidekiq-scheduler (~> 2.1)
734
+  sidekiq-scheduler (~> 2.2)
707 735
   sidekiq-unique-jobs (~> 5.0)
708 736
   simple-navigation (~> 4.0)
709
-  simple_form (~> 3.4)
710
-  simplecov (~> 0.14)
737
+  simple_form (~> 4.0)
738
+  simplecov (~> 0.16)
711 739
   sprockets-rails (~> 3.2)
740
+  stackprof
741
+  stoplight (~> 2.1.3)
712 742
   streamio-ffmpeg (~> 3.0)
713
-  strong_migrations
714
-  tty-command
715
-  tty-prompt
743
+  strong_migrations (~> 0.2)
744
+  tty-command (~> 0.8)
745
+  tty-prompt (~> 0.16)
716 746
   twitter-text (~> 1.14)
717
-  tzinfo-data (~> 1.2017)
718
-  webmock (~> 3.0)
719
-  webpacker (~> 3.0)
747
+  tzinfo-data (~> 1.2018)
748
+  webmock (~> 3.3)
749
+  webpacker (~> 3.4)
720 750
   webpush
721 751
 
722 752
 RUBY VERSION

+ 2
- 2
README.md View File

@@ -1,10 +1,10 @@
1 1
 ![Mastodon](https://i.imgur.com/NhZc40l.png)
2 2
 ========
3 3
 
4
-[![Build Status](https://img.shields.io/travis/tootsuite/mastodon.svg)][travis]
4
+[![Build Status](https://img.shields.io/circleci/project/github/tootsuite/mastodon.svg)][circleci]
5 5
 [![Code Climate](https://img.shields.io/codeclimate/maintainability/tootsuite/mastodon.svg)][code_climate]
6 6
 
7
-[travis]: https://travis-ci.org/tootsuite/mastodon
7
+[circleci]: https://circleci.com/gh/tootsuite/mastodon
8 8
 [code_climate]: https://codeclimate.com/github/tootsuite/mastodon
9 9
 
10 10
 Mastodon is a **free, open-source social network server** based on **open web protocols** like ActivityPub and OStatus. The social focus of the project is a viable decentralized alternative to commercial social media silos that returns the control of the content distribution channels to the people. The technical focus of the project is a good user interface, a clean REST API for 3rd party apps and robust anti-abuse tools.

+ 8
- 2
app/controllers/accounts_controller.rb View File

@@ -20,9 +20,10 @@ class AccountsController < ApplicationController
20 20
         @pinned_statuses = cache_collection(@account.pinned_statuses, Status) if show_pinned_statuses?
21 21
         @statuses        = filtered_status_page(params)
22 22
         @statuses        = cache_collection(@statuses, Status)
23
+
23 24
         unless @statuses.empty?
24
-          @older_url        = older_url if @statuses.last.id > filtered_statuses.last.id
25
-          @newer_url        = newer_url if @statuses.first.id < filtered_statuses.first.id
25
+          @older_url = older_url if @statuses.last.id > filtered_statuses.last.id
26
+          @newer_url = newer_url if @statuses.first.id < filtered_statuses.first.id
26 27
         end
27 28
       end
28 29
 
@@ -31,6 +32,11 @@ class AccountsController < ApplicationController
31 32
         render xml: OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.feed(@account, @entries.reject { |entry| entry.status.nil? }))
32 33
       end
33 34
 
35
+      format.rss do
36
+        @statuses = cache_collection(default_statuses.without_reblogs.without_replies.limit(PAGE_SIZE), Status)
37
+        render xml: RSS::AccountSerializer.render(@account, @statuses)
38
+      end
39
+
34 40
       format.json do
35 41
         skip_session!
36 42
 

+ 1
- 1
app/controllers/activitypub/collections_controller.rb View File

@@ -22,7 +22,7 @@ class ActivityPub::CollectionsController < Api::BaseController
22 22
   end
23 23
 
24 24
   def set_statuses
25
-    @statuses = scope_for_collection.paginate_by_max_id(20, params[:max_id], params[:since_id])
25
+    @statuses = scope_for_collection
26 26
     @statuses = cache_collection(@statuses, Status)
27 27
   end
28 28
 

+ 45
- 9
app/controllers/activitypub/outboxes_controller.rb View File

@@ -1,14 +1,14 @@
1 1
 # frozen_string_literal: true
2 2
 
3 3
 class ActivityPub::OutboxesController < Api::BaseController
4
+  LIMIT = 20
5
+
4 6
   include SignatureVerification
5 7
 
6 8
   before_action :set_account
9
+  before_action :set_statuses
7 10
 
8 11
   def show
9
-    @statuses = @account.statuses.permitted_for(@account, signed_request_account).paginate_by_max_id(20, params[:max_id], params[:since_id])
10
-    @statuses = cache_collection(@statuses, Status)
11
-
12 12
     render json: outbox_presenter, serializer: ActivityPub::OutboxSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
13 13
   end
14 14
 
@@ -19,11 +19,47 @@ class ActivityPub::OutboxesController < Api::BaseController
19 19
   end
20 20
 
21 21
   def outbox_presenter
22
-    ActivityPub::CollectionPresenter.new(
23
-      id: account_outbox_url(@account),
24
-      type: :ordered,
25
-      size: @account.statuses_count,
26
-      items: @statuses
27
-    )
22
+    if page_requested?
23
+      ActivityPub::CollectionPresenter.new(
24
+        id: account_outbox_url(@account, page_params),
25
+        type: :ordered,
26
+        part_of: account_outbox_url(@account),
27
+        prev: prev_page,
28
+        next: next_page,
29
+        items: @statuses
30
+      )
31
+    else
32
+      ActivityPub::CollectionPresenter.new(
33
+        id: account_outbox_url(@account),
34
+        type: :ordered,
35
+        size: @account.statuses_count,
36
+        first: account_outbox_url(@account, page: true),
37
+        last: account_outbox_url(@account, page: true, min_id: 0)
38
+      )
39
+    end
40
+  end
41
+
42
+  def next_page
43
+    account_outbox_url(@account, page: true, max_id: @statuses.last.id) if @statuses.size == LIMIT
44
+  end
45
+
46
+  def prev_page
47
+    account_outbox_url(@account, page: true, min_id: @statuses.first.id) unless @statuses.empty?
48
+  end
49
+
50
+  def set_statuses
51
+    return unless page_requested?
52
+
53
+    @statuses = @account.statuses.permitted_for(@account, signed_request_account)
54
+    @statuses = params[:min_id].present? ? @statuses.paginate_by_min_id(LIMIT, params[:min_id]).reverse : @statuses.paginate_by_max_id(LIMIT, params[:max_id])
55
+    @statuses = cache_collection(@statuses, Status)
56
+  end
57
+
58
+  def page_requested?
59
+    params[:page] == 'true'
60
+  end
61
+
62
+  def page_params
63
+    { page: true, max_id: params[:max_id], min_id: params[:min_id] }.compact
28 64
   end
29 65
 end

+ 12
- 1
app/controllers/admin/accounts_controller.rb View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 module Admin
4 4
   class AccountsController < BaseController
5
-    before_action :set_account, only: [:show, :subscribe, :unsubscribe, :redownload, :enable, :disable, :memorialize]
5
+    before_action :set_account, only: [:show, :subscribe, :unsubscribe, :redownload, :remove_avatar, :enable, :disable, :memorialize]
6 6
     before_action :require_remote_account!, only: [:subscribe, :unsubscribe, :redownload]
7 7
     before_action :require_local_account!, only: [:enable, :disable, :memorialize]
8 8
 
@@ -60,6 +60,17 @@ module Admin
60 60
       redirect_to admin_account_path(@account.id)
61 61
     end
62 62
 
63
+    def remove_avatar
64
+      authorize @account, :remove_avatar?
65
+
66
+      @account.avatar = nil
67
+      @account.save!
68
+
69
+      log_action :remove_avatar, @account.user
70
+
71
+      redirect_to admin_account_path(@account.id)
72
+    end
73
+
63 74
     private
64 75
 
65 76
     def set_account

+ 49
- 0
app/controllers/admin/change_emails_controller.rb View File

@@ -0,0 +1,49 @@
1
+# frozen_string_literal: true
2
+
3
+module Admin
4
+  class ChangeEmailsController < BaseController
5
+    before_action :set_account
6
+    before_action :require_local_account!
7
+
8
+    def show
9
+      authorize @user, :change_email?
10
+    end
11
+
12
+    def update
13
+      authorize @user, :change_email?
14
+
15
+      new_email = resource_params.fetch(:unconfirmed_email)
16
+
17
+      if new_email != @user.email
18
+        @user.update!(
19
+          unconfirmed_email: new_email,
20
+          # Regenerate the confirmation token:
21
+          confirmation_token: nil
22
+        )
23
+
24
+        log_action :change_email, @user
25
+
26
+        @user.send_confirmation_instructions
27
+      end
28
+
29
+      redirect_to admin_account_path(@account.id), notice: I18n.t('admin.accounts.change_email.changed_msg')
30
+    end
31
+
32
+    private
33
+
34
+    def set_account
35
+      @account = Account.find(params[:account_id])
36
+      @user = @account.user
37
+    end
38
+
39
+    def require_local_account!
40
+      redirect_to admin_account_path(@account.id) unless @account.local? && @account.user.present?
41
+    end
42
+
43
+    def resource_params
44
+      params.require(:user).permit(
45
+        :unconfirmed_email
46
+      )
47
+    end
48
+  end
49
+end

+ 19
- 0
app/controllers/admin/confirmations_controller.rb View File

@@ -3,6 +3,7 @@
3 3
 module Admin
4 4
   class ConfirmationsController < BaseController
5 5
     before_action :set_user
6
+    before_action :check_confirmation, only: [:resend]
6 7
 
7 8
     def create
8 9
       authorize @user, :confirm?
@@ -11,10 +12,28 @@ module Admin
11 12
       redirect_to admin_accounts_path
12 13
     end
13 14
 
15
+    def resend
16
+      authorize @user, :confirm?
17
+
18
+      @user.resend_confirmation_instructions
19
+
20
+      log_action :confirm, @user
21
+
22
+      flash[:notice] = I18n.t('admin.accounts.resend_confirmation.success')
23
+      redirect_to admin_accounts_path
24
+    end
25
+
14 26
     private
15 27
 
16 28
     def set_user
17 29
       @user = Account.find(params[:account_id]).user || raise(ActiveRecord::RecordNotFound)
18 30
     end
31
+
32
+    def check_confirmation
33
+      if @user.confirmed?
34
+        flash[:error] = I18n.t('admin.accounts.resend_confirmation.already_confirmed')
35
+        redirect_to admin_accounts_path
36
+      end
37
+    end
19 38
   end
20 39
 end

+ 56
- 0
app/controllers/admin/report_notes_controller.rb View File

@@ -0,0 +1,56 @@
1
+# frozen_string_literal: true
2
+
3
+module Admin
4
+  class ReportNotesController < BaseController
5
+    before_action :set_report_note, only: [:destroy]
6
+
7
+    def create
8
+      authorize ReportNote, :create?
9
+
10
+      @report_note = current_account.report_notes.new(resource_params)
11
+      @report = @report_note.report
12
+
13
+      if @report_note.save
14
+        if params[:create_and_resolve]
15
+          @report.resolve!(current_account)
16
+          log_action :resolve, @report
17
+
18
+          redirect_to admin_reports_path, notice: I18n.t('admin.reports.resolved_msg')
19
+          return
20
+        end
21
+
22
+        if params[:create_and_unresolve]
23
+          @report.unresolve!
24
+          log_action :reopen, @report
25
+        end
26
+
27
+        redirect_to admin_report_path(@report), notice: I18n.t('admin.report_notes.created_msg')
28
+      else
29
+        @report_notes = @report.notes.latest
30
+        @report_history = @report.history
31
+        @form = Form::StatusBatch.new
32
+
33
+        render template: 'admin/reports/show'
34
+      end
35
+    end
36
+
37
+    def destroy
38
+      authorize @report_note, :destroy?
39
+      @report_note.destroy!
40
+      redirect_to admin_report_path(@report_note.report_id), notice: I18n.t('admin.report_notes.destroyed_msg')
41
+    end
42
+
43
+    private
44
+
45
+    def resource_params
46
+      params.require(:report_note).permit(
47
+        :content,
48
+        :report_id
49
+      )
50
+    end
51
+
52
+    def set_report_note
53
+      @report_note = ReportNote.find(params[:id])
54
+    end
55
+  end
56
+end

+ 12
- 21
app/controllers/admin/reported_statuses_controller.rb View File

@@ -3,31 +3,16 @@
3 3
 module Admin
4 4
   class ReportedStatusesController < BaseController
5 5
     before_action :set_report
6
-    before_action :set_status, only: [:update, :destroy]
7 6
 
8 7
     def create
9 8
       authorize :status, :update?
10 9
 
11
-      @form         = Form::StatusBatch.new(form_status_batch_params.merge(current_account: current_account))
10
+      @form         = Form::StatusBatch.new(form_status_batch_params.merge(current_account: current_account, action: action_from_button))
12 11
       flash[:alert] = I18n.t('admin.statuses.failed_to_execute') unless @form.save
13 12
 
14 13
       redirect_to admin_report_path(@report)
15 14
     end
16 15
 
17
-    def update
18
-      authorize @status, :update?
19
-      @status.update!(status_params)
20
-      log_action :update, @status
21
-      redirect_to admin_report_path(@report)
22
-    end
23
-
24
-    def destroy
25
-      authorize @status, :destroy?
26
-      RemovalWorker.perform_async(@status.id)
27
-      log_action :destroy, @status
28
-      render json: @status
29
-    end
30
-
31 16
     private
32 17
 
33 18
     def status_params
@@ -35,15 +20,21 @@ module Admin
35 20
     end
36 21
 
37 22
     def form_status_batch_params
38
-      params.require(:form_status_batch).permit(:action, status_ids: [])
23
+      params.require(:form_status_batch).permit(status_ids: [])
39 24
     end
40 25
 
41
-    def set_report
42
-      @report = Report.find(params[:report_id])
26
+    def action_from_button
27
+      if params[:nsfw_on]
28
+        'nsfw_on'
29
+      elsif params[:nsfw_off]
30
+        'nsfw_off'
31
+      elsif params[:delete]
32
+        'delete'
33
+      end
43 34
     end
44 35
 
45
-    def set_status
46
-      @status = @report.statuses.find(params[:id])
36
+    def set_report
37
+      @report = Report.find(params[:report_id])
47 38
     end
48 39
   end
49 40
 end

+ 26
- 10
app/controllers/admin/reports_controller.rb View File

@@ -11,45 +11,61 @@ module Admin
11 11
 
12 12
     def show
13 13
       authorize @report, :show?
14
-      @form = Form::StatusBatch.new
14
+
15
+      @report_note  = @report.notes.new
16
+      @report_notes = (@report.notes.latest + @report.history).sort_by(&:created_at)
17
+      @form         = Form::StatusBatch.new
15 18
     end
16 19
 
17 20
     def update
18 21
       authorize @report, :update?
19 22
       process_report
20
-      redirect_to admin_report_path(@report)
23
+
24
+      if @report.action_taken?
25
+        redirect_to admin_reports_path, notice: I18n.t('admin.reports.resolved_msg')
26
+      else
27
+        redirect_to admin_report_path(@report)
28
+      end
21 29
     end
22 30
 
23 31
     private
24 32
 
25 33
     def process_report
26 34
       case params[:outcome].to_s
35
+      when 'assign_to_self'
36
+        @report.update!(assigned_account_id: current_account.id)
37
+        log_action :assigned_to_self, @report
38
+      when 'unassign'
39
+        @report.update!(assigned_account_id: nil)
40
+        log_action :unassigned, @report
41
+      when 'reopen'
42
+        @report.unresolve!
43
+        log_action :reopen, @report
27 44
       when 'resolve'
28
-        @report.update!(action_taken_by_current_attributes)
45
+        @report.resolve!(current_account)
29 46
         log_action :resolve, @report
30 47
       when 'suspend'
31 48
         Admin::SuspensionWorker.perform_async(@report.target_account.id)
49
+
32 50
         log_action :resolve, @report
33 51
         log_action :suspend, @report.target_account
52
+
34 53
         resolve_all_target_account_reports
35 54
       when 'silence'
36 55
         @report.target_account.update!(silenced: true)
56
+
37 57
         log_action :resolve, @report
38 58
         log_action :silence, @report.target_account
59
+
39 60
         resolve_all_target_account_reports
40 61
       else
41 62
         raise ActiveRecord::RecordNotFound
42 63
       end
43
-    end
44
-
45
-    def action_taken_by_current_attributes
46
-      { action_taken: true, action_taken_by_account_id: current_account.id }
64
+      @report.reload
47 65
     end
48 66
 
49 67
     def resolve_all_target_account_reports
50
-      unresolved_reports_for_target_account.update_all(
51
-        action_taken_by_current_attributes
52
-      )
68
+      unresolved_reports_for_target_account.update_all(action_taken: true, action_taken_by_account_id: current_account.id)
53 69
     end
54 70
 
55 71
     def unresolved_reports_for_target_account

+ 12
- 25
app/controllers/admin/statuses_controller.rb View File

@@ -5,14 +5,13 @@ module Admin
5 5
     helper_method :current_params
6 6
 
7 7
     before_action :set_account
8
-    before_action :set_status, only: [:update, :destroy]
9 8
 
10 9
     PER_PAGE = 20
11 10
 
12 11
     def index
13 12
       authorize :status, :index?
14 13
 
15
-      @statuses = @account.statuses
14
+      @statuses = @account.statuses.where(visibility: [:public, :unlisted])
16 15
 
17 16
       if params[:media]
18 17
         account_media_status_ids = @account.media_attachments.attached.reorder(nil).select(:status_id).distinct
@@ -26,40 +25,18 @@ module Admin
26 25
     def create
27 26
       authorize :status, :update?
28 27
 
29
-      @form         = Form::StatusBatch.new(form_status_batch_params.merge(current_account: current_account))
28
+      @form         = Form::StatusBatch.new(form_status_batch_params.merge(current_account: current_account, action: action_from_button))
30 29
       flash[:alert] = I18n.t('admin.statuses.failed_to_execute') unless @form.save
31 30
 
32 31
       redirect_to admin_account_statuses_path(@account.id, current_params)
33 32
     end
34 33
 
35
-    def update
36
-      authorize @status, :update?
37
-      @status.update!(status_params)
38
-      log_action :update, @status
39
-      redirect_to admin_account_statuses_path(@account.id, current_params)
40
-    end
41
-
42
-    def destroy
43
-      authorize @status, :destroy?
44
-      RemovalWorker.perform_async(@status.id)
45
-      log_action :destroy, @status
46
-      render json: @status
47
-    end
48
-
49 34
     private
50 35
 
51
-    def status_params
52
-      params.require(:status).permit(:sensitive)
53
-    end
54
-
55 36
     def form_status_batch_params
56 37
       params.require(:form_status_batch).permit(:action, status_ids: [])
57 38
     end
58 39
 
59
-    def set_status
60
-      @status = @account.statuses.find(params[:id])
61
-    end
62
-
63 40
     def set_account
64 41
       @account = Account.find(params[:account_id])
65 42
     end
@@ -72,5 +49,15 @@ module Admin
72 49
         page: page > 1 && page,
73 50
       }.select { |_, value| value.present? }
74 51
     end
52
+
53
+    def action_from_button
54
+      if params[:nsfw_on]
55
+        'nsfw_on'
56
+      elsif params[:nsfw_off]
57
+        'nsfw_off'
58
+      elsif params[:delete]
59
+        'delete'
60
+      end
61
+    end
75 62
   end
76 63
 end

+ 3
- 1
app/controllers/api/base_controller.rb View File

@@ -66,8 +66,10 @@ class Api::BaseController < ApplicationController
66 66
   end
67 67
 
68 68
   def require_user!
69
-    if current_user
69
+    if current_user && !current_user.disabled?
70 70
       set_user_activity
71
+    elsif current_user
72
+      render json: { error: 'Your login is currently disabled' }, status: 403
71 73
     else
72 74
       render json: { error: 'This method requires an authenticated user' }, status: 422
73 75
     end

+ 13
- 1
app/controllers/api/v1/accounts/credentials_controller.rb View File

@@ -13,6 +13,7 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController
13 13
   def update
14 14
     @account = current_account
15 15
     UpdateAccountService.new.call(@account, account_params, raise_error: true)
16
+    UserSettingsDecorator.new(current_user).update(user_settings_params) if user_settings_params
16 17
     ActivityPub::UpdateDistributionWorker.perform_async(@account.id)
17 18
     render json: @account, serializer: REST::CredentialAccountSerializer
18 19
   end
@@ -20,6 +21,17 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController
20 21
   private
21 22
 
22 23
   def account_params
23
-    params.permit(:display_name, :note, :avatar, :header, :locked)
24
+    params.permit(:display_name, :note, :avatar, :header, :locked, :bot, fields_attributes: [:name, :value])
25
+  end
26
+
27
+  def user_settings_params
28
+    return nil unless params.key?(:source)
29
+
30
+    source_params = params.require(:source)
31
+
32
+    {
33
+      'setting_default_privacy' => source_params.fetch(:privacy, @account.user.setting_default_privacy),
34
+      'setting_default_sensitive' => source_params.fetch(:sensitive, @account.user.setting_default_sensitive),
35
+    }
24 36
   end
25 37
 end

+ 1
- 1
app/controllers/api/v1/accounts/follower_accounts_controller.rb View File

@@ -63,6 +63,6 @@ class Api::V1::Accounts::FollowerAccountsController < Api::BaseController
63 63
   end
64 64
 
65 65
   def pagination_params(core_params)
66
-    params.permit(:limit).merge(core_params)
66
+    params.slice(:limit).permit(:limit).merge(core_params)
67 67
   end
68 68
 end

+ 1
- 1
app/controllers/api/v1/accounts/following_accounts_controller.rb View File

@@ -63,6 +63,6 @@ class Api::V1::Accounts::FollowingAccountsController < Api::BaseController
63 63
   end
64 64
 
65 65
   def pagination_params(core_params)
66
-    params.permit(:limit).merge(core_params)
66
+    params.slice(:limit).permit(:limit).merge(core_params)
67 67
   end
68 68
 end

+ 1
- 1
app/controllers/api/v1/accounts/statuses_controller.rb View File

@@ -69,7 +69,7 @@ class Api::V1::Accounts::StatusesController < Api::BaseController
69 69
   end
70 70
 
71 71
   def pagination_params(core_params)
72
-    params.permit(:limit, :only_media, :exclude_replies).merge(core_params)
72
+    params.slice(:limit, :only_media, :exclude_replies).permit(:limit, :only_media, :exclude_replies).merge(core_params)
73 73
   end
74 74
 
75 75
   def insert_pagination_headers

+ 5
- 0
app/controllers/api/v1/accounts_controller.rb View File

@@ -5,6 +5,7 @@ class Api::V1::AccountsController < Api::BaseController
5 5
   before_action -> { doorkeeper_authorize! :follow }, only: [:follow, :unfollow, :block, :unblock, :mute, :unmute]
6 6
   before_action :require_user!, except: [:show]
7 7
   before_action :set_account
8
+  before_action :check_account_suspension, only: [:show]
8 9
 
9 10
   respond_to :json
10 11
 
@@ -54,4 +55,8 @@ class Api::V1::AccountsController < Api::BaseController
54 55
   def relationships(**options)
55 56
     AccountRelationshipsPresenter.new([@account.id], current_user.account_id, options)
56 57
   end
58
+
59
+  def check_account_suspension
60
+    gone if @account.suspended?
61
+  end
57 62
 end

+ 1
- 1
app/controllers/api/v1/blocks_controller.rb View File

@@ -57,6 +57,6 @@ class Api::V1::BlocksController < Api::BaseController
57 57
   end
58 58
 
59 59
   def pagination_params(core_params)
60
-    params.permit(:limit).merge(core_params)
60
+    params.slice(:limit).permit(:limit).merge(core_params)
61 61
   end
62 62
 end

+ 1
- 1
app/controllers/api/v1/domain_blocks_controller.rb View File

@@ -67,7 +67,7 @@ class Api::V1::DomainBlocksController < Api::BaseController
67 67
   end
68 68
 
69 69
   def pagination_params(core_params)
70
-    params.permit(:limit).merge(core_params)
70
+    params.slice(:limit).permit(:limit).merge(core_params)
71 71
   end
72 72
 
73 73
   def domain_block_params

+ 1
- 1
app/controllers/api/v1/favourites_controller.rb View File

@@ -66,6 +66,6 @@ class Api::V1::FavouritesController < Api::BaseController
66 66
   end
67 67
 
68 68
   def pagination_params(core_params)
69
-    params.permit(:limit).merge(core_params)
69
+    params.slice(:limit).permit(:limit).merge(core_params)
70 70
   end
71 71
 end

+ 1
- 1
app/controllers/api/v1/follow_requests_controller.rb View File

@@ -71,6 +71,6 @@ class Api::V1::FollowRequestsController < Api::BaseController
71 71
   end
72 72
 
73 73
   def pagination_params(core_params)
74
-    params.permit(:limit).merge(core_params)
74
+    params.slice(:limit).permit(:limit).merge(core_params)
75 75
   end
76 76
 end

+ 1
- 1
app/controllers/api/v1/lists/accounts_controller.rb View File

@@ -88,7 +88,7 @@ class Api::V1::Lists::AccountsController < Api::BaseController
88 88
   end
89 89
 
90 90
   def pagination_params(core_params)
91
-    params.permit(:limit).merge(core_params)
91
+    params.slice(:limit).permit(:limit).merge(core_params)
92 92
   end
93 93
 
94 94
   def unlimited?

+ 1
- 1
app/controllers/api/v1/mutes_controller.rb View File

@@ -59,6 +59,6 @@ class Api::V1::MutesController < Api::BaseController
59 59
   end
60 60
 
61 61
   def pagination_params(core_params)
62
-    params.permit(:limit).merge(core_params)
62
+    params.slice(:limit).permit(:limit).merge(core_params)
63 63
   end
64 64
 end

+ 1
- 1
app/controllers/api/v1/notifications_controller.rb View File

@@ -82,6 +82,6 @@ class Api::V1::NotificationsController < Api::BaseController
82 82
   end
83 83
 
84 84
   def pagination_params(core_params)
85
-    params.permit(:limit, exclude_types: []).merge(core_params)
85
+    params.slice(:limit, :exclude_types).permit(:limit, exclude_types: []).merge(core_params)
86 86
   end
87 87
 end

+ 1
- 1
app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb View File

@@ -77,6 +77,6 @@ class Api::V1::Statuses::FavouritedByAccountsController < Api::BaseController
77 77
   end
78 78
 
79 79
   def pagination_params(core_params)
80
-    params.permit(:limit).merge(core_params)
80
+    params.slice(:limit).permit(:limit).merge(core_params)
81 81
   end
82 82
 end

+ 2
- 2
app/controllers/api/v1/statuses/pins_controller.rb View File

@@ -39,7 +39,7 @@ class Api::V1::Statuses::PinsController < Api::BaseController
39 39
       adapter: ActivityPub::Adapter
40 40
     ).as_json
41 41
 
42
-    ActivityPub::RawDistributionWorker.perform_async(Oj.dump(json), current_account)
42
+    ActivityPub::RawDistributionWorker.perform_async(Oj.dump(json), current_account.id)
43 43
   end
44 44
 
45 45
   def distribute_remove_activity!
@@ -49,6 +49,6 @@ class Api::V1::Statuses::PinsController < Api::BaseController
49 49
       adapter: ActivityPub::Adapter
50 50
     ).as_json
51 51
 
52
-    ActivityPub::RawDistributionWorker.perform_async(Oj.dump(json), current_account)
52
+    ActivityPub::RawDistributionWorker.perform_async(Oj.dump(json), current_account.id)
53 53
   end
54 54
 end

+ 1
- 1
app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb View File

@@ -74,6 +74,6 @@ class Api::V1::Statuses::RebloggedByAccountsController < Api::BaseController
74 74
   end
75 75
 
76 76
   def pagination_params(core_params)
77
-    params.permit(:limit).merge(core_params)
77
+    params.slice(:limit).permit(:limit).merge(core_params)
78 78
   end
79 79
 end

+ 3
- 3
app/controllers/api/v1/statuses_controller.rb View File

@@ -17,8 +17,8 @@ class Api::V1::StatusesController < Api::BaseController
17 17
   end
18 18
 
19 19
   def context
20
-    ancestors_results   = @status.in_reply_to_id.nil? ? [] : @status.ancestors(current_account)
21
-    descendants_results = @status.descendants(current_account)
20
+    ancestors_results   = @status.in_reply_to_id.nil? ? [] : @status.ancestors(DEFAULT_STATUSES_LIMIT, current_account)
21
+    descendants_results = @status.descendants(DEFAULT_STATUSES_LIMIT, current_account)
22 22
     loaded_ancestors    = cache_collection(ancestors_results, Status)
23 23
     loaded_descendants  = cache_collection(descendants_results, Status)
24 24
 
@@ -76,7 +76,7 @@ class Api::V1::StatusesController < Api::BaseController
76 76
   end
77 77
 
78 78
   def pagination_params(core_params)
79
-    params.permit(:limit).merge(core_params)
79
+    params.slice(:limit).permit(:limit).merge(core_params)
80 80
   end
81 81
 
82 82
   def authorize_if_got_token

+ 60
- 0
app/controllers/api/v1/timelines/direct_controller.rb View File

@@ -0,0 +1,60 @@
1
+# frozen_string_literal: true
2
+
3
+class Api::V1::Timelines::DirectController < Api::BaseController
4
+  before_action -> { doorkeeper_authorize! :read }, only: [:show]
5
+  before_action :require_user!, only: [:show]
6
+  after_action :insert_pagination_headers, unless: -> { @statuses.empty? }
7
+
8
+  respond_to :json
9
+
10
+  def show
11
+    @statuses = load_statuses
12
+    render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
13
+  end
14
+
15
+  private
16
+
17
+  def load_statuses
18
+    cached_direct_statuses
19
+  end
20
+
21
+  def cached_direct_statuses
22
+    cache_collection direct_statuses, Status
23
+  end
24
+
25
+  def direct_statuses
26
+    direct_timeline_statuses.paginate_by_max_id(
27
+      limit_param(DEFAULT_STATUSES_LIMIT),
28
+      params[:max_id],
29
+      params[:since_id]
30
+    )
31
+  end
32
+
33
+  def direct_timeline_statuses
34
+    Status.as_direct_timeline(current_account)
35
+  end
36
+
37
+  def insert_pagination_headers
38
+    set_pagination_headers(next_path, prev_path)
39
+  end
40
+
41
+  def pagination_params(core_params)
42
+    params.permit(:local, :limit).merge(core_params)
43
+  end
44
+
45
+  def next_path
46
+    api_v1_timelines_direct_url pagination_params(max_id: pagination_max_id)
47
+  end
48
+
49
+  def prev_path
50
+    api_v1_timelines_direct_url pagination_params(since_id: pagination_since_id)
51
+  end
52
+
53
+  def pagination_max_id
54
+    @statuses.last.id
55
+  end
56
+
57
+  def pagination_since_id
58
+    @statuses.first.id
59
+  end
60
+end

+ 1
- 1
app/controllers/api/v1/timelines/home_controller.rb View File

@@ -43,7 +43,7 @@ class Api::V1::Timelines::HomeController < Api::BaseController
43 43
   end
44 44
 
45 45
   def pagination_params(core_params)
46
-    params.permit(:local, :limit).merge(core_params)
46
+    params.slice(:local, :limit).permit(:local, :limit).merge(core_params)
47 47
   end
48 48
 
49 49
   def next_path

+ 1
- 1
app/controllers/api/v1/timelines/list_controller.rb View File

@@ -45,7 +45,7 @@ class Api::V1::Timelines::ListController < Api::BaseController
45 45
   end
46 46
 
47 47
   def pagination_params(core_params)
48
-    params.permit(:limit).merge(core_params)
48
+    params.slice(:limit).permit(:limit).merge(core_params)
49 49
   end
50 50
 
51 51
   def next_path

+ 1
- 1
app/controllers/api/v1/timelines/public_controller.rb View File

@@ -45,7 +45,7 @@ class Api::V1::Timelines::PublicController < Api::BaseController
45 45
   end
46 46
 
47 47
   def pagination_params(core_params)
48
-    params.permit(:local, :limit, :only_media).merge(core_params)
48
+    params.slice(:local, :limit, :only_media).permit(:local, :limit, :only_media).merge(core_params)
49 49
   end
50 50
 
51 51
   def next_path

+ 1
- 1
app/controllers/api/v1/timelines/tag_controller.rb View File

@@ -54,7 +54,7 @@ class Api::V1::Timelines::TagController < Api::BaseController
54 54
   end
55 55
 
56 56
   def pagination_params(core_params)
57
-    params.permit(:local, :limit, :only_media).merge(core_params)
57
+    params.slice(:local, :limit, :only_media).permit(:local, :limit, :only_media).merge(core_params)
58 58
   end
59 59
 
60 60
   def next_path

+ 9
- 0
app/controllers/api/web/base_controller.rb View File

@@ -0,0 +1,9 @@
1
+# frozen_string_literal: true
2
+
3
+class Api::Web::BaseController < Api::BaseController
4
+  protect_from_forgery with: :exception
5
+
6
+  rescue_from ActionController::InvalidAuthenticityToken do
7
+    render json: { error: "Can't verify CSRF token authenticity." }, status: 422
8
+  end
9
+end

+ 8
- 5
app/controllers/api/web/embeds_controller.rb View File

@@ -1,6 +1,6 @@
1 1
 # frozen_string_literal: true
2 2
 
3
-class Api::Web::EmbedsController < Api::BaseController
3
+class Api::Web::EmbedsController < Api::Web::BaseController
4 4
   respond_to :json
5 5
 
6 6
   before_action :require_user!
@@ -9,9 +9,12 @@ class Api::Web::EmbedsController < Api::BaseController
9 9
     status = StatusFinder.new(params[:url]).status
10 10
     render json: status, serializer: OEmbedSerializer, width: 400
11 11
   rescue ActiveRecord::RecordNotFound
12
-    oembed = OEmbed::Providers.get(params[:url])
13
-    render json: Oj.dump(oembed.fields)
14
-  rescue OEmbed::NotFound
15
-    render json: {}, status: :not_found
12
+    oembed = FetchOEmbedService.new.call(params[:url])
13
+
14
+    if oembed
15
+      render json: oembed
16
+    else
17
+      render json: {}, status: :not_found
18
+    end
16 19
   end
17 20
 end

+ 17
- 11
app/controllers/api/web/push_subscriptions_controller.rb View File

@@ -1,15 +1,11 @@
1 1
 # frozen_string_literal: true
2 2
 
3
-class Api::Web::PushSubscriptionsController < Api::BaseController
3
+class Api::Web::PushSubscriptionsController < Api::Web::BaseController
4 4
   respond_to :json
5 5
 
6 6
   before_action :require_user!
7
-  protect_from_forgery with: :exception
8 7
 
9 8
   def create
10
-    params.require(:subscription).require(:endpoint)
11
-    params.require(:subscription).require(:keys).require([:auth, :p256dh])
12
-
13 9
     active_session = current_session
14 10
 
15 11
     unless active_session.web_push_subscription.nil?
@@ -29,12 +25,12 @@ class Api::Web::PushSubscriptionsController < Api::BaseController
29 25
       },
30 26
     }
31 27
 
32
-    data.deep_merge!(params[:data]) if params[:data]
28
+    data.deep_merge!(data_params) if params[:data]
33 29
 
34 30
     web_subscription = ::Web::PushSubscription.create!(
35
-      endpoint: params[:subscription][:endpoint],
36
-      key_p256dh: params[:subscription][:keys][:p256dh],
37
-      key_auth: params[:subscription][:keys][:auth],
31
+      endpoint: subscription_params[:endpoint],
32
+      key_p256dh: subscription_params[:keys][:p256dh],
33
+      key_auth: subscription_params[:keys][:auth],
38 34
       data: data
39 35
     )
40 36
 
@@ -44,12 +40,22 @@ class Api::Web::PushSubscriptionsController < Api::BaseController
44 40
   end
45 41