From c5661b0f92dfb74845fdfdc556e91083f9906882 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 11 Aug 2019 13:14:51 +0200 Subject: [PATCH 01/17] Fix account search always returning exact match on paginated results (#11525) Fix #11365 --- app/services/account_search_service.rb | 44 ++++++++++++++++++-------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/app/services/account_search_service.rb b/app/services/account_search_service.rb index 7bdffbbd2..e1874d045 100644 --- a/app/services/account_search_service.rb +++ b/app/services/account_search_service.rb @@ -21,18 +21,22 @@ class AccountSearchService < BaseService if resolving_non_matching_remote_account? [ResolveAccountService.new.call("#{query_username}@#{query_domain}")].compact else - search_results_and_exact_match.compact.uniq.slice(0, limit) + search_results_and_exact_match.compact.uniq end end def resolving_non_matching_remote_account? - options[:resolve] && !exact_match && !domain_is_local? + offset.zero? && options[:resolve] && !exact_match? && !domain_is_local? end def search_results_and_exact_match - exact = [exact_match] - return exact if !exact[0].nil? && limit == 1 - exact + search_results.to_a + return search_results.to_a unless offset.zero? + + results = [exact_match] + + return results if exact_match? && limit == 1 + + results + search_results.to_a end def query_blank_or_hashtag? @@ -40,15 +44,15 @@ class AccountSearchService < BaseService end def split_query_string - @_split_query_string ||= query.gsub(/\A@/, '').split('@') + @split_query_string ||= query.gsub(/\A@/, '').split('@') end def query_username - @_query_username ||= split_query_string.first || '' + @query_username ||= split_query_string.first || '' end def query_domain - @_query_domain ||= query_without_split? ? nil : split_query_string.last + @query_domain ||= query_without_split? ? nil : split_query_string.last end def query_without_split? @@ -56,15 +60,21 @@ class AccountSearchService < BaseService end def domain_is_local? - @_domain_is_local ||= TagManager.instance.local_domain?(query_domain) + @domain_is_local ||= TagManager.instance.local_domain?(query_domain) end def search_from options[:following] && account ? account.following : Account end + def exact_match? + exact_match.present? + end + def exact_match - @_exact_match ||= begin + return @exact_match if defined?(@exact_match) + + @exact_match = begin if domain_is_local? search_from.without_suspended.find_local(query_username) else @@ -74,7 +84,7 @@ class AccountSearchService < BaseService end def search_results - @_search_results ||= begin + @search_results ||= begin if account advanced_search_results else @@ -84,11 +94,19 @@ class AccountSearchService < BaseService end def advanced_search_results - Account.advanced_search_for(terms_for_query, account, limit, options[:following], offset) + Account.advanced_search_for(terms_for_query, account, limit_for_non_exact_results, options[:following], offset) end def simple_search_results - Account.search_for(terms_for_query, limit, offset) + Account.search_for(terms_for_query, limit_for_non_exact_results, offset) + end + + def limit_for_non_exact_results + if offset.zero? && exact_match? + limit - 1 + else + limit + end end def terms_for_query From aebefc7ce9cff913c4f04bb94ebda428e755ecad Mon Sep 17 00:00:00 2001 From: kedama Date: Sun, 11 Aug 2019 20:15:18 +0900 Subject: [PATCH 02/17] Fix some emojis in profile metadata labels are not emojified. (#11534) --- app/models/account.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/account.rb b/app/models/account.rb index b205c8c9e..60c06aaf0 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -506,7 +506,7 @@ class Account < ApplicationRecord end def emojifiable_text - [note, display_name, fields.map(&:value)].join(' ') + [note, display_name, fields.map(&:name), fields.map(&:value)].join(' ') end def clean_feed_manager From 646f96d4486499416c9a369ad8886e09e453462c Mon Sep 17 00:00:00 2001 From: ThibG Date: Sun, 11 Aug 2019 22:59:40 +0200 Subject: [PATCH 03/17] Fix ActivityPub and REST API queries setting cookies and preventing caching (#11539) Regression from #8657 --- app/controllers/accounts_controller.rb | 2 ++ app/controllers/api/base_controller.rb | 2 ++ app/controllers/statuses_controller.rb | 2 ++ 3 files changed, 6 insertions(+) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 058a00a21..f153b63bb 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -9,6 +9,8 @@ class AccountsController < ApplicationController before_action :set_cache_headers before_action :set_body_classes + skip_around_action :set_locale, if: -> { request.format == :json } + def show respond_to do |format| format.html do diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb index 109e38ffa..de8fff30e 100644 --- a/app/controllers/api/base_controller.rb +++ b/app/controllers/api/base_controller.rb @@ -14,6 +14,8 @@ class Api::BaseController < ApplicationController protect_from_forgery with: :null_session + skip_around_action :set_locale + rescue_from ActiveRecord::RecordInvalid, Mastodon::ValidationError do |e| render json: { error: e.to_s }, status: 422 end diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb index 0693125ab..83131f484 100644 --- a/app/controllers/statuses_controller.rb +++ b/app/controllers/statuses_controller.rb @@ -18,6 +18,8 @@ class StatusesController < ApplicationController before_action :set_body_classes before_action :set_autoplay, only: :embed + skip_around_action :set_locale, if: -> { request.format == :json } + content_security_policy only: :embed do |p| p.frame_ancestors(false) end From 093e3756a7971df97cec68bca0d9c509a47ca073 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 11 Aug 2019 23:48:56 +0200 Subject: [PATCH 04/17] [Security] Bump nokogiri from 1.10.3 to 1.10.4 (#11540) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.3 to 1.10.4. **This update includes a security fix.** - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.3...v1.10.4) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index f185f3fa5..6a907b1e0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -376,7 +376,7 @@ GEM net-ssh (>= 2.6.5) net-ssh (5.0.2) nio4r (2.3.1) - nokogiri (1.10.3) + nokogiri (1.10.4) mini_portile2 (~> 2.4.0) nokogumbo (2.0.0) nokogiri (~> 1.8, >= 1.8.4) From 8a2afb576df42a4bf957fc2d98ba7b38545162de Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2019 20:06:04 +0900 Subject: [PATCH 05/17] Bump terser-webpack-plugin from 1.3.0 to 1.4.1 (#11542) Bumps [terser-webpack-plugin](https://github.com/webpack-contrib/terser-webpack-plugin) from 1.3.0 to 1.4.1. - [Release notes](https://github.com/webpack-contrib/terser-webpack-plugin/releases) - [Changelog](https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/CHANGELOG.md) - [Commits](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v1.3.0...v1.4.1) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- yarn.lock | 102 +++++++++++++++++++++++++++++++++++---------------- 2 files changed, 71 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index 0aaf47802..32f5e4481 100644 --- a/package.json +++ b/package.json @@ -154,7 +154,7 @@ "sass-loader": "^7.0.3", "stringz": "^2.0.0", "substring-trie": "^1.0.2", - "terser-webpack-plugin": "^1.3.0", + "terser-webpack-plugin": "^1.4.1", "throng": "^4.0.0", "tiny-queue": "^0.2.1", "uuid": "^3.1.0", diff --git a/yarn.lock b/yarn.lock index 238b0ce96..4647472b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1965,6 +1965,11 @@ bluebird@^3.5.1, bluebird@^3.5.3: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" integrity sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw== +bluebird@^3.5.5: + version "3.5.5" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.5.tgz#a8d0afd73251effbbd5fe384a77d73003c17a71f" + integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w== + blurhash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/blurhash/-/blurhash-1.0.0.tgz#9087bc5cc4d482f1305059d7410df4133adcab2e" @@ -2187,7 +2192,7 @@ bytes@3.1.0: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== -cacache@^11.2.0, cacache@^11.3.2: +cacache@^11.2.0: version "11.3.2" resolved "https://registry.yarnpkg.com/cacache/-/cacache-11.3.2.tgz#2d81e308e3d258ca38125b676b98b2ac9ce69bfa" integrity sha512-E0zP4EPGDOaT2chM08Als91eYnf8Z+eH1awwwVsngUmgppfM5jjJ8l3z5vO5p5w/I3LsiXawb1sW0VY65pQABg== @@ -2207,6 +2212,27 @@ cacache@^11.2.0, cacache@^11.3.2: unique-filename "^1.1.1" y18n "^4.0.0" +cacache@^12.0.2: + version "12.0.2" + resolved "https://registry.yarnpkg.com/cacache/-/cacache-12.0.2.tgz#8db03205e36089a3df6954c66ce92541441ac46c" + integrity sha512-ifKgxH2CKhJEg6tNdAwziu6Q33EvuG26tYcda6PT3WKisZcYDXsnEdnRv67Po3yCzFfaSoMjGZzJyD2c3DT1dg== + dependencies: + bluebird "^3.5.5" + chownr "^1.1.1" + figgy-pudding "^3.5.1" + glob "^7.1.4" + graceful-fs "^4.1.15" + infer-owner "^1.0.3" + lru-cache "^5.1.1" + mississippi "^3.0.0" + mkdirp "^0.5.1" + move-concurrently "^1.0.1" + promise-inflight "^1.0.1" + rimraf "^2.6.3" + ssri "^6.0.1" + unique-filename "^1.1.1" + y18n "^4.0.0" + cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" @@ -2530,7 +2556,7 @@ combined-stream@^1.0.6, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -commander@^2.11.0, commander@^2.18.0, commander@^2.19.0, commander@^2.8.1, commander@~2.20.0: +commander@^2.11.0, commander@^2.18.0, commander@^2.19.0, commander@^2.20.0, commander@^2.8.1, commander@~2.20.0: version "2.20.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== @@ -4231,13 +4257,13 @@ finalhandler@~1.1.2: statuses "~1.5.0" unpipe "~1.0.0" -find-cache-dir@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.0.0.tgz#4c1faed59f45184530fb9d7fa123a4d04a98472d" - integrity sha512-LDUY6V1Xs5eFskUVYtIwatojt6+9xC9Chnlk/jYOOvn3FAFfSaWddxahDGyNHh0b2dMXa6YW2m0tk8TdVaXHlA== +find-cache-dir@^2.0.0, find-cache-dir@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7" + integrity sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ== dependencies: commondir "^1.0.1" - make-dir "^1.0.0" + make-dir "^2.0.0" pkg-dir "^3.0.0" find-cache-dir@^3.0.0: @@ -4549,7 +4575,7 @@ glob-parent@^5.0.0: dependencies: is-glob "^4.0.1" -glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@~7.1.1: +glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@~7.1.1: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== @@ -5048,6 +5074,11 @@ indexof@0.0.1: resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" integrity sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10= +infer-owner@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467" + integrity sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A== + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -6359,13 +6390,21 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" -make-dir@^1.0.0, make-dir@^1.3.0: +make-dir@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" integrity sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ== dependencies: pify "^3.0.0" +make-dir@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" + integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== + dependencies: + pify "^4.0.1" + semver "^5.6.0" + make-dir@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.0.0.tgz#1b5f39f6b9270ed33f9f054c5c0f84304989f801" @@ -9378,10 +9417,10 @@ source-map-support@^0.5.6: buffer-from "^1.0.0" source-map "^0.6.0" -source-map-support@~0.5.10: - version "0.5.12" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599" - integrity sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ== +source-map-support@~0.5.12: + version "0.5.13" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" + integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -9796,30 +9835,29 @@ tcomb@^2.5.0: resolved "https://registry.yarnpkg.com/tcomb/-/tcomb-2.7.0.tgz#10d62958041669a5d53567b9a4ee8cde22b1c2b0" integrity sha1-ENYpWAQWaaXVNWe5pO6M3iKxwrA= -terser-webpack-plugin@^1.1.0, terser-webpack-plugin@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.3.0.tgz#69aa22426299f4b5b3775cbed8cb2c5d419aa1d4" - integrity sha512-W2YWmxPjjkUcOWa4pBEv4OP4er1aeQJlSo2UhtCFQCuRXEHjOFscO8VyWHj9JLlA0RzQb8Y2/Ta78XZvT54uGg== +terser-webpack-plugin@^1.1.0, terser-webpack-plugin@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz#61b18e40eaee5be97e771cdbb10ed1280888c2b4" + integrity sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg== dependencies: - cacache "^11.3.2" - find-cache-dir "^2.0.0" + cacache "^12.0.2" + find-cache-dir "^2.1.0" is-wsl "^1.1.0" - loader-utils "^1.2.3" schema-utils "^1.0.0" serialize-javascript "^1.7.0" source-map "^0.6.1" - terser "^4.0.0" - webpack-sources "^1.3.0" + terser "^4.1.2" + webpack-sources "^1.4.0" worker-farm "^1.7.0" -terser@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-4.0.0.tgz#ef356f6f359a963e2cc675517f21c1c382877374" - integrity sha512-dOapGTU0hETFl1tCo4t56FN+2jffoKyER9qBGoUFyZ6y7WLoKT0bF+lAYi6B6YsILcGF3q1C2FBh8QcKSCgkgA== +terser@^4.1.2: + version "4.1.4" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.1.4.tgz#4478b6a08bb096a61e793fea1a4434408bab936c" + integrity sha512-+ZwXJvdSwbd60jG0Illav0F06GDJF0R4ydZ21Q3wGAFKoBGyJGo34F63vzJHgvYxc1ukOtIjvwEvl9MkjzM6Pg== dependencies: - commander "^2.19.0" + commander "^2.20.0" source-map "~0.6.1" - source-map-support "~0.5.10" + source-map-support "~0.5.12" test-exclude@^5.0.0: version "5.1.0" @@ -10408,10 +10446,10 @@ webpack-merge@^4.2.1: dependencies: lodash "^4.17.5" -webpack-sources@^1.0.0, webpack-sources@^1.0.1, webpack-sources@^1.1.0, webpack-sources@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.3.0.tgz#2a28dcb9f1f45fe960d8f1493252b5ee6530fa85" - integrity sha512-OiVgSrbGu7NEnEvQJJgdSFPl2qWKkWq5lHMhgiToIiN9w34EBnjYzSYs+VbL5KoYiLNtFFa7BZIKxRED3I32pA== +webpack-sources@^1.0.0, webpack-sources@^1.0.1, webpack-sources@^1.1.0, webpack-sources@^1.3.0, webpack-sources@^1.4.0: + version "1.4.3" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933" + integrity sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ== dependencies: source-list-map "^2.0.0" source-map "~0.6.1" From 0b288903575f66f0db92709cfd2d705a1de30fd8 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2019 20:07:57 +0900 Subject: [PATCH 06/17] Bump css-loader from 3.1.0 to 3.2.0 (#11544) Bumps [css-loader](https://github.com/webpack-contrib/css-loader) from 3.1.0 to 3.2.0. - [Release notes](https://github.com/webpack-contrib/css-loader/releases) - [Changelog](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md) - [Commits](https://github.com/webpack-contrib/css-loader/compare/v3.1.0...v3.2.0) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 32f5e4481..df5157848 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "classnames": "^2.2.5", "compression-webpack-plugin": "^3.0.0", "cross-env": "^5.1.4", - "css-loader": "^3.1.0", + "css-loader": "^3.2.0", "cssnano": "^4.1.10", "detect-passive-events": "^1.0.2", "dotenv": "^8.0.0", diff --git a/yarn.lock b/yarn.lock index 4647472b5..80248b9ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2875,10 +2875,10 @@ css-list-helpers@^1.0.1: dependencies: tcomb "^2.5.0" -css-loader@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-3.1.0.tgz#6f008b993b8ce812e6bab57f3cbfdc7a7cf28685" - integrity sha512-MuL8WsF/KSrHCBCYaozBKlx+r7vIfUaDTEreo7wR7Vv3J6N0z6fqWjRk3e/6wjneitXN1r/Y9FTK1psYNOBdJQ== +css-loader@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-3.2.0.tgz#bb570d89c194f763627fcf1f80059c6832d009b2" + integrity sha512-QTF3Ud5H7DaZotgdcJjGMvyDj5F3Pn1j/sC6VBEOVp94cbwqyIBdcs/quzj4MC1BKQSrTpQznegH/5giYbhnCQ== dependencies: camelcase "^5.3.1" cssesc "^3.0.0" From 4b21a9db2f0f03cf57f6369e9b5176a84e3b4f98 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2019 20:08:37 +0900 Subject: [PATCH 07/17] Bump webpack-dev-server from 3.7.2 to 3.8.0 (#11546) Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 3.7.2 to 3.8.0. - [Release notes](https://github.com/webpack/webpack-dev-server/releases) - [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md) - [Commits](https://github.com/webpack/webpack-dev-server/compare/v3.7.2...v3.8.0) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- yarn.lock | 53 +++++++++++++++++++++++++++++----------------------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index df5157848..812f5849c 100644 --- a/package.json +++ b/package.json @@ -180,7 +180,7 @@ "react-intl-translations-manager": "^5.0.3", "react-test-renderer": "^16.8.6", "sass-lint": "^1.13.1", - "webpack-dev-server": "^3.7.2", + "webpack-dev-server": "^3.8.0", "yargs": "^13.3.0" } } diff --git a/yarn.lock b/yarn.lock index 80248b9ac..072eb48e3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5229,6 +5229,11 @@ is-absolute-url@^2.0.0: resolved "https://registry.yarnpkg.com/is-absolute-url/-/is-absolute-url-2.1.0.tgz#50530dfb84fcc9aa7dbe7852e83a37b93b9f2aa6" integrity sha1-UFMN+4T8yap9vnhS6Do3uTufKqY= +is-absolute-url@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-absolute-url/-/is-absolute-url-3.0.0.tgz#eb21d69df2ed8ef72a3e6f243e216563036a0913" + integrity sha512-3OkP8XrM2Xq4/IxsJnClfMp3OaM3TAatLPLKPeWcxLBTrpe6hihwtX+XZfJTcXg/FTRi4qjy0y/C5qiyNxY24g== + is-accessor-descriptor@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" @@ -7620,10 +7625,10 @@ pn@^1.1.0: resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA== -portfinder@^1.0.20: - version "1.0.20" - resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.20.tgz#bea68632e54b2e13ab7b0c4775e9b41bf270e44a" - integrity sha512-Yxe4mTyDzTd59PZJY4ojZR8F+E5e97iq2ZOHPz3HDgSvYC5siNad2tLooQ5y5QHyQhc3xVqvyk/eNA3wuoa7Sw== +portfinder@^1.0.21: + version "1.0.21" + resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.21.tgz#60e1397b95ac170749db70034ece306b9a27e324" + integrity sha512-ESabpDCzmBS3ekHbmpAIiESq3udRsCBGiBZLsC+HgBKv2ezb0R4oG+7RnYEVZ/ZCfhel5Tx3UzdNWA0Lox2QCA== dependencies: async "^1.5.2" debug "^2.2.0" @@ -9164,10 +9169,10 @@ semver@4.3.2: resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.2.tgz#c7a07158a80bedd052355b770d82d6640f803be7" integrity sha1-x6BxWKgL7dBSNVt3DYLWZA+AO+c= -semver@^6.0.0, semver@^6.1.0, semver@^6.1.1, semver@^6.1.2: - version "6.2.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.2.0.tgz#4d813d9590aaf8a9192693d6c85b9344de5901db" - integrity sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A== +semver@^6.0.0, semver@^6.1.0, semver@^6.1.2, semver@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== send@0.17.1: version "0.17.1" @@ -9483,10 +9488,10 @@ spdy-transport@^3.0.0: readable-stream "^3.0.6" wbuf "^1.7.3" -spdy@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/spdy/-/spdy-4.0.0.tgz#81f222b5a743a329aa12cea6a390e60e9b613c52" - integrity sha512-ot0oEGT/PGUpzf/6uk4AWLqkq+irlqHXkrdbk51oWONh3bxQmBuljxPNl66zlRRcIJStWq0QkLUCPOPjgjvU0Q== +spdy@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/spdy/-/spdy-4.0.1.tgz#6f12ed1c5db7ea4f24ebb8b89ba58c87c08257f2" + integrity sha512-HeZS3PBdMA+sZSu0qwpCxl3DeALD5ASx8pAX0jZdKXSpPWbQ6SYGnlg3BBmYLx5LtiZrmkAZfErCm2oECBcioA== dependencies: debug "^4.1.0" handle-thing "^2.0.0" @@ -10394,10 +10399,10 @@ webpack-dev-middleware@^3.7.0: range-parser "^1.2.1" webpack-log "^2.0.0" -webpack-dev-server@^3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.7.2.tgz#f79caa5974b7f8b63268ef5421222a8486d792f5" - integrity sha512-mjWtrKJW2T9SsjJ4/dxDC2fkFVUw8jlpemDERqV0ZJIkjjjamR2AbQlr3oz+j4JLhYCHImHnXZK5H06P2wvUew== +webpack-dev-server@^3.8.0: + version "3.8.0" + resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.8.0.tgz#06cc4fc2f440428508d0e9770da1fef10e5ef28d" + integrity sha512-Hs8K9yI6pyMvGkaPTeTonhD6JXVsigXDApYk9JLW4M7viVBspQvb1WdAcWxqtmttxNW4zf2UFLsLNe0y87pIGQ== dependencies: ansi-html "0.0.7" bonjour "^3.5.0" @@ -10412,23 +10417,25 @@ webpack-dev-server@^3.7.2: import-local "^2.0.0" internal-ip "^4.3.0" ip "^1.1.5" + is-absolute-url "^3.0.0" killable "^1.0.1" loglevel "^1.6.3" opn "^5.5.0" p-retry "^3.0.1" - portfinder "^1.0.20" + portfinder "^1.0.21" schema-utils "^1.0.0" selfsigned "^1.10.4" - semver "^6.1.1" + semver "^6.3.0" serve-index "^1.9.1" sockjs "0.3.19" sockjs-client "1.3.0" - spdy "^4.0.0" + spdy "^4.0.1" strip-ansi "^3.0.1" supports-color "^6.1.0" url "^0.11.0" webpack-dev-middleware "^3.7.0" webpack-log "^2.0.0" + ws "^6.2.1" yargs "12.0.5" webpack-log@^2.0.0: @@ -10626,10 +10633,10 @@ ws@^5.2.0: dependencies: async-limiter "~1.0.0" -ws@^6.0.0: - version "6.1.2" - resolved "https://registry.yarnpkg.com/ws/-/ws-6.1.2.tgz#3cc7462e98792f0ac679424148903ded3b9c3ad8" - integrity sha512-rfUqzvz0WxmSXtJpPMX2EeASXabOrSMk1ruMOV3JBTBjo4ac2lDjGGsbQSyxj8Odhw5fBib8ZKEjDNvgouNKYw== +ws@^6.0.0, ws@^6.2.1: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" + integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA== dependencies: async-limiter "~1.0.0" From 0617198e41d9ad3c2c27a140ad0e16f7701b3dc6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2019 20:10:16 +0900 Subject: [PATCH 08/17] Bump faker from 2.1.0 to 2.1.2 (#11547) Bumps [faker](https://github.com/faker-ruby/faker) from 2.1.0 to 2.1.2. - [Release notes](https://github.com/faker-ruby/faker/releases) - [Changelog](https://github.com/faker-ruby/faker/blob/master/CHANGELOG.md) - [Commits](https://github.com/faker-ruby/faker/compare/v2.1.0...v2.1.2) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6a907b1e0..f88b433f5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -229,8 +229,8 @@ GEM tzinfo excon (0.62.0) fabrication (2.20.2) - faker (2.1.0) - i18n (>= 0.7) + faker (2.1.2) + i18n (>= 0.8) faraday (0.15.0) multipart-post (>= 1.2, < 3) fast_blank (1.0.0) From ff1333ff408a1224518e41cd051e5685e7192145 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2019 20:11:18 +0900 Subject: [PATCH 09/17] Bump puma from 4.0.1 to 4.1.0 (#11548) Bumps [puma](https://github.com/puma/puma) from 4.0.1 to 4.1.0. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](https://github.com/puma/puma/compare/v4.0.1...v4.1.0) Signed-off-by: dependabot-preview[bot] --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 263be0ac3..f426e4113 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ ruby '>= 2.4.0', '< 2.7.0' gem 'pkg-config', '~> 1.3' -gem 'puma', '~> 4.0' +gem 'puma', '~> 4.1' gem 'rails', '~> 5.2.3' gem 'thor', '~> 0.20' diff --git a/Gemfile.lock b/Gemfile.lock index f88b433f5..01675367d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -375,7 +375,7 @@ GEM net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (5.0.2) - nio4r (2.3.1) + nio4r (2.4.0) nokogiri (1.10.4) mini_portile2 (~> 2.4.0) nokogumbo (2.0.0) @@ -441,7 +441,7 @@ GEM pry-rails (0.3.9) pry (>= 0.10.4) public_suffix (3.1.1) - puma (4.0.1) + puma (4.1.0) nio4r (~> 2.0) pundit (2.0.1) activesupport (>= 3.0.0) @@ -746,7 +746,7 @@ DEPENDENCIES private_address_check (~> 0.5) pry-byebug (~> 3.7) pry-rails (~> 0.3) - puma (~> 4.0) + puma (~> 4.1) pundit (~> 2.0) rack-attack (~> 6.1) rack-cors (~> 1.0) From ccb2b6afb16c2e987cf72507e9ac8bab9bf87495 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2019 20:11:55 +0900 Subject: [PATCH 10/17] Bump devise-two-factor from 3.0.3 to 3.1.0 (#11550) Bumps [devise-two-factor](https://github.com/tinfoil/devise-two-factor) from 3.0.3 to 3.1.0. - [Release notes](https://github.com/tinfoil/devise-two-factor/releases) - [Changelog](https://github.com/tinfoil/devise-two-factor/blob/master/CHANGELOG.md) - [Commits](https://github.com/tinfoil/devise-two-factor/compare/v3.0.3...v3.1.0) Signed-off-by: dependabot-preview[bot] --- Gemfile | 2 +- Gemfile.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index f426e4113..10c87f297 100644 --- a/Gemfile +++ b/Gemfile @@ -32,7 +32,7 @@ gem 'iso-639' gem 'chewy', '~> 5.0' gem 'cld3', '~> 3.2.4' gem 'devise', '~> 4.6' -gem 'devise-two-factor', '~> 3.0' +gem 'devise-two-factor', '~> 3.1' group :pam_authentication, optional: true do gem 'devise_pam_authenticatable2', '~> 9.2' diff --git a/Gemfile.lock b/Gemfile.lock index 01675367d..284a09734 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -112,7 +112,7 @@ GEM aws-sigv4 (~> 1.1) aws-sigv4 (1.1.0) aws-eventstream (~> 1.0, >= 1.0.2) - bcrypt (3.1.12) + bcrypt (3.1.13) benchmark-ips (2.7.2) better_errors (2.5.1) coderay (>= 1.0.0) @@ -194,11 +194,11 @@ GEM railties (>= 4.1.0, < 6.0) responders warden (~> 1.2.3) - devise-two-factor (3.0.3) - activesupport (< 5.3) + devise-two-factor (3.1.0) + activesupport (< 6.1) attr_encrypted (>= 1.3, < 4, != 2) devise (~> 4.0) - railties (< 5.3) + railties (< 6.1) rotp (~> 2.0) devise_pam_authenticatable2 (9.2.0) devise (>= 4.0.0) @@ -476,7 +476,7 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.1.0) + rails-html-sanitizer (1.2.0) loofah (~> 2.2, >= 2.2.2) rails-i18n (5.1.3) i18n (>= 0.7, < 2) @@ -518,9 +518,9 @@ GEM regexp_parser (1.6.0) request_store (1.4.1) rack (>= 1.4) - responders (2.4.1) - actionpack (>= 4.2.0, < 6.0) - railties (>= 4.2.0, < 6.0) + responders (3.0.0) + actionpack (>= 5.0) + railties (>= 5.0) rotp (2.1.2) rpam2 (4.0.2) rqrcode (0.10.1) @@ -690,7 +690,7 @@ DEPENDENCIES connection_pool derailed_benchmarks devise (~> 4.6) - devise-two-factor (~> 3.0) + devise-two-factor (~> 3.1) devise_pam_authenticatable2 (~> 9.2) doorkeeper (~> 5.1) dotenv-rails (~> 2.7) From 6fb89d9e9b020d429a134ea3fdd4ed194fccae4b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2019 20:14:22 +0900 Subject: [PATCH 11/17] Bump parallel_tests from 2.29.1 to 2.29.2 (#11549) Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 2.29.1 to 2.29.2. - [Release notes](https://github.com/grosser/parallel_tests/releases) - [Commits](https://github.com/grosser/parallel_tests/compare/v2.29.1...v2.29.2) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 284a09734..d520f8a71 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -412,7 +412,7 @@ GEM av (~> 0.9.0) paperclip (>= 2.5.2) parallel (1.17.0) - parallel_tests (2.29.1) + parallel_tests (2.29.2) parallel parser (2.6.3.0) ast (~> 2.4.0) From 74111bbb1c643aae516bd4bcb201052161ee725d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2019 21:19:49 +0900 Subject: [PATCH 12/17] Bump sass from 1.22.7 to 1.22.9 (#11545) Bumps [sass](https://github.com/sass/dart-sass) from 1.22.7 to 1.22.9. - [Release notes](https://github.com/sass/dart-sass/releases) - [Changelog](https://github.com/sass/dart-sass/blob/master/CHANGELOG.md) - [Commits](https://github.com/sass/dart-sass/compare/1.22.7...1.22.9) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 812f5849c..30eaeb7c6 100644 --- a/package.json +++ b/package.json @@ -150,7 +150,7 @@ "requestidlecallback": "^0.3.0", "reselect": "^4.0.0", "rimraf": "^2.6.3", - "sass": "^1.22.7", + "sass": "^1.22.9", "sass-loader": "^7.0.3", "stringz": "^2.0.0", "substring-trie": "^1.0.2", diff --git a/yarn.lock b/yarn.lock index 072eb48e3..9e1515e7d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9102,10 +9102,10 @@ sass-loader@^7.0.3: pify "^3.0.0" semver "^5.5.0" -sass@^1.22.7: - version "1.22.7" - resolved "https://registry.yarnpkg.com/sass/-/sass-1.22.7.tgz#5a1a77dc11aa659db4e782d238bf9f3d44a60546" - integrity sha512-ahREi0AdG7RTovSv14+yd1prQSfIvFcrDpOsth5EQf1+RM7SvOxsSttzNQaFmK1aa/k/3vyYwlYF5l0Xl+6c+g== +sass@^1.22.9: + version "1.22.9" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.22.9.tgz#41a2ed6038027f58be2bd5041293452a29c2cb84" + integrity sha512-FzU1X2V8DlnqabrL4u7OBwD2vcOzNMongEJEx3xMEhWY/v26FFR3aG0hyeu2T965sfR0E9ufJwmG+Qjz78vFPQ== dependencies: chokidar ">=2.0.0 <4.0.0" From 789cb3c028a5394973830ea003757b5e1ac9f33a Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 12 Aug 2019 17:52:12 +0200 Subject: [PATCH 13/17] Revert bcrypt to 3.1.12 (#11555) --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index d520f8a71..7861a85da 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -112,7 +112,7 @@ GEM aws-sigv4 (~> 1.1) aws-sigv4 (1.1.0) aws-eventstream (~> 1.0, >= 1.0.2) - bcrypt (3.1.13) + bcrypt (3.1.12) benchmark-ips (2.7.2) better_errors (2.5.1) coderay (>= 1.0.0) From 5f63339744eecd75b1065135559ddbe688636be1 Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 12 Aug 2019 22:26:07 +0200 Subject: [PATCH 14/17] Fix more ActivityPub queries setting cookies and preventing caching (#11557) --- app/controllers/follower_accounts_controller.rb | 2 ++ app/controllers/following_accounts_controller.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/controllers/follower_accounts_controller.rb b/app/controllers/follower_accounts_controller.rb index 6e873de5b..892c51cf4 100644 --- a/app/controllers/follower_accounts_controller.rb +++ b/app/controllers/follower_accounts_controller.rb @@ -7,6 +7,8 @@ class FollowerAccountsController < ApplicationController before_action :require_signature!, if: -> { request.format == :json && authorized_fetch_mode? } before_action :set_cache_headers + skip_around_action :set_locale, if: -> { request.format == :json } + def index respond_to do |format| format.html do diff --git a/app/controllers/following_accounts_controller.rb b/app/controllers/following_accounts_controller.rb index 07d62f7dd..653d9a486 100644 --- a/app/controllers/following_accounts_controller.rb +++ b/app/controllers/following_accounts_controller.rb @@ -7,6 +7,8 @@ class FollowingAccountsController < ApplicationController before_action :require_signature!, if: -> { request.format == :json && authorized_fetch_mode? } before_action :set_cache_headers + skip_around_action :set_locale, if: -> { request.format == :json } + def index respond_to do |format| format.html do From c09ecbc53eb3d3a8a1e2a1e61e20c9e5dbd4f560 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 13 Aug 2019 12:22:16 +0200 Subject: [PATCH 15/17] Add indicator of unread content to window title when web UI is out of focus (#11560) Fix #1288 --- app/javascript/mastodon/actions/app.js | 10 +++++ .../features/ui/components/document_title.js | 41 +++++++++++++++++++ app/javascript/mastodon/features/ui/index.js | 18 +++++++- app/javascript/mastodon/initial_state.js | 1 + app/javascript/mastodon/reducers/index.js | 2 + .../mastodon/reducers/missed_updates.js | 23 +++++++++++ app/serializers/initial_state_serializer.rb | 1 + 7 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 app/javascript/mastodon/actions/app.js create mode 100644 app/javascript/mastodon/features/ui/components/document_title.js create mode 100644 app/javascript/mastodon/reducers/missed_updates.js diff --git a/app/javascript/mastodon/actions/app.js b/app/javascript/mastodon/actions/app.js new file mode 100644 index 000000000..414968f7d --- /dev/null +++ b/app/javascript/mastodon/actions/app.js @@ -0,0 +1,10 @@ +export const APP_FOCUS = 'APP_FOCUS'; +export const APP_UNFOCUS = 'APP_UNFOCUS'; + +export const focusApp = () => ({ + type: APP_FOCUS, +}); + +export const unfocusApp = () => ({ + type: APP_UNFOCUS, +}); diff --git a/app/javascript/mastodon/features/ui/components/document_title.js b/app/javascript/mastodon/features/ui/components/document_title.js new file mode 100644 index 000000000..cd081b20c --- /dev/null +++ b/app/javascript/mastodon/features/ui/components/document_title.js @@ -0,0 +1,41 @@ +import { PureComponent } from 'react'; +import { connect } from 'react-redux'; +import PropTypes from 'prop-types'; +import { title } from 'mastodon/initial_state'; + +const mapStateToProps = state => ({ + unread: state.getIn(['missed_updates', 'unread']), +}); + +export default @connect(mapStateToProps) +class DocumentTitle extends PureComponent { + + static propTypes = { + unread: PropTypes.number.isRequired, + }; + + componentDidMount () { + this._sideEffects(); + } + + componentDidUpdate() { + this._sideEffects(); + } + + _sideEffects () { + const { unread } = this.props; + + if (unread > 99) { + document.title = `(*) ${title}`; + } else if (unread > 0) { + document.title = `(${unread}) ${title}`; + } else { + document.title = title; + } + } + + render () { + return null; + } + +} diff --git a/app/javascript/mastodon/features/ui/index.js b/app/javascript/mastodon/features/ui/index.js index d1a3dc949..f0c3eff83 100644 --- a/app/javascript/mastodon/features/ui/index.js +++ b/app/javascript/mastodon/features/ui/index.js @@ -15,9 +15,11 @@ import { expandHomeTimeline } from '../../actions/timelines'; import { expandNotifications } from '../../actions/notifications'; import { fetchFilters } from '../../actions/filters'; import { clearHeight } from '../../actions/height_cache'; +import { focusApp, unfocusApp } from 'mastodon/actions/app'; import { WrappedSwitch, WrappedRoute } from './util/react_router_helpers'; import UploadArea from './components/upload_area'; import ColumnsAreaContainer from './containers/columns_area_container'; +import DocumentTitle from './components/document_title'; import { Compose, Status, @@ -226,7 +228,7 @@ class UI extends React.PureComponent { draggingOver: false, }; - handleBeforeUnload = (e) => { + handleBeforeUnload = e => { const { intl, isComposing, hasComposingText, hasMediaAttachments } = this.props; if (isComposing && (hasComposingText || hasMediaAttachments)) { @@ -237,6 +239,14 @@ class UI extends React.PureComponent { } } + handleWindowFocus = () => { + this.props.dispatch(focusApp()); + } + + handleWindowBlur = () => { + this.props.dispatch(unfocusApp()); + } + handleLayoutChange = () => { // The cached heights are no longer accurate, invalidate this.props.dispatch(clearHeight()); @@ -314,6 +324,8 @@ class UI extends React.PureComponent { } componentWillMount () { + window.addEventListener('focus', this.handleWindowFocus, false); + window.addEventListener('blur', this.handleWindowBlur, false); window.addEventListener('beforeunload', this.handleBeforeUnload, false); document.addEventListener('dragenter', this.handleDragEnter, false); @@ -343,7 +355,10 @@ class UI extends React.PureComponent { } componentWillUnmount () { + window.removeEventListener('focus', this.handleWindowFocus); + window.removeEventListener('blur', this.handleWindowBlur); window.removeEventListener('beforeunload', this.handleBeforeUnload); + document.removeEventListener('dragenter', this.handleDragEnter); document.removeEventListener('dragover', this.handleDragOver); document.removeEventListener('drop', this.handleDrop); @@ -502,6 +517,7 @@ class UI extends React.PureComponent { + ); diff --git a/app/javascript/mastodon/initial_state.js b/app/javascript/mastodon/initial_state.js index 38e7b0595..56fb58546 100644 --- a/app/javascript/mastodon/initial_state.js +++ b/app/javascript/mastodon/initial_state.js @@ -23,5 +23,6 @@ export const forceSingleColumn = !getMeta('advanced_layout'); export const useBlurhash = getMeta('use_blurhash'); export const usePendingItems = getMeta('use_pending_items'); export const showTrends = getMeta('trends'); +export const title = getMeta('title'); export default initialState; diff --git a/app/javascript/mastodon/reducers/index.js b/app/javascript/mastodon/reducers/index.js index 3b60878eb..0f4b209d4 100644 --- a/app/javascript/mastodon/reducers/index.js +++ b/app/javascript/mastodon/reducers/index.js @@ -32,6 +32,7 @@ import suggestions from './suggestions'; import polls from './polls'; import identity_proofs from './identity_proofs'; import trends from './trends'; +import missed_updates from './missed_updates'; const reducers = { dropdown_menu, @@ -67,6 +68,7 @@ const reducers = { suggestions, polls, trends, + missed_updates, }; export default combineReducers(reducers); diff --git a/app/javascript/mastodon/reducers/missed_updates.js b/app/javascript/mastodon/reducers/missed_updates.js new file mode 100644 index 000000000..eeb8b40f6 --- /dev/null +++ b/app/javascript/mastodon/reducers/missed_updates.js @@ -0,0 +1,23 @@ +import { Map as ImmutableMap } from 'immutable'; +import { NOTIFICATIONS_UPDATE } from 'mastodon/actions/notifications'; +import { TIMELINE_UPDATE } from 'mastodon/actions/timelines'; +import { APP_FOCUS, APP_UNFOCUS } from 'mastodon/actions/app'; + +const initialState = ImmutableMap({ + focused: true, + unread: 0, +}); + +export default function missed_updates(state = initialState, action) { + switch(action.type) { + case APP_FOCUS: + return state.set('focused', true).set('unread', 0); + case APP_UNFOCUS: + return state.set('focused', false); + case NOTIFICATIONS_UPDATE: + case TIMELINE_UPDATE: + return state.get('focused') ? state : state.update('unread', x => x + 1); + default: + return state; + } +}; diff --git a/app/serializers/initial_state_serializer.rb b/app/serializers/initial_state_serializer.rb index c92c5e606..2cebef2c0 100644 --- a/app/serializers/initial_state_serializer.rb +++ b/app/serializers/initial_state_serializer.rb @@ -12,6 +12,7 @@ class InitialStateSerializer < ActiveModel::Serializer access_token: object.token, locale: I18n.locale, domain: Rails.configuration.x.local_domain, + title: instance_presenter.site_title, admin: object.admin&.id&.to_s, search_enabled: Chewy.enabled?, repository: Mastodon::Version.repository, From 0e9668051e58b2ff4e48b82fa7cc17d385c7a5c9 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 13 Aug 2019 12:22:33 +0200 Subject: [PATCH 16/17] Fix short number formatting for numbers above million in web UI (#11559) --- app/javascript/mastodon/utils/numbers.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/utils/numbers.js b/app/javascript/mastodon/utils/numbers.js index fdd8269ae..f7e4ceb93 100644 --- a/app/javascript/mastodon/utils/numbers.js +++ b/app/javascript/mastodon/utils/numbers.js @@ -4,7 +4,9 @@ import { FormattedNumber } from 'react-intl'; export const shortNumberFormat = number => { if (number < 1000) { return ; - } else { + } else if (number < 1000000) { return K; + } else { + return M; } }; From 7ffec882ae79a49d6eed42361f7e8d5de99e1d74 Mon Sep 17 00:00:00 2001 From: ThibG Date: Tue, 13 Aug 2019 15:30:37 +0200 Subject: [PATCH 17/17] Fix reverse-proxy caching of instance actor object (#11561) --- app/controllers/instance_actors_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/instance_actors_controller.rb b/app/controllers/instance_actors_controller.rb index 41f33602e..6f02d6a35 100644 --- a/app/controllers/instance_actors_controller.rb +++ b/app/controllers/instance_actors_controller.rb @@ -3,6 +3,8 @@ class InstanceActorsController < ApplicationController include AccountControllerConcern + skip_around_action :set_locale + def show expires_in 10.minutes, public: true render json: @account, content_type: 'application/activity+json', serializer: ActivityPub::ActorSerializer, adapter: ActivityPub::Adapter, fields: restrict_fields_to