Merge pull request #1093 from ThibG/glitch-soc/merge-upstream

Merge upstream changes
This commit is contained in:
ThibG 2019-06-05 13:28:05 +02:00 committed by GitHub
commit ff74aaca7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 952 additions and 365 deletions

View file

@ -30,8 +30,8 @@ plugins:
channel: eslint-5 channel: eslint-5
rubocop: rubocop:
enabled: true enabled: true
channel: rubocop-0-54 channel: rubocop-0-71
scss-lint: sass-lint:
enabled: true enabled: true
exclude_patterns: exclude_patterns:
- spec/ - spec/

View file

@ -3,8 +3,8 @@ version: 1
update_configs: update_configs:
- package_manager: "ruby:bundler" - package_manager: "ruby:bundler"
directory: "/" directory: "/"
update_schedule: "live" update_schedule: "weekly"
- package_manager: "javascript" - package_manager: "javascript"
directory: "/" directory: "/"
update_schedule: "live" update_schedule: "weekly"

View file

@ -1,10 +1,10 @@
# Linter Documentation: # Linter Documentation:
# https://github.com/brigade/scss-lint/blob/v0.42.2/lib/scss_lint/linter/README.md # https://github.com/sasstools/sass-lint/tree/v1.13.1/docs/options
scss_files: 'app/javascript/styles/**/*.scss' files:
include: app/javascript/styles/**/*.scss
exclude: ignore:
- app/javascript/styles/reset.scss - app/javascript/styles/reset.scss
linters: linters:
# Reports when you use improper spacing around ! (the "bang") in !default, # Reports when you use improper spacing around ! (the "bang") in !default,

View file

@ -43,4 +43,4 @@ Gruntfile.js
# for specific ignore # for specific ignore
!.svgo.yml !.svgo.yml
!sass-lint/**/*.yml

View file

@ -99,7 +99,7 @@ gem 'redcarpet', '~> 3.4'
group :development, :test do group :development, :test do
gem 'fabrication', '~> 2.20' gem 'fabrication', '~> 2.20'
gem 'fuubar', '~> 2.3' gem 'fuubar', '~> 2.4'
gem 'i18n-tasks', '~> 0.9', require: false gem 'i18n-tasks', '~> 0.9', require: false
gem 'pry-byebug', '~> 3.7' gem 'pry-byebug', '~> 3.7'
gem 'pry-rails', '~> 0.3' gem 'pry-rails', '~> 0.3'
@ -134,7 +134,6 @@ group :development do
gem 'rubocop', '~> 0.71', require: false gem 'rubocop', '~> 0.71', require: false
gem 'brakeman', '~> 4.5', require: false gem 'brakeman', '~> 4.5', require: false
gem 'bundler-audit', '~> 0.6', require: false gem 'bundler-audit', '~> 0.6', require: false
gem 'scss_lint', '~> 0.58', require: false
gem 'capistrano', '~> 3.11' gem 'capistrano', '~> 3.11'
gem 'capistrano-rails', '~> 1.4' gem 'capistrano-rails', '~> 1.4'

View file

