Merge remote-tracking branch 'upstream/master' into glitch-soc/merge-upstream

This commit is contained in:
Thibaut Girka 2019-06-04 20:40:19 +02:00
commit 02b56c7e1a
16 changed files with 952 additions and 365 deletions

View file

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

View file

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

View file

@ -1,9 +1,9 @@
# 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'
exclude:
files:
include: app/javascript/styles/**/*.scss
ignore:
- app/javascript/styles/reset.scss
linters:

View file

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

View file

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

View file

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

View file

@ -1,13 +1,28 @@
# frozen_string_literal: true
class Api::V1::PollsController < Api::BaseController
include Authorization
before_action -> { authorize_if_got_token! :read, :'read:statuses' }, only: :show
before_action :set_poll
before_action :refresh_poll
respond_to :json
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
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

View file

@ -22,7 +22,8 @@ const NavigationPanel = () => (
<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='/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>
);

View file

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

View file

@ -234,7 +234,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
@account.polls.new(
multiple: multiple,
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 }
)
end

View file

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

View file

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

View file

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

View file

@ -12,6 +12,7 @@
"start": "node ./streaming/index.js",
"test": "${npm_execpath} run test:lint && ${npm_execpath} run test:jest",
"test:lint": "eslint --ext=js .",
"test:lint:sass": "sass-lint .",
"test:jest": "cross-env NODE_ENV=test jest --coverage"
},
"repository": {
@ -58,18 +59,18 @@
},
"private": true,
"dependencies": {
"@babel/core": "^7.3.4",
"@babel/plugin-proposal-class-properties": "^7.3.4",
"@babel/plugin-proposal-decorators": "^7.3.0",
"@babel/plugin-proposal-object-rest-spread": "^7.3.4",
"@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-proposal-decorators": "^7.4.4",
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
"@babel/plugin-syntax-dynamic-import": "^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-source": "^7.2.0",
"@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/runtime": "^7.3.4",
"@babel/runtime": "^7.4.5",
"@clusterws/cws": "^0.14.0",
"array-includes": "^3.0.3",
"atrament": "^0.2.3",
@ -78,7 +79,7 @@
"babel-loader": "^8.0.5",
"babel-plugin-lodash": "^3.3.4",
"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-runtime": "^6.26.0",
"blurhash": "^1.0.0",
@ -101,7 +102,7 @@
"http-link-header": "^1.0.2",
"immutable": "^3.8.2",
"imports-loader": "^0.8.0",
"intersection-observer": "^0.5.1",
"intersection-observer": "^0.7.0",
"intl": "^1.2.5",
"intl-messageformat": "^2.2.0",
"intl-relativeformat": "^2.2.0",
@ -124,12 +125,12 @@
"prop-types": "^15.5.10",
"punycode": "^2.1.0",
"rails-ujs": "^5.2.3",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-hotkeys": "^1.1.4",
"react-immutable-proptypes": "^2.1.0",
"react-immutable-pure-component": "^1.1.1",
"react-intl": "^2.7.2",
"react-intl": "^2.9.0",
"react-masonry-infinite": "^1.2.2",
"react-motion": "^0.5.2",
"react-notification": "^6.8.4",
@ -140,7 +141,7 @@
"react-router-scroll-4": "^1.0.0-beta.1",
"react-select": "^2.4.4",
"react-sparklines": "^1.7.0",
"react-swipeable-views": "^0.13.0",
"react-swipeable-views": "^0.13.3",
"react-textarea-autosize": "^7.1.0",
"react-toggle": "^4.0.1",
"redis": "^2.7.1",
@ -151,13 +152,13 @@
"requestidlecallback": "^0.3.0",
"reselect": "^4.0.0",
"rimraf": "^2.6.3",
"sass": "^1.20.1",
"sass": "^1.20.3",
"sass-loader": "^7.0.3",
"stringz": "^1.0.0",
"substring-trie": "^1.0.2",
"terser-webpack-plugin": "^1.3.0",
"throng": "^4.0.0",
"tiny-queue": "^0.2.1",
"uglifyjs-webpack-plugin": "^2.1.2",
"uuid": "^3.1.0",
"webpack": "^4.29.6",
"webpack-assets-manifest": "^3.1.1",
@ -179,7 +180,8 @@
"jest": "^24.8.0",
"raf": "^3.4.1",
"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",
"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 } }
describe 'GET #show' do
let(:poll) { Fabricate(:poll) }
let(:poll) { Fabricate(:poll, status: Fabricate(:status, visibility: visibility)) }
before do
get :show, params: { id: poll.id }
end
context 'when parent status is public' do
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

1180
yarn.lock

File diff suppressed because it is too large Load diff