From d2d99f86ddb3e19ad0198755666e6e3d6f03dbc8 Mon Sep 17 00:00:00 2001 From: Z Date: Mon, 11 Nov 2019 14:11:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=85[pub]=E5=BC=80=E5=A4=B4=E7=9A=84?= =?UTF-8?q?=E5=98=9F=E6=96=87=E7=AB=99=E5=A4=96=E5=8F=AF=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/statuses/_detailed_status.html.haml | 7 ++++--- app/views/statuses/_simple_status.html.haml | 6 +++--- app/views/statuses/show.html.haml | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/views/statuses/_detailed_status.html.haml b/app/views/statuses/_detailed_status.html.haml index 98e11e9a0..17db629b3 100644 --- a/app/views/statuses/_detailed_status.html.haml +++ b/app/views/statuses/_detailed_status.html.haml @@ -21,12 +21,13 @@ %span.p-summary> #{Formatter.instance.format_spoiler(status, autoplay: autoplay)}  %button.status__content__spoiler-link= t('statuses.show_more') .e-content{ style: "display: #{!current_account&.user&.setting_expand_spoilers && status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" } - = Formatter.instance.format(status, custom_emojify: true, autoplay: autoplay) - - if status.preloadable_poll + = (user_signed_in? || status.text.start_with?('[pub]')) ? (Formatter.instance.format(status, custom_emojify: true, autoplay: autoplay)) : t('accounts.unsigned') + + - if status.preloadable_poll && (user_signed_in? || status.text.start_with?('[pub]')) = react_component :poll, disabled: true, poll: ActiveModelSerializers::SerializableResource.new(status.preloadable_poll, serializer: REST::PollSerializer, scope: current_user, scope_name: :current_user).as_json do = render partial: 'statuses/poll', locals: { status: status, poll: status.preloadable_poll, autoplay: autoplay } - - if !status.media_attachments.empty? + - if !status.media_attachments.empty? && (user_signed_in? || status.text.start_with?('[pub]')) - if status.media_attachments.first.video? - video = status.media_attachments.first = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), blurhash: video.blurhash, sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, width: 670, height: 380, detailed: true, inline: true, alt: video.description do diff --git a/app/views/statuses/_simple_status.html.haml b/app/views/statuses/_simple_status.html.haml index 0ec173b4c..87d87d6f2 100644 --- a/app/views/statuses/_simple_status.html.haml +++ b/app/views/statuses/_simple_status.html.haml @@ -25,12 +25,12 @@ %span.p-summary> #{Formatter.instance.format_spoiler(status, autoplay: autoplay)}  %button.status__content__spoiler-link= t('statuses.show_more') .e-content{ style: "display: #{!current_account&.user&.setting_expand_spoilers && status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl_status?(status) ? 'rtl' : 'ltr'}" } - = Formatter.instance.format(status, custom_emojify: true, autoplay: autoplay) - - if status.preloadable_poll + = (user_signed_in? || status.text.start_with?('[pub]')) ? (Formatter.instance.format(status, custom_emojify: true, autoplay: autoplay)) : t('accounts.unsigned') + - if status.preloadable_poll && (user_signed_in? || status.text.start_with?('[pub]')) = react_component :poll, disabled: true, poll: ActiveModelSerializers::SerializableResource.new(status.preloadable_poll, serializer: REST::PollSerializer, scope: current_user, scope_name: :current_user).as_json do = render partial: 'statuses/poll', locals: { status: status, poll: status.preloadable_poll, autoplay: autoplay } - - if !status.media_attachments.empty? + - if !status.media_attachments.empty? && (user_signed_in? || status.text.start_with?('[pub]')) - if status.media_attachments.first.video? - video = status.media_attachments.first = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), blurhash: video.blurhash, sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, width: 610, height: 343, inline: true, alt: video.description do diff --git a/app/views/statuses/show.html.haml b/app/views/statuses/show.html.haml index 0f22d106b..d187b629f 100644 --- a/app/views/statuses/show.html.haml +++ b/app/views/statuses/show.html.haml @@ -1,5 +1,5 @@ - content_for :page_title do - = t('statuses.title', name: display_name(@account), quote: truncate(@status.spoiler_text.presence || @status.text, length: 50, omission: '…', escape: false)) + = t('statuses.title', name: display_name(@account), quote: truncate(@status.spoiler_text.presence || (user_signed_in? || @status.text.start_with?('[pub]')) ? @status.text : t('accounts.unsigned'), length: 50, omission: '…', escape: false)) - content_for :header_tags do - if @account.user&.setting_noindex