@ -231,7 +231,7 @@ GEM
fugit (1.1.6) fugit (1.1.6)
et-orbi (~> 1.1, >= 1.1.6) et-orbi (~> 1.1, >= 1.1.6)
raabro (~> 1.1) raabro (~> 1.1)
fuubar (2.3.2) fuubar (2.4.0)
rspec-core (~> 3.0) rspec-core (~> 3.0)
ruby-progressbar (~> 1.4) ruby-progressbar (~> 1.4)
get_process_mem (0.2.3) get_process_mem (0.2.3)
@ -472,9 +472,6 @@ GEM
thor (>= 0.19.0, < 2.0) thor (>= 0.19.0, < 2.0)
rainbow (3.0.0) rainbow (3.0.0)
rake (12.3.2) rake (12.3.2)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
rdf (3.0.9) rdf (3.0.9)
hamster (~> 3.0) hamster (~> 3.0)
link_header (~> 0.0, >= 0.0.8) link_header (~> 0.0, >= 0.0.8)
@ -547,14 +544,6 @@ GEM
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.8.0) nokogiri (>= 1.8.0)
nokogumbo (~> 2.0) nokogumbo (~> 2.0)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
scss_lint (0.58.0)
rake (>= 0.9, < 13)
sass (~> 3.5, >= 3.5.5)
sidekiq (5.2.7) sidekiq (5.2.7)
connection_pool (~> 2.2, >= 2.2.2) connection_pool (~> 2.2, >= 2.2.2)
rack (>= 1.5.0) rack (>= 1.5.0)
@ -636,7 +625,7 @@ GEM
addressable (>= 2.3.6) addressable (>= 2.3.6)
crack (>= 0.3.2) crack (>= 0.3.2)
hashdiff hashdiff
webpacker (4.0.6) webpacker (4.0.7)
activesupport (>= 4.2) activesupport (>= 4.2)
rack-proxy (>= 0.6.1) rack-proxy (>= 0.6.1)
railties (>= 4.2) railties (>= 4.2)
@ -689,7 +678,7 @@ DEPENDENCIES
fastimage fastimage
fog-core (<= 2.1.0) fog-core (<= 2.1.0)
fog-openstack (~> 0.3) fog-openstack (~> 0.3)
fuubar (~> 2.3) fuubar (~> 2.4)
goldfinger (~> 2.1) goldfinger (~> 2.1)
hamlit-rails (~> 0.2) hamlit-rails (~> 0.2)
hiredis (~> 0.6) hiredis (~> 0.6)
@ -752,7 +741,6 @@ DEPENDENCIES
rspec-sidekiq (~> 3.0) rspec-sidekiq (~> 3.0)
rubocop (~> 0.71) rubocop (~> 0.71)
sanitize (~> 5.0) sanitize (~> 5.0)
scss_lint (~> 0.58)
sidekiq (~> 5.2) sidekiq (~> 5.2)
sidekiq-bulk (~> 0.2.0) sidekiq-bulk (~> 0.2.0)
sidekiq-scheduler (~> 3.0) sidekiq-scheduler (~> 3.0)

View file

@ -1,13 +1,28 @@
# frozen_string_literal: true # frozen_string_literal: true
class Api::V1::PollsController < Api::BaseController class Api::V1::PollsController < Api::BaseController
include Authorization
before_action -> { authorize_if_got_token! :read, :'read:statuses' }, only: :show before_action -> { authorize_if_got_token! :read, :'read:statuses' }, only: :show
before_action :set_poll
before_action :refresh_poll
respond_to :json respond_to :json
def show def show
@poll = Poll.attached.find(params[:id])
ActivityPub::FetchRemotePollService.new.call(@poll, current_account) if user_signed_in? && @poll.possibly_stale?
render json: @poll, serializer: REST::PollSerializer, include_results: true render json: @poll, serializer: REST::PollSerializer, include_results: true
end end
private
def set_poll
@poll = Poll.attached.find(params[:id])
authorize @poll.status, :show?
rescue Mastodon::NotPermittedError
raise ActiveRecord::RecordNotFound
end
def refresh_poll
ActivityPub::FetchRemotePollService.new.call(@poll, current_account) if user_signed_in? && @poll.possibly_stale?
end
end end

View file

