about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-06-04 20:40:19 +0200
committerThibaut Girka <thib@sitedethib.com>2019-06-04 20:40:19 +0200
commit02b56c7e1a0fa561af9a85f765ec22eee3053561 (patch)
treeba851bcad4bf9f657a0c2414ac3befdea9acea15 /app
parent58946fef3c05342289c1c50132996fc4fd01cf68 (diff)
parent48fee1a800a262ce26171d724c15738d083eb6d6 (diff)
Merge remote-tracking branch 'upstream/master' into glitch-soc/merge-upstream
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api/v1/polls_controller.rb17
-rw-r--r--app/javascript/mastodon/features/ui/components/navigation_panel.js3
-rw-r--r--app/javascript/mastodon/locales/ko.json4
-rw-r--r--app/lib/activitypub/activity/create.rb2
4 files changed, 22 insertions, 4 deletions
diff --git a/app/controllers/api/v1/polls_controller.rb b/app/controllers/api/v1/polls_controller.rb
index 4f4a6858d..031e6d42d 100644
--- a/app/controllers/api/v1/polls_controller.rb
+++ b/app/controllers/api/v1/polls_controller.rb
@@ -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
+    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?
-    render json: @poll, serializer: REST::PollSerializer, include_results: true
   end
 end
diff --git a/app/javascript/mastodon/features/ui/components/navigation_panel.js b/app/javascript/mastodon/features/ui/components/navigation_panel.js
index 613be7391..1d783ba1b 100644
--- a/app/javascript/mastodon/features/ui/components/navigation_panel.js
+++ b/app/javascript/mastodon/features/ui/components/navigation_panel.js
@@ -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>
 );
 
diff --git a/app/javascript/mastodon/locales/ko.json b/app/javascript/mastodon/locales/ko.json
index 9a49ce4aa..bd7b9764d 100644
--- a/app/javascript/mastodon/locales/ko.json
+++ b/app/javascript/mastodon/locales/ko.json
@@ -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": "추천 지우기",
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb
index 2bc33c04b..f55dd35b2 100644
--- a/app/lib/activitypub/activity/create.rb
+++ b/app/lib/activitypub/activity/create.rb
@@ -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