Skip to content

Commit

Permalink
upstream (#5)
Browse files Browse the repository at this point in the history
* Bump webpack from 4.43.0 to 4.44.0 (mastodon#14435)

Bumps [webpack](https://github.com/webpack/webpack) from 4.43.0 to 4.44.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v4.43.0...v4.44.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump tty-prompt from 0.21.0 to 0.22.0 (mastodon#14430)

Bumps [tty-prompt](https://github.com/piotrmurach/tty-prompt) from 0.21.0 to 0.22.0.
- [Release notes](https://github.com/piotrmurach/tty-prompt/releases)
- [Changelog](https://github.com/piotrmurach/tty-prompt/blob/master/CHANGELOG.md)
- [Commits](piotrmurach/tty-prompt@v0.21.0...v0.22.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump browserslist from 4.12.0 to 4.13.0 (mastodon#14409)

Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.12.0 to 4.13.0.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/master/CHANGELOG.md)
- [Commits](browserslist/browserslist@4.12.0...4.13.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump sidekiq from 6.1.0 to 6.1.1 (mastodon#14427)

Bumps [sidekiq](https://github.com/mperham/sidekiq) from 6.1.0 to 6.1.1.
- [Release notes](https://github.com/mperham/sidekiq/releases)
- [Changelog](https://github.com/mperham/sidekiq/blob/master/Changes.md)
- [Commits](sidekiq/sidekiq@v6.1.0...v6.1.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump posix-spawn from 58465d2e213991f8afb13b984854a49fcdcc980c to 0.3.15 (mastodon#14433)

Bumps [posix-spawn](https://github.com/rtomayko/posix-spawn) from 58465d2e213991f8afb13b984854a49fcdcc980c to 0.3.15. This release includes the previously tagged commit.
- [Release notes](https://github.com/rtomayko/posix-spawn/releases)
- [Commits](rtomayko/posix-spawn@58465d2...v0.3.15)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump strong_migrations from 0.6.8 to 0.7.1 (mastodon#14463)

Bumps [strong_migrations](https://github.com/ankane/strong_migrations) from 0.6.8 to 0.7.1.
- [Release notes](https://github.com/ankane/strong_migrations/releases)
- [Changelog](https://github.com/ankane/strong_migrations/blob/master/CHANGELOG.md)
- [Commits](ankane/strong_migrations@v0.6.8...v0.7.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump eslint from 6.8.0 to 7.5.0 (mastodon#14454)

* Bump eslint from 6.8.0 to 7.5.0

Bumps [eslint](https://github.com/eslint/eslint) from 6.8.0 to 7.5.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](eslint/eslint@v6.8.0...v7.5.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Fix .codeclimate.yml

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yamagishi Kazutoshi <ykzts@desire.sh>

* Fix handling of Reject Follow when a matching follow relationship exists (mastodon#14479)

* Add tests

* Fix handling of Reject Follow when a matching follow relationship exists

Regression from mastodon#12199

* Fix the hashtag judgment of the compose form to be the same as the server side (mastodon#14484)

* Fix wrong proptypes for onEditAccountNote (mastodon#14481)

Also add missing PropTypes to the correct component

Fixes mastodon#14478

* Fix new audio player features not working on Safari (mastodon#14465)

Fixes mastodon#14462

* helm: bump default image tag to v3.2.0 (mastodon#14476)

* Change content-type to be always computed from file data (mastodon#14452)

* Change content-type to be always computed from file data

Restore previous behavior, detecting the content-type isn't very
expensive, and some instances may serve files as application/octet-stream
regardless of their true type, making fetching media from them fail, while
it used to work pre-3.2.0.

* Add test

* Fix disabled boost icon being replaced by private boost icon on hover (mastodon#14456)

Fixes mastodon#14455

* Fix audio player on Safari (mastodon#14485)

* Fix thumbnail color extraction (mastodon#14464)

* Fix contrast calculation for thumbnail color extraction

Luminance calculation was using 0-255 RGB values instead of 0-1 sRGB values,
leading to incorrectly-computed contrast values.

Since we use ColorDiff already, just use its XYZ colorspace conversion code
to get the value.

* Require at least 3:1 contrast for both accent and foreground colors

* Lower required contrast for the accent color

* Fix audio/video player not using CDN_HOST in media paths on public pages (mastodon#14486)

* Bump aws-partitions from 1.345.0 to 1.349.0 (mastodon#14489)

Bumps [aws-partitions](https://github.com/aws/aws-sdk-ruby) from 1.345.0 to 1.349.0.
- [Release notes](https://github.com/aws/aws-sdk-ruby/releases)
- [Changelog](https://github.com/aws/aws-sdk-ruby/blob/master/gems/aws-partitions/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-ruby/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @babel/preset-env from 7.10.4 to 7.11.0 (mastodon#14502)

Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.10.4 to 7.11.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.11.0/packages/babel-preset-env)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump expect from 26.1.0 to 26.2.0 (mastodon#14507)

Bumps [expect](https://github.com/facebook/jest/tree/HEAD/packages/expect) from 26.1.0 to 26.2.0.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v26.2.0/packages/expect)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump elasticsearch from 7.8.0 to 7.8.1 (mastodon#14501)

Bumps [elasticsearch](https://github.com/elastic/elasticsearch-ruby) from 7.8.0 to 7.8.1.
- [Release notes](https://github.com/elastic/elasticsearch-ruby/releases)
- [Changelog](https://github.com/elastic/elasticsearch-ruby/blob/master/CHANGELOG.md)
- [Commits](elastic/elasticsearch-ruby@v7.8.0...v7.8.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump rubocop-ast from 0.2.0 to 0.3.0 (mastodon#14498)

Bumps [rubocop-ast](https://github.com/rubocop-hq/rubocop-ast) from 0.2.0 to 0.3.0.
- [Release notes](https://github.com/rubocop-hq/rubocop-ast/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop-ast/blob/master/CHANGELOG.md)
- [Commits](rubocop/rubocop-ast@v0.2.0...v0.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fallback to previous, more approximative hashtag RE on older browsers (mastodon#14513)

Fixes mastodon#14511

* Bump pghero from 2.6.0 to 2.7.0 (mastodon#14518)

Bumps [pghero](https://github.com/ankane/pghero) from 2.6.0 to 2.7.0.
- [Release notes](https://github.com/ankane/pghero/releases)
- [Changelog](https://github.com/ankane/pghero/blob/master/CHANGELOG.md)
- [Commits](ankane/pghero@v2.6.0...v2.7.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump eslint from 7.5.0 to 7.6.0 (mastodon#14508)

Bumps [eslint](https://github.com/eslint/eslint) from 7.5.0 to 7.6.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](eslint/eslint@v7.5.0...v7.6.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump excon from 0.75.0 to 0.76.0 (mastodon#14490)

Bumps [excon](https://github.com/excon/excon) from 0.75.0 to 0.76.0.
- [Release notes](https://github.com/excon/excon/releases)
- [Changelog](https://github.com/excon/excon/blob/master/changelog.txt)
- [Commits](excon/excon@v0.75.0...v0.76.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump csstype from 2.6.10 to 2.6.13 (mastodon#14503)

Bumps [csstype](https://github.com/frenic/csstype) from 2.6.10 to 2.6.13.
- [Release notes](https://github.com/frenic/csstype/releases)
- [Commits](frenic/csstype@v2.6.10...v2.6.13)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump jest from 26.0.1 to 26.2.2 (mastodon#14495)

Bumps [jest](https://github.com/facebook/jest) from 26.0.1 to 26.2.2.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](jestjs/jest@v26.0.1...v26.2.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump postcss-modules-local-by-default from 3.0.2 to 3.0.3 (mastodon#14505)

Bumps [postcss-modules-local-by-default](https://github.com/css-modules/postcss-modules-local-by-default) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/css-modules/postcss-modules-local-by-default/releases)
- [Changelog](https://github.com/css-modules/postcss-modules-local-by-default/blob/master/CHANGELOG.md)
- [Commits](css-modules/postcss-modules-local-by-default@v3.0.2...v3.0.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump dom-accessibility-api from 0.4.6 to 0.4.7 (mastodon#14496)

Bumps [dom-accessibility-api](https://github.com/eps1lon/dom-accessibility-api) from 0.4.6 to 0.4.7.
- [Release notes](https://github.com/eps1lon/dom-accessibility-api/releases)
- [Changelog](https://github.com/eps1lon/dom-accessibility-api/blob/main/CHANGELOG.md)
- [Commits](eps1lon/dom-accessibility-api@v0.4.6...v0.4.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @testing-library/jest-dom from 5.11.0 to 5.11.2 (mastodon#14497)

Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.11.0 to 5.11.2.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/master/CHANGELOG.md)
- [Commits](testing-library/jest-dom@v5.11.0...v5.11.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump minipass-pipeline from 1.2.3 to 1.2.4 (mastodon#14504)

Bumps minipass-pipeline from 1.2.3 to 1.2.4.

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump node-notifier from 7.0.1 to 7.0.2 (mastodon#14499)

Bumps [node-notifier](https://github.com/mikaelbr/node-notifier) from 7.0.1 to 7.0.2.
- [Release notes](https://github.com/mikaelbr/node-notifier/releases)
- [Changelog](https://github.com/mikaelbr/node-notifier/blob/master/CHANGELOG.md)
- [Commits](mikaelbr/node-notifier@v7.0.1...v7.0.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix eslint error (mastodon#14521)

* Fix crash when failing to load emoji picker (mastodon#14525)

Fixes mastodon#14523

* Cache result of SQL (mastodon#14534)

* Use default :edit routing (mastodon#14535)

* Fix `tootctl media` commands not handling snowflake ids for media_attachments (mastodon#14536)

* Add support for managing multiple stream subscriptions in a single connection (mastodon#14524)

* Add HTML form validation for the registration form (mastodon#14560)

* Add HTML-level validation of username in sign-up form

* Make required fields with incorrect values more visible

* Enable HTML form validation for the registration form

* Mark agreement checkbox as required client-side

* Add minimum length to password

* Add client-side password confirmation validation

* yarn.lock

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yamagishi Kazutoshi <ykzts@desire.sh>
Co-authored-by: ThibG <thib@sitedethib.com>
Co-authored-by: kedama <kedama@foresdon.jp>
Co-authored-by: Alex Dunn <dunn.alex@gmail.com>
Co-authored-by: abcang <abcang1015@gmail.com>
Co-authored-by: niwatori24 <62463593+niwatori24@users.noreply.github.com>
Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>
  • Loading branch information
9 people authored Aug 11, 2020
1 parent b1a2f97 commit a27c224
Show file tree
Hide file tree
Showing 28 changed files with 1,670 additions and 937 deletions.
2 changes: 1 addition & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ plugins:
enabled: true
eslint:
enabled: true
channel: eslint-6
channel: eslint-7
rubocop:
enabled: true
channel: rubocop-0-82
Expand Down
10 changes: 5 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ gem 'e2mmap', '~> 0.1.0'
gem 'hamlit-rails', '~> 0.2'
gem 'pg', '~> 1.2'
gem 'makara', '~> 0.4'
gem 'pghero', '~> 2.6'
gem 'pghero', '~> 2.7'
gem 'dotenv-rails', '~> 2.7'

gem 'aws-sdk-s3', '~> 1.75', require: false
Expand Down Expand Up @@ -74,7 +74,7 @@ gem 'oj', '~> 3.10'
gem 'ox', '~> 2.13'
gem 'parslet'
gem 'parallel', '~> 1.19'
gem 'posix-spawn', git: 'https://github.com/rtomayko/posix-spawn', ref: '58465d2e213991f8afb13b984854a49fcdcc980c'
gem 'posix-spawn'
gem 'pundit', '~> 2.1'
gem 'premailer-rails'
gem 'rack-attack', '~> 6.3'
Expand All @@ -86,16 +86,16 @@ gem 'mario-redis-lock', '~> 1.2', require: 'redis_lock'
gem 'rqrcode', '~> 1.1'
gem 'ruby-progressbar', '~> 1.10'
gem 'sanitize', '~> 5.2'
gem 'sidekiq', '~> 6.0'
gem 'sidekiq', '~> 6.1'
gem 'sidekiq-scheduler', '~> 3.0'
gem 'sidekiq-unique-jobs', '~> 6.0'
gem 'sidekiq-bulk', '~>0.2.0'
gem 'simple-navigation', '~> 4.1'
gem 'simple_form', '~> 5.0'
gem 'sprockets-rails', '~> 3.2', require: 'sprockets/railtie'
gem 'stoplight', '~> 2.2.1'
gem 'strong_migrations', '~> 0.6'
gem 'tty-prompt', '~> 0.21', require: false
gem 'strong_migrations', '~> 0.7'
gem 'tty-prompt', '~> 0.22', require: false
gem 'twitter-text', '~> 1.14'
gem 'tzinfo-data', '~> 1.2020'
gem 'webpacker', '~> 5.1'
Expand Down
60 changes: 25 additions & 35 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ GIT
health_check (4.0.0.pre)
rails (>= 4.0)

GIT
remote: https://github.com/rtomayko/posix-spawn
revision: 58465d2e213991f8afb13b984854a49fcdcc980c
ref: 58465d2e213991f8afb13b984854a49fcdcc980c
specs:
posix-spawn (0.3.13)

GIT
remote: https://github.com/tmm1/http_parser.rb
revision: 54b17ba8c7d8d20a16dfc65d1775241833219cf2
Expand Down Expand Up @@ -92,7 +85,7 @@ GEM
av (0.9.0)
cocaine (~> 0.5.3)
aws-eventstream (1.1.0)
aws-partitions (1.345.0)
aws-partitions (1.349.0)
aws-sdk-core (3.104.3)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
Expand Down Expand Up @@ -203,21 +196,20 @@ GEM
railties (>= 3.2)
e2mmap (0.1.0)
ed25519 (1.2.4)
elasticsearch (7.8.0)
elasticsearch-api (= 7.8.0)
elasticsearch-transport (= 7.8.0)
elasticsearch-api (7.8.0)
elasticsearch (7.8.1)
elasticsearch-api (= 7.8.1)
elasticsearch-transport (= 7.8.1)
elasticsearch-api (7.8.1)
multi_json
elasticsearch-dsl (0.1.9)
elasticsearch-transport (7.8.0)
elasticsearch-transport (7.8.1)
faraday (~> 1)
multi_json
encryptor (3.0.0)
equatable (0.6.1)
erubi (1.9.0)
et-orbi (1.2.4)
tzinfo
excon (0.75.0)
excon (0.76.0)
fabrication (2.21.1)
faker (2.13.0)
i18n (>= 1.6, < 2)
Expand Down Expand Up @@ -368,7 +360,6 @@ GEM
msgpack (1.3.3)
multi_json (1.15.0)
multipart-post (2.1.1)
necromancer (0.5.1)
net-ldap (0.16.2)
net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0)
Expand Down Expand Up @@ -411,13 +402,13 @@ GEM
parser (2.7.1.4)
ast (~> 2.4.1)
parslet (2.0.0)
pastel (0.7.4)
equatable (~> 0.6)
pastel (0.8.0)
tty-color (~> 0.5)
pg (1.2.3)
pghero (2.6.0)
pghero (2.7.0)
activerecord (>= 5)
pkg-config (1.4.1)
posix-spawn (0.3.15)
premailer (1.12.1)
addressable
css_parser (>= 1.6.0)
Expand Down Expand Up @@ -552,8 +543,8 @@ GEM
rubocop-ast (>= 0.0.3, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.2.0)
parser (>= 2.7.0.1)
rubocop-ast (0.3.0)
parser (>= 2.7.1.4)
rubocop-rails (2.6.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
Expand All @@ -569,7 +560,7 @@ GEM
nokogiri (>= 1.8.0)
nokogumbo (~> 2.0)
semantic_range (2.3.0)
sidekiq (6.1.0)
sidekiq (6.1.1)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
Expand Down Expand Up @@ -610,7 +601,7 @@ GEM
stoplight (2.2.1)
streamio-ffmpeg (3.0.2)
multi_json (~> 1.8)
strong_migrations (0.6.8)
strong_migrations (0.7.1)
activerecord (>= 5)
temple (0.8.2)
terminal-table (1.8.0)
Expand All @@ -624,14 +615,13 @@ GEM
tilt (2.0.10)
tty-color (0.5.1)
tty-cursor (0.7.1)
tty-prompt (0.21.0)
necromancer (~> 0.5.0)
pastel (~> 0.7.0)
tty-reader (~> 0.7.0)
tty-reader (0.7.0)
tty-prompt (0.22.0)
pastel (~> 0.8)
tty-reader (~> 0.8)
tty-reader (0.8.0)
tty-cursor (~> 0.7)
tty-screen (~> 0.7)
wisper (~> 2.0.0)
tty-screen (~> 0.8)
wisper (~> 2.0)
tty-screen (0.8.1)
twitter-text (1.14.7)
unf (~> 0.1.0)
Expand Down Expand Up @@ -748,9 +738,9 @@ DEPENDENCIES
parallel_tests (~> 3.1)
parslet
pg (~> 1.2)
pghero (~> 2.6)
pghero (~> 2.7)
pkg-config (~> 1.4)
posix-spawn!
posix-spawn
premailer-rails
private_address_check (~> 0.5)
pry-byebug (~> 3.9)
Expand All @@ -776,7 +766,7 @@ DEPENDENCIES
rubocop-rails (~> 2.6)
ruby-progressbar (~> 1.10)
sanitize (~> 5.2)
sidekiq (~> 6.0)
sidekiq (~> 6.1)
sidekiq-bulk (~> 0.2.0)
sidekiq-scheduler (~> 3.0)
sidekiq-unique-jobs (~> 6.0)
Expand All @@ -788,10 +778,10 @@ DEPENDENCIES
stackprof
stoplight (~> 2.2.1)
streamio-ffmpeg (~> 3.0)
strong_migrations (~> 0.6)
strong_migrations (~> 0.7)
thor (~> 0.20)
thwait (~> 0.2.0)
tty-prompt (~> 0.21)
tty-prompt (~> 0.22)
twitter-text (~> 1.14)
tzinfo-data (~> 1.2020)
webmock (~> 3.8)
Expand Down
99 changes: 89 additions & 10 deletions app/javascript/mastodon/actions/streaming.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-check

import { connectStream } from '../stream';
import {
updateTimeline,
Expand All @@ -19,24 +21,59 @@ import { getLocale } from '../locales';

const { messages } = getLocale();

export function connectTimelineStream (timelineId, path, pollingRefresh = null, accept = null) {
/**
* @param {number} max
* @return {number}
*/
const randomUpTo = max =>
Math.floor(Math.random() * Math.floor(max));

return connectStream (path, pollingRefresh, (dispatch, getState) => {
/**
* @param {string} timelineId
* @param {string} channelName
* @param {Object.<string, string>} params
* @param {Object} options
* @param {function(Function, Function): void} [options.fallback]
* @param {function(object): boolean} [options.accept]
* @return {function(): void}
*/
export const connectTimelineStream = (timelineId, channelName, params = {}, options = {}) =>
connectStream(channelName, params, (dispatch, getState) => {
const locale = getState().getIn(['meta', 'locale']);

let pollingId;

/**
* @param {function(Function, Function): void} fallback
*/
const useFallback = fallback => {
fallback(dispatch, () => {
pollingId = setTimeout(() => useFallback(fallback), 20000 + randomUpTo(20000));
});
};

return {
onConnect() {
dispatch(connectTimeline(timelineId));

if (pollingId) {
clearTimeout(pollingId);
pollingId = null;
}
},

onDisconnect() {
dispatch(disconnectTimeline(timelineId));

if (options.fallback) {
pollingId = setTimeout(() => useFallback(options.fallback), randomUpTo(40000));
}
},

onReceive (data) {
switch(data.event) {
case 'update':
dispatch(updateTimeline(timelineId, JSON.parse(data.payload), accept));
dispatch(updateTimeline(timelineId, JSON.parse(data.payload), options.accept));
break;
case 'delete':
dispatch(deleteFromTimelines(data.payload));
Expand All @@ -63,17 +100,59 @@ export function connectTimelineStream (timelineId, path, pollingRefresh = null,
},
};
});
}

/**
* @param {Function} dispatch
* @param {function(): void} done
*/
const refreshHomeTimelineAndNotification = (dispatch, done) => {
dispatch(expandHomeTimeline({}, () =>
dispatch(expandNotifications({}, () =>
dispatch(fetchAnnouncements(done))))));
};

export const connectUserStream = () => connectTimelineStream('home', 'user', refreshHomeTimelineAndNotification);
export const connectCommunityStream = ({ onlyMedia } = {}) => connectTimelineStream(`community${onlyMedia ? ':media' : ''}`, `public:local${onlyMedia ? ':media' : ''}`);
export const connectPublicStream = ({ onlyMedia, onlyRemote } = {}) => connectTimelineStream(`public${onlyRemote ? ':remote' : ''}${onlyMedia ? ':media' : ''}`, `public${onlyRemote ? ':remote' : ''}${onlyMedia ? ':media' : ''}`);
export const connectHashtagStream = (id, tag, local, accept) => connectTimelineStream(`hashtag:${id}${local ? ':local' : ''}`, `hashtag${local ? ':local' : ''}&tag=${tag}`, null, accept);
export const connectDirectStream = () => connectTimelineStream('direct', 'direct');
export const connectListStream = id => connectTimelineStream(`list:${id}`, `list&list=${id}`);
/**
* @return {function(): void}
*/
export const connectUserStream = () =>
connectTimelineStream('home', 'user', {}, { fallback: refreshHomeTimelineAndNotification });

/**
* @param {Object} options
* @param {boolean} [options.onlyMedia]
* @return {function(): void}
*/
export const connectCommunityStream = ({ onlyMedia } = {}) =>
connectTimelineStream(`community${onlyMedia ? ':media' : ''}`, `public:local${onlyMedia ? ':media' : ''}`);

/**
* @param {Object} options
* @param {boolean} [options.onlyMedia]
* @param {boolean} [options.onlyRemote]
* @return {function(): void}
*/
export const connectPublicStream = ({ onlyMedia, onlyRemote } = {}) =>
connectTimelineStream(`public${onlyRemote ? ':remote' : ''}${onlyMedia ? ':media' : ''}`, `public${onlyRemote ? ':remote' : ''}${onlyMedia ? ':media' : ''}`);

/**
* @param {string} columnId
* @param {string} tagName
* @param {boolean} onlyLocal
* @param {function(object): boolean} accept
* @return {function(): void}
*/
export const connectHashtagStream = (columnId, tagName, onlyLocal, accept) =>
connectTimelineStream(`hashtag:${columnId}${onlyLocal ? ':local' : ''}`, `hashtag${onlyLocal ? ':local' : ''}`, { tag: tagName }, { accept });

/**
* @return {function(): void}
*/
export const connectDirectStream = () =>
connectTimelineStream('direct', 'direct');

/**
* @param {string} listId
* @return {function(): void}
*/
export const connectListStream = listId =>
connectTimelineStream(`list:${listId}`, 'list', { list: listId });
10 changes: 10 additions & 0 deletions app/javascript/mastodon/features/account/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ class Header extends ImmutablePureComponent {
identity_props: ImmutablePropTypes.list,
onFollow: PropTypes.func.isRequired,
onBlock: PropTypes.func.isRequired,
onMention: PropTypes.func.isRequired,
onDirect: PropTypes.func.isRequired,
onReport: PropTypes.func.isRequired,
onReblogToggle: PropTypes.func.isRequired,
onMute: PropTypes.func.isRequired,
onBlockDomain: PropTypes.func.isRequired,
onUnblockDomain: PropTypes.func.isRequired,
onEndorseToggle: PropTypes.func.isRequired,
onAddToList: PropTypes.func.isRequired,
onEditAccountNote: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
domain: PropTypes.string.isRequired,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export default class Header extends ImmutablePureComponent {
onUnblockDomain: PropTypes.func.isRequired,
onEndorseToggle: PropTypes.func.isRequired,
onAddToList: PropTypes.func.isRequired,
onEditAccountNote: PropTypes.func.isRequired,
hideTabs: PropTypes.bool,
domain: PropTypes.string.isRequired,
};
Expand Down
Loading

0 comments on commit a27c224

Please sign in to comment.