@ -22,7 +22,8 @@ const NavigationPanel = () => (
<hr /> <hr />
<a className='column-link column-link--transparent' href='/settings/preferences'><Icon className='column-link__icon' id='cog' fixedWidth /><FormattedMessage id='navigation_bar.preferences' defaultMessage='Preferences' /></a> <a className='column-link column-link--transparent' href='/settings/preferences'><Icon className='column-link__icon' id='cog' fixedWidth /><FormattedMessage id='navigation_bar.preferences' defaultMessage='Preferences' /></a>
<a className='column-link column-link--transparent' href='/relationships'><Icon className='column-link__icon' id='address-book-o' fixedWidth /><FormattedMessage id='navigation_bar.follows_and_followers' defaultMessage='Follows and followers' /></a> <a className='column-link column-link--transparent' href='/relationships'><Icon className='column-link__icon' id='users' fixedWidth /><FormattedMessage id='navigation_bar.follows_and_followers' defaultMessage='Follows and followers' /></a>
<a className='column-link column-link--transparent' href='/explore'><Icon className='column-link__icon' id='address-book-o' fixedWidth /><FormattedMessage id='navigation_bar.profile_directory' defaultMessage='Profile directory' /></a>
</div> </div>
); );

View file

@ -204,6 +204,7 @@
"keyboard_shortcuts.search": "검색창에 포커스", "keyboard_shortcuts.search": "검색창에 포커스",
"keyboard_shortcuts.start": "\"시작하기\" 컬럼 열기", "keyboard_shortcuts.start": "\"시작하기\" 컬럼 열기",
"keyboard_shortcuts.toggle_hidden": "CW로 가려진 텍스트를 표시/비표시", "keyboard_shortcuts.toggle_hidden": "CW로 가려진 텍스트를 표시/비표시",
"keyboard_shortcuts.toggle_sensitivity": "이미지 보이기/숨기기",
"keyboard_shortcuts.toot": "새 툿 작성", "keyboard_shortcuts.toot": "새 툿 작성",
"keyboard_shortcuts.unfocus": "작성창에서 포커스 해제", "keyboard_shortcuts.unfocus": "작성창에서 포커스 해제",
"keyboard_shortcuts.up": "리스트에서 위로 이동", "keyboard_shortcuts.up": "리스트에서 위로 이동",
@ -236,6 +237,7 @@
"navigation_bar.favourites": "즐겨찾기", "navigation_bar.favourites": "즐겨찾기",
"navigation_bar.filters": "뮤트", "navigation_bar.filters": "뮤트",
"navigation_bar.follow_requests": "팔로우 요청", "navigation_bar.follow_requests": "팔로우 요청",
"navigation_bar.follows_and_followers": "팔로우와 팔로워",
"navigation_bar.info": "이 서버에 대해서", "navigation_bar.info": "이 서버에 대해서",
"navigation_bar.keyboard_shortcuts": "단축키", "navigation_bar.keyboard_shortcuts": "단축키",
"navigation_bar.lists": "리스트", "navigation_bar.lists": "리스트",
@ -348,7 +350,7 @@
"status.show_less_all": "모두 접기", "status.show_less_all": "모두 접기",
"status.show_more": "더 보기", "status.show_more": "더 보기",
"status.show_more_all": "모두 펼치기", "status.show_more_all": "모두 펼치기",
"status.show_thread": "스레드 보기", "status.show_thread": "글타래 보기",
"status.unmute_conversation": "이 대화의 뮤트 해제하기", "status.unmute_conversation": "이 대화의 뮤트 해제하기",
"status.unpin": "고정 해제", "status.unpin": "고정 해제",
"suggestions.dismiss": "추천 지우기", "suggestions.dismiss": "추천 지우기",

View file

@ -234,7 +234,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
@account.polls.new( @account.polls.new(
multiple: multiple, multiple: multiple,
expires_at: expires_at, expires_at: expires_at,
options: items.map { |item| item['name'].presence || item['content'] }, options: items.map { |item| item['name'].presence || item['content'] }.compact,
cached_tallies: items.map { |item| item.dig('replies', 'totalItems') || 0 } cached_tallies: items.map { |item| item.dig('replies', 'totalItems') || 0 }
) )
end end

View file

