Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `package.json`: Upstream updated `jest`, moving its config in a separate file. This config was modified in glitch-soc, so the corresponding changes have been ported to `jest.config.js`
This commit is contained in:
		
						commit
						c85c3fb708
					
				
							
								
								
									
										52
									
								
								CHANGELOG.md
								
								
								
								
							
							
						
						
									
										52
									
								
								CHANGELOG.md
								
								
								
								
							|  | @ -3,6 +3,58 @@ Changelog | |||
| 
 | ||||
| All notable changes to this project will be documented in this file. | ||||
| 
 | ||||
| ## [3.5.2] - 2022-05-04 | ||||
| ### Added | ||||
| 
 | ||||
| - Add warning on direct messages screen in web UI ([Gargron](https://github.com/mastodon/mastodon/pull/18289)) | ||||
|   - We already had a warning when composing a direct message, it has now been reworded to be more clear | ||||
|   - Same warning is now displayed when viewing sent and received direct messages | ||||
| - Add ability to set approval-based registration through tootctl ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18248)) | ||||
| - Add pre-filling of domain from search filter in domain allow/block admin UI ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18172)) | ||||
| 
 | ||||
| ## Changed | ||||
| 
 | ||||
| - Change name of “Direct” visibility to “Mentioned people only” in web UI ([Gargron](https://github.com/mastodon/mastodon/pull/18146), [Gargron](https://github.com/mastodon/mastodon/pull/18289), [ClearlyClaire](https://github.com/mastodon/mastodon/pull/18291)) | ||||
| - Change trending posts to only show one post from each account ([Gargron](https://github.com/mastodon/mastodon/pull/18181)) | ||||
| - Change half-life of trending posts from 6 hours to 2 hours ([Gargron](https://github.com/mastodon/mastodon/pull/18182)) | ||||
| - Change full-text search feature to also include polls you have voted in ([tribela](https://github.com/mastodon/mastodon/pull/18070)) | ||||
| - Change Redis from using one connection per process, to using a connection pool ([Gargron](https://github.com/mastodon/mastodon/pull/18135), [ClearlyClaire](https://github.com/mastodon/mastodon/pull/18160), [Gargron](https://github.com/mastodon/mastodon/pull/18171)) | ||||
|   - Different threads no longer have to wait on a mutex over a single connection | ||||
|   - However, this does increase the number of Redis connections by a fair amount | ||||
|   - We are planning to optimize Redis use so that the pool can be made smaller in the future | ||||
| 
 | ||||
| ## Removed | ||||
| 
 | ||||
| - Remove IP matching from e-mail domain blocks ([Gargron](https://github.com/mastodon/mastodon/pull/18190)) | ||||
|   - The IPs of the blocked e-mail domain or its MX records are no longer checked | ||||
|   - Previously it was too easy to block e-mail providers by mistake | ||||
|    | ||||
| ## Fixed | ||||
| 
 | ||||
| - Fix compatibility with Friendica's pinned posts ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18254), [ClearlyClaire](https://github.com/mastodon/mastodon/pull/18260)) | ||||
| - Fix error when looking up handle with surrounding spaces in REST API ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18225)) | ||||
| - Fix double render error when authorizing interaction ([Gargron](https://github.com/mastodon/mastodon/pull/18203)) | ||||
| - Fix error when a post references an invalid media attachment ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18211)) | ||||
| - Fix error when trying to revoke OAuth token without supplying a token ([Gargron](https://github.com/mastodon/mastodon/pull/18205)) | ||||
| - Fix error caused by missing subject in Webfinger response ([Gargron](https://github.com/mastodon/mastodon/pull/18204)) | ||||
| - Fix error on attempting to delete an account moderation note ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18196)) | ||||
| - Fix light-mode emoji borders in web UI ([Gaelan](https://github.com/mastodon/mastodon/pull/18131)) | ||||
| - Fix being able to scroll away from the loading bar in web UI ([Gargron](https://github.com/mastodon/mastodon/pull/18170)) | ||||
| - Fix error when a bookmark or favorite has been reported and deleted ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18174)) | ||||
| - Fix being offered empty “Server rules violation” report option in web UI ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18165)) | ||||
| - Fix temporary network errors preventing from authorizing interactions with remote accounts ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18161)) | ||||
| - Fix incorrect link in "new trending tags" email ([cdzombak](https://github.com/mastodon/mastodon/pull/18156)) | ||||
| - Fix missing indexes on some foreign keys ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18157)) | ||||
| - Fix n+1 query on feed merge and populate operations ([Gargron](https://github.com/mastodon/mastodon/pull/18111)) | ||||
| - Fix feed unmerge worker being exceptionally slow in some conditions ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18110)) | ||||
| - Fix PeerTube videos appearing with an erroneous “Edited at” marker ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18100)) | ||||
| - Fix instance actor being created incorrectly when running through migrations ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18109)) | ||||
| - Fix web push notifications containing HTML entities ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18071)) | ||||
| - Fix inconsistent parsing of `TRUSTED_PROXY_IP` ([ykzts](https://github.com/mastodon/mastodon/pull/18051)) | ||||
| - Fix error when fetching pinned posts ([tribela](https://github.com/mastodon/mastodon/pull/18030)) | ||||
| - Fix wrong optimization in feed populate operation ([dogelover911](https://github.com/mastodon/mastodon/pull/18009)) | ||||
| - Fix error in alias settings page ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18004)) | ||||
| 
 | ||||
| ## [3.5.1] - 2022-04-08 | ||||
| ### Added | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										4
									
								
								Gemfile
								
								
								
								
							
							
						
						
									
										4
									
								
								Gemfile
								
								
								
								
							|  | @ -1,7 +1,7 @@ | |||
| # frozen_string_literal: true | ||||
| 
 | ||||
| source 'https://rubygems.org' | ||||
| ruby '>= 2.5.0', '< 3.1.0' | ||||
| ruby '>= 2.6.0', '< 3.1.0' | ||||
| 
 | ||||
| gem 'pkg-config', '~> 1.4' | ||||
| gem 'rexml', '~> 3.2' | ||||
|  | @ -134,7 +134,7 @@ group :development do | |||
|   gem 'letter_opener', '~> 1.8' | ||||
|   gem 'letter_opener_web', '~> 2.0' | ||||
|   gem 'memory_profiler' | ||||
|   gem 'rubocop', '~> 1.27', require: false | ||||
|   gem 'rubocop', '~> 1.28', require: false | ||||
|   gem 'rubocop-rails', '~> 2.14', require: false | ||||
|   gem 'brakeman', '~> 5.2', require: false | ||||
|   gem 'bundler-audit', '~> 0.9', require: false | ||||
|  |  | |||
							
								
								
									
										12
									
								
								Gemfile.lock
								
								
								
								
							
							
						
						
									
										12
									
								
								Gemfile.lock
								
								
								
								
							|  | @ -116,7 +116,7 @@ GEM | |||
|       ffi (~> 1.14) | ||||
|     bootsnap (1.11.1) | ||||
|       msgpack (~> 1.2) | ||||
|     brakeman (5.2.2) | ||||
|     brakeman (5.2.3) | ||||
|     browser (4.2.0) | ||||
|     brpoplpush-redis_script (0.1.2) | ||||
|       concurrent-ruby (~> 1.0, >= 1.0.5) | ||||
|  | @ -444,7 +444,7 @@ GEM | |||
|     orm_adapter (0.5.0) | ||||
|     ox (2.14.11) | ||||
|     parallel (1.22.1) | ||||
|     parser (3.1.1.0) | ||||
|     parser (3.1.2.0) | ||||
|       ast (~> 2.4.1) | ||||
|     parslet (2.0.0) | ||||
|     pastel (0.8.0) | ||||
|  | @ -537,7 +537,7 @@ GEM | |||
|     redis (4.5.1) | ||||
|     redis-namespace (1.8.2) | ||||
|       redis (>= 3.0.4) | ||||
|     regexp_parser (2.3.0) | ||||
|     regexp_parser (2.3.1) | ||||
|     request_store (1.5.1) | ||||
|       rack (>= 1.4) | ||||
|     responders (3.0.1) | ||||
|  | @ -572,13 +572,13 @@ GEM | |||
|     rspec-support (3.11.0) | ||||
|     rspec_junit_formatter (0.5.1) | ||||
|       rspec-core (>= 2, < 4, != 2.12.0) | ||||
|     rubocop (1.27.0) | ||||
|     rubocop (1.28.2) | ||||
|       parallel (~> 1.10) | ||||
|       parser (>= 3.1.0.0) | ||||
|       rainbow (>= 2.2.2, < 4.0) | ||||
|       regexp_parser (>= 1.8, < 3.0) | ||||
|       rexml | ||||
|       rubocop-ast (>= 1.16.0, < 2.0) | ||||
|       rubocop-ast (>= 1.17.0, < 2.0) | ||||
|       ruby-progressbar (~> 1.7) | ||||
|       unicode-display_width (>= 1.4.0, < 3.0) | ||||
|     rubocop-ast (1.17.0) | ||||
|  | @ -830,7 +830,7 @@ DEPENDENCIES | |||
|   rspec-rails (~> 5.1) | ||||
|   rspec-sidekiq (~> 3.1) | ||||
|   rspec_junit_formatter (~> 0.5) | ||||
|   rubocop (~> 1.27) | ||||
|   rubocop (~> 1.28) | ||||
|   rubocop-rails (~> 2.14) | ||||
|   ruby-progressbar (~> 1.11) | ||||
|   sanitize (~> 6.0) | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ const messages = defineMessages({ | |||
|   unlisted_long: { id: 'privacy.unlisted.long', defaultMessage: 'Visible for all, but opted-out of discovery features' }, | ||||
|   private_short: { id: 'privacy.private.short', defaultMessage: 'Followers only' }, | ||||
|   private_long: { id: 'privacy.private.long', defaultMessage: 'Visible for followers only' }, | ||||
|   direct_short: { id: 'privacy.direct.short', defaultMessage: 'Only people I mention' }, | ||||
|   direct_short: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' }, | ||||
|   direct_long: { id: 'privacy.direct.long', defaultMessage: 'Visible for mentioned users only' }, | ||||
|   change_privacy: { id: 'privacy.change', defaultMessage: 'Adjust status privacy' }, | ||||
| }); | ||||
|  |  | |||
|  | @ -1326,7 +1326,7 @@ | |||
|         "id": "privacy.private.long" | ||||
|       }, | ||||
|       { | ||||
|         "defaultMessage": "Only people I mention", | ||||
|         "defaultMessage": "Mentioned people only", | ||||
|         "id": "privacy.direct.short" | ||||
|       }, | ||||
|       { | ||||
|  | @ -1616,12 +1616,20 @@ | |||
|   { | ||||
|     "descriptors": [ | ||||
|       { | ||||
|         "defaultMessage": "Conversations", | ||||
|         "id": "column.conversations" | ||||
|         "defaultMessage": "Direct messages", | ||||
|         "id": "column.direct" | ||||
|       }, | ||||
|       { | ||||
|         "defaultMessage": "Once you send or receive a post that's only visible to people mentioned in it, it will show up here.", | ||||
|         "id": "empty_column.conversations" | ||||
|         "defaultMessage": "Posts on Mastodon are not end-to-end encrypted. Do not share any dangerous information over Mastodon.", | ||||
|         "id": "compose_form.encryption_warning" | ||||
|       }, | ||||
|       { | ||||
|         "defaultMessage": "Learn more", | ||||
|         "id": "compose_form.direct_message_warning_learn_more" | ||||
|       }, | ||||
|       { | ||||
|         "defaultMessage": "You don't have any direct messages yet. When you send or receive one, it will show up here.", | ||||
|         "id": "empty_column.direct" | ||||
|       } | ||||
|     ], | ||||
|     "path": "app/javascript/mastodon/features/direct_timeline/index.json" | ||||
|  | @ -1965,8 +1973,8 @@ | |||
|         "id": "navigation_bar.explore" | ||||
|       }, | ||||
|       { | ||||
|         "defaultMessage": "Conversations", | ||||
|         "id": "column.conversations" | ||||
|         "defaultMessage": "Direct messages", | ||||
|         "id": "navigation_bar.direct" | ||||
|       }, | ||||
|       { | ||||
|         "defaultMessage": "Bookmarks", | ||||
|  | @ -2222,8 +2230,8 @@ | |||
|         "id": "keyboard_shortcuts.federated" | ||||
|       }, | ||||
|       { | ||||
|         "defaultMessage": "to open conversations column", | ||||
|         "id": "keyboard_shortcuts.conversations" | ||||
|         "defaultMessage": "to open direct messages column", | ||||
|         "id": "keyboard_shortcuts.direct" | ||||
|       }, | ||||
|       { | ||||
|         "defaultMessage": "to open \"get started\" column", | ||||
|  | @ -3526,8 +3534,8 @@ | |||
|         "id": "tabs_bar.federated_timeline" | ||||
|       }, | ||||
|       { | ||||
|         "defaultMessage": "Conversations", | ||||
|         "id": "column.conversations" | ||||
|         "defaultMessage": "Direct messages", | ||||
|         "id": "navigation_bar.direct" | ||||
|       }, | ||||
|       { | ||||
|         "defaultMessage": "Favourites", | ||||
|  |  | |||
|  | @ -70,7 +70,7 @@ | |||
|   "column.blocks": "Blocked users", | ||||
|   "column.bookmarks": "Bookmarks", | ||||
|   "column.community": "Local timeline", | ||||
|   "column.conversations": "Conversations", | ||||
|   "column.direct": "Direct messages", | ||||
|   "column.directory": "Browse profiles", | ||||
|   "column.domain_blocks": "Blocked domains", | ||||
|   "column.favourites": "Favourites", | ||||
|  | @ -170,7 +170,7 @@ | |||
|   "empty_column.blocks": "You haven't blocked any users yet.", | ||||
|   "empty_column.bookmarked_statuses": "You don't have any bookmarked posts yet. When you bookmark one, it will show up here.", | ||||
|   "empty_column.community": "The local timeline is empty. Write something publicly to get the ball rolling!", | ||||
|   "empty_column.conversations": "Once you send or receive a post that's only visible to people mentioned in it, it will show up here.", | ||||
|   "empty_column.direct": "You don't have any direct messages yet. When you send or receive one, it will show up here.", | ||||
|   "empty_column.domain_blocks": "There are no blocked domains yet.", | ||||
|   "empty_column.explore_statuses": "Nothing is trending right now. Check back later!", | ||||
|   "empty_column.favourited_statuses": "You don't have any favourite posts yet. When you favourite one, it will show up here.", | ||||
|  | @ -234,8 +234,8 @@ | |||
|   "keyboard_shortcuts.boost": "Boost post", | ||||
|   "keyboard_shortcuts.column": "Focus column", | ||||
|   "keyboard_shortcuts.compose": "Focus compose textarea", | ||||
|   "keyboard_shortcuts.conversations": "to open conversations column", | ||||
|   "keyboard_shortcuts.description": "Description", | ||||
|   "keyboard_shortcuts.direct": "to open direct messages column", | ||||
|   "keyboard_shortcuts.down": "Move down in the list", | ||||
|   "keyboard_shortcuts.enter": "Open post", | ||||
|   "keyboard_shortcuts.favourite": "Favourite post", | ||||
|  | @ -294,6 +294,7 @@ | |||
|   "navigation_bar.bookmarks": "Bookmarks", | ||||
|   "navigation_bar.community_timeline": "Local timeline", | ||||
|   "navigation_bar.compose": "Compose new post", | ||||
|   "navigation_bar.direct": "Direct messages", | ||||
|   "navigation_bar.discover": "Discover", | ||||
|   "navigation_bar.domain_blocks": "Blocked domains", | ||||
|   "navigation_bar.edit_profile": "Edit profile", | ||||
|  | @ -371,7 +372,7 @@ | |||
|   "poll_button.remove_poll": "Remove poll", | ||||
|   "privacy.change": "Change post privacy", | ||||
|   "privacy.direct.long": "Visible for mentioned users only", | ||||
|   "privacy.direct.short": "Only people I mention", | ||||
|   "privacy.direct.short": "Mentioned people only", | ||||
|   "privacy.private.long": "Visible for followers only", | ||||
|   "privacy.private.short": "Followers only", | ||||
|   "privacy.public.long": "Visible for all", | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ image: | |||
|   # built from the most recent commit | ||||
|   # | ||||
|   # tag: latest | ||||
|   tag: v3.5.1 | ||||
|   tag: v3.5.2 | ||||
|   # use `Always` when using `latest` tag | ||||
|   pullPolicy: IfNotPresent | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,33 @@ | |||
| module.exports = { | ||||
|   'testEnvironment': 'jsdom', | ||||
|   'projects': [ | ||||
|     '<rootDir>/app/javascript/mastodon', | ||||
|   ], | ||||
|   'testPathIgnorePatterns': [ | ||||
|     '<rootDir>/node_modules/', | ||||
|     '<rootDir>/vendor/', | ||||
|     '<rootDir>/config/', | ||||
|     '<rootDir>/log/', | ||||
|     '<rootDir>/public/', | ||||
|     '<rootDir>/tmp/', | ||||
|     '<rootDir>/app/javascript/themes/', | ||||
|   ], | ||||
|   'setupFiles': [ | ||||
|     'raf/polyfill', | ||||
|   ], | ||||
|   'setupFilesAfterEnv': [ | ||||
|     '<rootDir>/app/javascript/mastodon/test_setup.js', | ||||
|   ], | ||||
|   'collectCoverageFrom': [ | ||||
|     'app/javascript/mastodon/**/*.js', | ||||
|     '!app/javascript/mastodon/features/emoji/emoji_compressed.js', | ||||
|     '!app/javascript/mastodon/locales/locale-data/*.js', | ||||
|     '!app/javascript/mastodon/service_worker/entry.js', | ||||
|     '!app/javascript/mastodon/test_setup.js', | ||||
|   ], | ||||
|   'coverageDirectory': '<rootDir>/coverage', | ||||
|   'moduleDirectories': [ | ||||
|     '<rootDir>/node_modules', | ||||
|     '<rootDir>/app/javascript', | ||||
|   ], | ||||
| }; | ||||
|  | @ -13,7 +13,7 @@ module Mastodon | |||
|     end | ||||
| 
 | ||||
|     def patch | ||||
|       1 | ||||
|       2 | ||||
|     end | ||||
| 
 | ||||
|     def flags | ||||
|  |  | |||
							
								
								
									
										42
									
								
								package.json
								
								
								
								
							
							
						
						
									
										42
									
								
								package.json
								
								
								
								
							|  | @ -28,39 +28,6 @@ | |||
|     "iOS >= 9", | ||||
|     "not dead" | ||||
|   ], | ||||
|   "jest": { | ||||
|     "testEnvironment": "jsdom", | ||||
|     "projects": [ | ||||
|       "<rootDir>/app/javascript/mastodon" | ||||
|     ], | ||||
|     "testPathIgnorePatterns": [ | ||||
|       "<rootDir>/node_modules/", | ||||
|       "<rootDir>/vendor/", | ||||
|       "<rootDir>/config/", | ||||
|       "<rootDir>/log/", | ||||
|       "<rootDir>/public/", | ||||
|       "<rootDir>/tmp/", | ||||
|       "<rootDir>/app/javascript/themes/" | ||||
|     ], | ||||
|     "setupFiles": [ | ||||
|       "raf/polyfill" | ||||
|     ], | ||||
|     "setupFilesAfterEnv": [ | ||||
|       "<rootDir>/app/javascript/mastodon/test_setup.js" | ||||
|     ], | ||||
|     "collectCoverageFrom": [ | ||||
|       "app/javascript/mastodon/**/*.js", | ||||
|       "!app/javascript/mastodon/features/emoji/emoji_compressed.js", | ||||
|       "!app/javascript/mastodon/locales/locale-data/*.js", | ||||
|       "!app/javascript/mastodon/service_worker/entry.js", | ||||
|       "!app/javascript/mastodon/test_setup.js" | ||||
|     ], | ||||
|     "coverageDirectory": "<rootDir>/coverage", | ||||
|     "moduleDirectories": [ | ||||
|       "<rootDir>/node_modules", | ||||
|       "<rootDir>/app/javascript" | ||||
|     ] | ||||
|   }, | ||||
|   "private": true, | ||||
|   "dependencies": { | ||||
|     "@babel/core": "^7.17.10", | ||||
|  | @ -148,7 +115,7 @@ | |||
|     "react-swipeable-views": "^0.14.0", | ||||
|     "react-textarea-autosize": "^8.3.3", | ||||
|     "react-toggle": "^4.1.2", | ||||
|     "redis": "^4.0.6", | ||||
|     "redis": "^4.1.0", | ||||
|     "redux": "^4.1.2", | ||||
|     "redux-immutable": "^4.0.0", | ||||
|     "redux-thunk": "^2.4.1", | ||||
|  | @ -174,19 +141,20 @@ | |||
|     "webpack-cli": "^3.3.12", | ||||
|     "webpack-merge": "^5.8.0", | ||||
|     "wicg-inert": "^3.1.1", | ||||
|     "ws": "^8.5.0" | ||||
|     "ws": "^8.6.0" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@testing-library/jest-dom": "^5.16.4", | ||||
|     "@testing-library/react": "^12.1.5", | ||||
|     "babel-eslint": "^10.1.0", | ||||
|     "babel-jest": "^27.5.1", | ||||
|     "babel-jest": "^28.0.3", | ||||
|     "eslint": "^7.32.0", | ||||
|     "eslint-plugin-import": "~2.26.0", | ||||
|     "eslint-plugin-jsx-a11y": "~6.5.1", | ||||
|     "eslint-plugin-promise": "~6.0.0", | ||||
|     "eslint-plugin-react": "~7.29.4", | ||||
|     "jest": "^27.5.1", | ||||
|     "jest": "^28.0.3", | ||||
|     "jest-environment-jsdom": "^28.0.2", | ||||
|     "prettier": "^2.6.2", | ||||
|     "raf": "^3.4.1", | ||||
|     "react-intl-translations-manager": "^5.0.3", | ||||
|  |  | |||
|  | @ -1,6 +1,11 @@ | |||
| // @ts-check
 | ||||
| 
 | ||||
| (function() { | ||||
|   'use strict'; | ||||
| 
 | ||||
|   /** | ||||
|    * @param {() => void} loaded | ||||
|    */ | ||||
|   var ready = function(loaded) { | ||||
|     if (['interactive', 'complete'].indexOf(document.readyState) !== -1) { | ||||
|       loaded(); | ||||
|  | @ -10,26 +15,43 @@ | |||
|   }; | ||||
| 
 | ||||
|   ready(function() { | ||||
|     var iframes = []; | ||||
|     /** @type {Map<number, HTMLIFrameElement>} */ | ||||
|     var iframes = new Map(); | ||||
| 
 | ||||
|     window.addEventListener('message', function(e) { | ||||
|       var data = e.data || {}; | ||||
| 
 | ||||
|       if (data.type !== 'setHeight' || !iframes[data.id] || window.location.origin !== e.origin || data.id.toString() === '__proto__') { | ||||
|       if (typeof data !== 'object' || data.type !== 'setHeight' || !iframes.has(data.id)) { | ||||
|         return; | ||||
|       } | ||||
| 
 | ||||
|       iframes[data.id].height = data.height; | ||||
|       var iframe = iframes.get(data.id); | ||||
| 
 | ||||
|       if ('source' in e && iframe.contentWindow !== e.source) { | ||||
|         return; | ||||
|       } | ||||
| 
 | ||||
|       iframe.height = data.height; | ||||
|     }); | ||||
| 
 | ||||
|     [].forEach.call(document.querySelectorAll('iframe.mastodon-embed'), function(iframe) { | ||||
|       // select unique id for each iframe
 | ||||
|       var id = 0, failCount = 0, idBuffer = new Uint32Array(1); | ||||
|       while (id === 0 || iframes.has(id)) { | ||||
|         id = crypto.getRandomValues(idBuffer)[0]; | ||||
|         failCount++; | ||||
|         if (failCount > 100) { | ||||
|           // give up and assign (easily guessable) unique number if getRandomValues is broken or no luck
 | ||||
|           id = -(iframes.size + 1); | ||||
|           break; | ||||
|         } | ||||
|       } | ||||
| 
 | ||||
|       iframes.set(id, iframe); | ||||
| 
 | ||||
|       iframe.scrolling      = 'no'; | ||||
|       iframe.style.overflow = 'hidden'; | ||||
| 
 | ||||
|       iframes.push(iframe); | ||||
| 
 | ||||
|       var id = iframes.length - 1; | ||||
| 
 | ||||
|       iframe.onload = function() { | ||||
|         iframe.contentWindow.postMessage({ | ||||
|           type: 'setHeight', | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue