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
16 changed files with 952 additions and 365 deletions

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