@ -269,6 +269,7 @@ ko:
created_msg: 도메인 차단 처리를 완료했습니다 created_msg: 도메인 차단 처리를 완료했습니다
destroyed_msg: 도메인 차단이 해제되었습니다 destroyed_msg: 도메인 차단이 해제되었습니다
domain: 도메인 domain: 도메인
existing_domain_block_html: 이미 %{name}에 대한 더 강력한 제한이 걸려 있습니다, <a href="%{unblock_url}">차단 해제</a>를 먼저 해야 합니다.
new: new:
create: 차단 추가 create: 차단 추가
hint: 도메인 차단은 내부 데이터베이스에 계정이 생성되는 것까지는 막을 수 없지만, 그 도메인에서 생성된 계정에 자동적으로 특정한 모더레이션을 적용하게 할 수 있습니다. hint: 도메인 차단은 내부 데이터베이스에 계정이 생성되는 것까지는 막을 수 없지만, 그 도메인에서 생성된 계정에 자동적으로 특정한 모더레이션을 적용하게 할 수 있습니다.

View file

@ -26,6 +26,7 @@ ko:
password: 최소 8글자 password: 최소 8글자
phrase: 툿 내용이나 CW 내용 안에서 대소문자 구분 없이 매칭 됩니다 phrase: 툿 내용이나 CW 내용 안에서 대소문자 구분 없이 매칭 됩니다
scopes: 애플리케이션에 허용할 API들입니다. 최상위 스코프를 선택하면 개별적인 것은 선택하지 않아도 됩니다. scopes: 애플리케이션에 허용할 API들입니다. 최상위 스코프를 선택하면 개별적인 것은 선택하지 않아도 됩니다.
setting_advanced_layout: 고급 UI는 여러 개의 커스텀 가능한 컬럼을 제공합니다.
setting_aggregate_reblogs: 내가 부스트 했던 툿은 새로 부스트 되어도 보여주지 않습니다 setting_aggregate_reblogs: 내가 부스트 했던 툿은 새로 부스트 되어도 보여주지 않습니다
setting_default_language: 작성한 툿의 언어는 자동으로 인식할 수 있지만, 언제나 정확한 건 아닙니다 setting_default_language: 작성한 툿의 언어는 자동으로 인식할 수 있지만, 언제나 정확한 건 아닙니다
setting_display_media_default: 민감함으로 설정 된 미디어 가리기 setting_display_media_default: 민감함으로 설정 된 미디어 가리기
@ -90,6 +91,7 @@ ko:
otp_attempt: 2단계 인증 코드 otp_attempt: 2단계 인증 코드
password: 암호 password: 암호
phrase: 키워드 또는 문장 phrase: 키워드 또는 문장
setting_advanced_layout: 고급 웹 UI 활성화
setting_aggregate_reblogs: 타임라인의 부스트를 그룹화 setting_aggregate_reblogs: 타임라인의 부스트를 그룹화
setting_auto_play_gif: 애니메이션 GIF를 자동 재생 setting_auto_play_gif: 애니메이션 GIF를 자동 재생
setting_boost_modal: 부스트 전 확인 창을 표시 setting_boost_modal: 부스트 전 확인 창을 표시

View file

