Browse Source

仅[pub]开头的嘟文站外可见

pull/4/head
欧醚 4 years ago
parent
commit
d2d99f86dd
3 changed files with 8 additions and 7 deletions
  1. +4
    -3
      app/views/statuses/_detailed_status.html.haml
  2. +3
    -3
      app/views/statuses/_simple_status.html.haml
  3. +1
    -1
      app/views/statuses/show.html.haml

+ 4
- 3
app/views/statuses/_detailed_status.html.haml View File

@ -21,12 +21,13 @@
%span.p-summary> #{Formatter.instance.format_spoiler(status, autoplay: autoplay)}  %span.p-summary> #{Formatter.instance.format_spoiler(status, autoplay: autoplay)} 
%button.status__content__spoiler-link= t('statuses.show_more') %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'}" } .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 = 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 } = 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? - if status.media_attachments.first.video?
- video = status.media_attachments.first - 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 = 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

+ 3
- 3
app/views/statuses/_simple_status.html.haml View File

@ -25,12 +25,12 @@
%span.p-summary> #{Formatter.instance.format_spoiler(status, autoplay: autoplay)}  %span.p-summary> #{Formatter.instance.format_spoiler(status, autoplay: autoplay)} 
%button.status__content__spoiler-link= t('statuses.show_more') %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'}" } .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 = 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 } = 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? - if status.media_attachments.first.video?
- video = status.media_attachments.first - 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 = 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

+ 1
- 1
app/views/statuses/show.html.haml View File

@ -1,5 +1,5 @@
- content_for :page_title do - 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 - content_for :header_tags do
- if @account.user&.setting_noindex - if @account.user&.setting_noindex

Loading…
Cancel
Save