@ -5,7 +5,7 @@ const { URL } = require('url');
const merge = require('webpack-merge'); const merge = require('webpack-merge');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const OfflinePlugin = require('offline-plugin'); const OfflinePlugin = require('offline-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin'); const CompressionPlugin = require('compression-webpack-plugin');
const { output } = require('./configuration'); const { output } = require('./configuration');
const sharedConfig = require('./shared'); const sharedConfig = require('./shared');
@ -33,20 +33,10 @@ module.exports = merge(sharedConfig, {
optimization: { optimization: {
minimize: true, minimize: true,
minimizer: [ minimizer: [
new UglifyJsPlugin({ new TerserPlugin({
cache: true, cache: true,
parallel: true, parallel: true,
sourceMap: true, sourceMap: true,
uglifyOptions: {
compress: {
warnings: false,
},
output: {
comments: false,
},
},
}), }),
], ],
}, },
@ -64,6 +54,7 @@ module.exports = merge(sharedConfig, {
}), }),
new OfflinePlugin({ new OfflinePlugin({
publicPath: output.publicPath, // sw.js must be served from the root to avoid scope issues publicPath: output.publicPath, // sw.js must be served from the root to avoid scope issues
safeToUseOptionalCaches: true,
caches: { caches: {
main: [':rest:'], main: [':rest:'],
additional: [':externals:'], additional: [':externals:'],

View file

@ -12,6 +12,7 @@
"start": "node ./streaming/index.js", "start": "node ./streaming/index.js",
"test": "${npm_execpath} run test:lint && ${npm_execpath} run test:jest", "test": "${npm_execpath} run test:lint && ${npm_execpath} run test:jest",
"test:lint": "eslint --ext=js .", "test:lint": "eslint --ext=js .",
"test:lint:sass": "sass-lint .",
"test:jest": "cross-env NODE_ENV=test jest --coverage" "test:jest": "cross-env NODE_ENV=test jest --coverage"
}, },
"repository": { "repository": {
@ -58,18 +59,18 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@babel/core": "^7.3.4", "@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.3.4", "@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-proposal-decorators": "^7.3.0", "@babel/plugin-proposal-decorators": "^7.4.4",
"@babel/plugin-proposal-object-rest-spread": "^7.3.4", "@babel/plugin-proposal-object-rest-spread": "^7.4.4",
"@babel/plugin-syntax-dynamic-import": "^7.2.0", "@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-react-inline-elements": "^7.2.0", "@babel/plugin-transform-react-inline-elements": "^7.2.0",
"@babel/plugin-transform-react-jsx-self": "^7.2.0", "@babel/plugin-transform-react-jsx-self": "^7.2.0",
"@babel/plugin-transform-react-jsx-source": "^7.2.0", "@babel/plugin-transform-react-jsx-source": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.4.4", "@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.3.4", "@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0", "@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.3.4", "@babel/runtime": "^7.4.5",
"@clusterws/cws": "^0.14.0", "@clusterws/cws": "^0.14.0",
"array-includes": "^3.0.3", "array-includes": "^3.0.3",
"atrament": "^0.2.3", "atrament": "^0.2.3",
@ -78,7 +79,7 @@
"babel-loader": "^8.0.5", "babel-loader": "^8.0.5",
"babel-plugin-lodash": "^3.3.4", "babel-plugin-lodash": "^3.3.4",
"babel-plugin-preval": "^3.0.1", "babel-plugin-preval": "^3.0.1",
"babel-plugin-react-intl": "^3.1.0", "babel-plugin-react-intl": "^3.1.3",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24", "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"babel-runtime": "^6.26.0", "babel-runtime": "^6.26.0",
"blurhash": "^1.0.0", "blurhash": "^1.0.0",
@ -101,7 +102,7 @@
"http-link-header": "^1.0.2", "http-link-header": "^1.0.2",
"immutable": "^3.8.2", "immutable": "^3.8.2",
"imports-loader": "^0.8.0", "imports-loader": "^0.8.0",
"intersection-observer": "^0.5.1", "intersection-observer": "^0.7.0",
"intl": "^1.2.5", "intl": "^1.2.5",
"intl-messageformat": "^2.2.0", "intl-messageformat": "^2.2.0",
"intl-relativeformat": "^2.2.0", "intl-relativeformat": "^2.2.0",
@ -124,12 +125,12 @@
"prop-types": "^15.5.10", "prop-types": "^15.5.10",
"punycode": "^2.1.0", "punycode": "^2.1.0",
"rails-ujs": "^5.2.3", "rails-ujs": "^5.2.3",
"react": "^16.7.0", "react": "^16.8.6",
"react-dom": "^16.7.0", "react-dom": "^16.8.6",
"react-hotkeys": "^1.1.4", "react-hotkeys": "^1.1.4",
"react-immutable-proptypes": "^2.1.0", "react-immutable-proptypes": "^2.1.0",
"react-immutable-pure-component": "^1.1.1", "react-immutable-pure-component": "^1.1.1",
"react-intl": "^2.7.2", "react-intl": "^2.9.0",
"react-masonry-infinite": "^1.2.2", "react-masonry-infinite": "^1.2.2",
"react-motion": "^0.5.2", "react-motion": "^0.5.2",
"react-notification": "^6.8.4", "react-notification": "^6.8.4",
@ -140,7 +141,7 @@
"react-router-scroll-4": "^1.0.0-beta.1", "react-router-scroll-4": "^1.0.0-beta.1",
"react-select": "^2.4.4", "react-select": "^2.4.4",
"react-sparklines": "^1.7.0", "react-sparklines": "^1.7.0",
"react-swipeable-views": "^0.13.0", "react-swipeable-views": "^0.13.3",
"react-textarea-autosize": "^7.1.0", "react-textarea-autosize": "^7.1.0",
"react-toggle": "^4.0.1", "react-toggle": "^4.0.1",
"redis": "^2.7.1", "redis": "^2.7.1",
@ -151,13 +152,13 @@
"requestidlecallback": "^0.3.0", "requestidlecallback": "^0.3.0",
"reselect": "^4.0.0", "reselect": "^4.0.0",
"rimraf": "^2.6.3", "rimraf": "^2.6.3",
"sass": "^1.20.1", "sass": "^1.20.3",
"sass-loader": "^7.0.3", "sass-loader": "^7.0.3",
"stringz": "^1.0.0", "stringz": "^1.0.0",
"substring-trie": "^1.0.2", "substring-trie": "^1.0.2",
"terser-webpack-plugin": "^1.3.0",
"throng": "^4.0.0", "throng": "^4.0.0",
"tiny-queue": "^0.2.1", "tiny-queue": "^0.2.1",
"uglifyjs-webpack-plugin": "^2.1.2",
"uuid": "^3.1.0", "uuid": "^3.1.0",
"webpack": "^4.29.6", "webpack": "^4.29.6",
"webpack-assets-manifest": "^3.1.1", "webpack-assets-manifest": "^3.1.1",
@ -179,7 +180,8 @@
"jest": "^24.8.0", "jest": "^24.8.0",
"raf": "^3.4.1", "raf": "^3.4.1",
"react-intl-translations-manager": "^5.0.3", "react-intl-translations-manager": "^5.0.3",
"react-test-renderer": "^16.7.0", "react-test-renderer": "^16.8.6",
"sass-lint": "^1.13.1",
"webpack-dev-server": "^3.5.1", "webpack-dev-server": "^3.5.1",
"yargs": "^12.0.5" "yargs": "^12.0.5"
} }

View file

@ -10,14 +10,26 @@ RSpec.describe Api::V1::PollsController, type: :controller do
before { allow(controller).to receive(:doorkeeper_token) { token } } before { allow(controller).to receive(:doorkeeper_token) { token } }
describe 'GET #show' do describe 'GET #show' do
let(:poll) { Fabricate(:poll) } let(:poll) { Fabricate(:poll, status: Fabricate(:status, visibility: visibility)) }
before do before do
get :show, params: { id: poll.id } get :show, params: { id: poll.id }
end end
it 'returns http success' do context 'when parent status is public' do
expect(response).to have_http_status(200) let(:visibility) { 'public' }
it 'returns http success' do
expect(response).to have_http_status(200)
end
end
context 'when parent status is private' do
let(:visibility) { 'private' }
it 'returns http not found' do
expect(response).to have_http_status(404)
end
end end
end end
end end

1180
yarn.lock

File diff suppressed because it is too large Load diff