about summary refs log tree commit diff
path: root/app/views
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-01-10 19:12:10 +0100
committerThibaut Girka <thib@sitedethib.com>2019-01-10 21:00:30 +0100
commita2a64ecd3e3551707412c47f0d16e484dea25632 (patch)
treebc4e0b8e0ca2a2735f527bff8bd73421c0ff72dd /app/views
parentfb0c906c717f2b21bb63610742a357850142b522 (diff)
parent70801b850c78d7879182eeba4eae509af42fafeb (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- .eslintrc.yml
  Removed, as upstream removed it.
- app/controllers/admin/statuses_controller.rb
  Minor code cleanup when porting one of our features.
- app/models/account.rb
  Note length validation has changed upstream.
  We now use upstream's validation (dropped legacy glitch-soc
  account metadata stuff) but with configurable limit.
- app/services/post_status_service.rb
  Upstream has added support for scheduled toots, refactoring
  the code a bit. Adapted our changes to this refactoring.
- app/views/stream_entries/_detailed_status.html.haml
  Not a real conflict, changes too close.
- app/views/stream_entries/_simple_status.html.haml
  Not a real conflict, changes too close.
Diffstat (limited to 'app/views')
-rw-r--r--app/views/admin/domain_blocks/_domain_block.html.haml13
-rw-r--r--app/views/admin/domain_blocks/index.html.haml17
-rw-r--r--app/views/admin/followers/index.html.haml2
-rw-r--r--app/views/admin/instances/_instance.html.haml7
-rw-r--r--app/views/admin/instances/index.html.haml48
-rw-r--r--app/views/admin/instances/show.html.haml44
-rw-r--r--app/views/remote_follow/new.html.haml4
-rw-r--r--app/views/remote_interaction/new.html.haml10
-rw-r--r--app/views/stream_entries/_detailed_status.html.haml10
-rw-r--r--app/views/stream_entries/_simple_status.html.haml10
10 files changed, 98 insertions, 67 deletions
diff --git a/app/views/admin/domain_blocks/_domain_block.html.haml b/app/views/admin/domain_blocks/_domain_block.html.haml
deleted file mode 100644
index 7bfea3574..000000000
--- a/app/views/admin/domain_blocks/_domain_block.html.haml
+++ /dev/null
@@ -1,13 +0,0 @@
-%tr
-  %td
-    %samp= domain_block.domain
-  %td.severity
-    = t("admin.domain_blocks.severities.#{domain_block.severity}")
-  %td.reject_media
-    - if domain_block.reject_media? || domain_block.suspend?
-      %i.fa.fa-check
-  %td.reject_reports
-    - if domain_block.reject_reports? || domain_block.suspend?
-      %i.fa.fa-check
-  %td
-    = table_link_to 'undo', t('admin.domain_blocks.undo'), admin_domain_block_path(domain_block)
diff --git a/app/views/admin/domain_blocks/index.html.haml b/app/views/admin/domain_blocks/index.html.haml
deleted file mode 100644
index 4c5221c42..000000000
--- a/app/views/admin/domain_blocks/index.html.haml
+++ /dev/null
@@ -1,17 +0,0 @@
-- content_for :page_title do
-  = t('admin.domain_blocks.title')
-
-.table-wrapper
-  %table.table
-    %thead
-      %tr
-        %th= t('admin.domain_blocks.domain')
-        %th= t('admin.domain_blocks.severity')
-        %th= t('admin.domain_blocks.reject_media')
-        %th= t('admin.domain_blocks.reject_reports')
-        %th
-    %tbody
-      = render @domain_blocks
-
-= paginate @domain_blocks
-= link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path, class: 'button'
diff --git a/app/views/admin/followers/index.html.haml b/app/views/admin/followers/index.html.haml
index 31b321bac..25f1f290f 100644
--- a/app/views/admin/followers/index.html.haml
+++ b/app/views/admin/followers/index.html.haml
@@ -23,6 +23,6 @@
         %th= t('admin.accounts.most_recent_activity')
         %th
     %tbody
-      = render partial: 'admin/accounts/account', collection: @followers.map(&:account)
+      = render partial: 'admin/accounts/account', collection: @followers
 
 = paginate @followers
diff --git a/app/views/admin/instances/_instance.html.haml b/app/views/admin/instances/_instance.html.haml
deleted file mode 100644
index e36ebae47..000000000
--- a/app/views/admin/instances/_instance.html.haml
+++ /dev/null
@@ -1,7 +0,0 @@
-%tr
-  %td
-    = link_to instance.domain, admin_accounts_path(by_domain: instance.domain)
-  %td.count
-    = instance.accounts_count
-  %td
-    = table_link_to 'paper-plane-o', t('admin.accounts.resubscribe'), resubscribe_admin_instances_url(by_domain: instance.domain), method: :post, data: { confirm: t('admin.accounts.are_you_sure') }
diff --git a/app/views/admin/instances/index.html.haml b/app/views/admin/instances/index.html.haml
index 3314ce077..ce35b5db4 100644
--- a/app/views/admin/instances/index.html.haml
+++ b/app/views/admin/instances/index.html.haml
@@ -1,23 +1,39 @@
 - content_for :page_title do
   = t('admin.instances.title')
 
-= form_tag admin_instances_url, method: 'GET', class: 'simple_form' do
-  .fields-group
-    - %i(domain_name).each do |key|
-      .input.string.optional
-        = text_field_tag key, params[key], class: 'string optional', placeholder: I18n.t("admin.instances.#{key}")
+.filters
+  .filter-subset
+    %strong= t('admin.instances.moderation.title')
+    %ul
+      %li= filter_link_to t('admin.instances.moderation.all'), limited: nil
+      %li= filter_link_to t('admin.instances.moderation.limited'), limited: '1'
 
-    .actions
-      %button= t('admin.instances.search')
-      = link_to t('admin.instances.reset'), admin_instances_path, class: 'button negative'
+  %div{ style: 'flex: 1 1 auto; text-align: right' }
+    = link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path, class: 'button'
 
-.table-wrapper
-  %table.table
-    %thead
-      %tr
-        %th= t('admin.instances.domain_name')
-        %th= t('admin.instances.account_count')
-    %tbody
-      = render @instances
+%hr.spacer/
+
+- @instances.each do |instance|
+  .directory__tag
+    = link_to admin_instance_path(instance) do
+      %h4
+        = instance.domain
+        %small
+          = t('admin.instances.known_accounts', count: instance.accounts_count)
+
+          - if instance.domain_block
+            - if !instance.domain_block.noop?
+              &bull;
+              = t("admin.domain_blocks.severity.#{instance.domain_block.severity}")
+            - if instance.domain_block.reject_media?
+              &bull;
+              = t('admin.domain_blocks.rejecting_media')
+            - if instance.domain_block.reject_reports?
+              &bull;
+              = t('admin.domain_blocks.rejecting_reports')
+
+      .avatar-stack
+        - instance.cached_sample_accounts.each do |account|
+          = image_tag current_account&.user&.setting_auto_play_gif ? account.avatar_original_url : account.avatar_static_url, width: 48, height: 48, alt: '', class: 'account__avatar'
 
 = paginate paginated_instances
diff --git a/app/views/admin/instances/show.html.haml b/app/views/admin/instances/show.html.haml
new file mode 100644
index 000000000..c7992a490
--- /dev/null
+++ b/app/views/admin/instances/show.html.haml
@@ -0,0 +1,44 @@
+- content_for :page_title do
+  = @instance.domain
+
+.dashboard__counters
+  %div
+    %div
+      .dashboard__counters__num= number_with_delimiter @following_count
+      .dashboard__counters__label= t 'admin.instances.total_followed_by_them'
+  %div
+    %div
+      .dashboard__counters__num= number_with_delimiter @followers_count
+      .dashboard__counters__label= t 'admin.instances.total_followed_by_us'
+  %div
+    %div
+      .dashboard__counters__num= number_to_human_size @media_storage
+      .dashboard__counters__label= t 'admin.instances.total_storage'
+  %div
+    %div
+      .dashboard__counters__num= number_with_delimiter @blocks_count
+      .dashboard__counters__label= t 'admin.instances.total_blocked_by_us'
+  %div
+    %div
+      .dashboard__counters__num= number_with_delimiter @reports_count
+      .dashboard__counters__label= t 'admin.instances.total_reported'
+  %div
+    %div
+      .dashboard__counters__num
+        - if @available
+          = fa_icon 'check'
+        - else
+          = fa_icon 'times'
+      .dashboard__counters__label= t 'admin.instances.delivery_available'
+
+%hr.spacer/
+
+%div{ style: 'overflow: hidden' }
+  %div{ style: 'float: left' }
+    = link_to t('admin.accounts.title'), admin_accounts_path(remote: '1', by_domain: @instance.domain), class: 'button'
+
+  %div{ style: 'float: right' }
+    - if @domain_block
+      = link_to t('admin.domain_blocks.undo'), admin_domain_block_path(@domain_block), class: 'button'
+    - else
+      = link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path(_domain: @instance.domain), class: 'button'
diff --git a/app/views/remote_follow/new.html.haml b/app/views/remote_follow/new.html.haml
index 9b679015f..5cf6977ba 100644
--- a/app/views/remote_follow/new.html.haml
+++ b/app/views/remote_follow/new.html.haml
@@ -16,4 +16,6 @@
     .actions
       = f.button :button, t('remote_follow.proceed'), type: :submit
 
-    %p.hint.subtle-hint= t('remote_follow.no_account_html', sign_up_path: open_registrations? ? new_user_registration_path : 'https://joinmastodon.org/#getting-started')
+    %p.hint.subtle-hint
+      = t('remote_follow.reason_html', instance: site_hostname)
+      = t('remote_follow.no_account_html', sign_up_path: open_registrations? ? new_user_registration_path : 'https://joinmastodon.org/#getting-started')
diff --git a/app/views/remote_interaction/new.html.haml b/app/views/remote_interaction/new.html.haml
index 7357546b6..a0b106814 100644
--- a/app/views/remote_interaction/new.html.haml
+++ b/app/views/remote_interaction/new.html.haml
@@ -1,6 +1,6 @@
 .form-container
   .follow-prompt
-    %h2= t('remote_interaction.prompt')
+    %h2= t("remote_interaction.#{@interaction_type}.prompt")
 
     .public-layout
       .activity-stream.activity-stream--highlighted
@@ -9,9 +9,13 @@
   = simple_form_for @remote_follow, as: :remote_follow, url: remote_interaction_path(@status) do |f|
     = render 'shared/error_messages', object: @remote_follow
 
+    = hidden_field_tag :type, @interaction_type
+
     = f.input :acct, placeholder: t('remote_follow.acct'), input_html: { autocapitalize: 'none', autocorrect: 'off' }
 
     .actions
-      = f.button :button, t('remote_interaction.proceed'), type: :submit
+      = f.button :button, t("remote_interaction.#{@interaction_type}.proceed"), type: :submit
 
-    %p.hint.subtle-hint= t('remote_follow.no_account_html', sign_up_path: open_registrations? ? new_user_registration_path : 'https://joinmastodon.org/#getting-started')
+    %p.hint.subtle-hint
+      = t('remote_follow.reason_html', instance: site_hostname)
+      = t('remote_follow.no_account_html', sign_up_path: open_registrations? ? new_user_registration_path : 'https://joinmastodon.org/#getting-started')
diff --git a/app/views/stream_entries/_detailed_status.html.haml b/app/views/stream_entries/_detailed_status.html.haml
index 447667c5a..9298ecbb0 100644
--- a/app/views/stream_entries/_detailed_status.html.haml
+++ b/app/views/stream_entries/_detailed_status.html.haml
@@ -28,8 +28,8 @@
       = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), 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
     - else
       = react_component :media_gallery, height: 380, sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, standalone: true, 'autoPlayGif': current_account&.user&.setting_auto_play_gif || autoplay, 'reduceMotion': current_account&.user&.setting_reduce_motion, media: status.media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json }
-  - elsif status.preview_cards.first
-    = react_component :card, 'maxDescription': 160, card: ActiveModelSerializers::SerializableResource.new(status.preview_cards.first, serializer: REST::PreviewCardSerializer).as_json
+  - elsif status.preview_card
+    = react_component :card, 'maxDescription': 160, card: ActiveModelSerializers::SerializableResource.new(status.preview_card, serializer: REST::PreviewCardSerializer).as_json
 
   .detailed-status__meta
     %data.dt-published{ value: status.created_at.to_time.iso8601 }
@@ -43,7 +43,7 @@
       - else
         = link_to status.application.name, status.application.website, class: 'detailed-status__application', target: '_blank', rel: 'noopener'
       ·
-    = link_to remote_interaction_path(status), class: 'modal-button detailed-status__link' do
+    = link_to remote_interaction_path(status, type: :reply), class: 'modal-button detailed-status__link' do
       - if status.in_reply_to_id.nil?
         = fa_icon('reply')
       - else
@@ -58,12 +58,12 @@
       %span.detailed-status__link<
         = fa_icon('lock')
     - else
-      = link_to remote_interaction_path(status), class: 'modal-button detailed-status__link' do
+      = link_to remote_interaction_path(status, type: :reblog), class: 'modal-button detailed-status__link' do
         = fa_icon('retweet')
         %span.detailed-status__reblogs>= number_to_human status.reblogs_count, strip_insignificant_zeros: true
         = " "
     ·
-    = link_to remote_interaction_path(status), class: 'modal-button detailed-status__link' do
+    = link_to remote_interaction_path(status, type: :favourite), class: 'modal-button detailed-status__link' do
       = fa_icon('star')
       %span.detailed-status__favorites>= number_to_human status.favourites_count, strip_insignificant_zeros: true
       = " "
diff --git a/app/views/stream_entries/_simple_status.html.haml b/app/views/stream_entries/_simple_status.html.haml
index 3a4dacc06..1d44be791 100644
--- a/app/views/stream_entries/_simple_status.html.haml
+++ b/app/views/stream_entries/_simple_status.html.haml
@@ -27,27 +27,29 @@
     .e-content{ lang: status.language, 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)
 
-  - unless status.media_attachments.empty?
+  - if !status.media_attachments.empty?
     - if status.media_attachments.first.video?
       - video = status.media_attachments.first
       = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, width: 610, height: 343, inline: true, alt: video.description
     - else
       = react_component :media_gallery, height: 343, sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, 'autoPlayGif': current_account&.user&.setting_auto_play_gif || autoplay, media: status.media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json }
+  - elsif status.preview_card
+    = react_component :card, 'maxDescription': 160, card: ActiveModelSerializers::SerializableResource.new(status.preview_card, serializer: REST::PreviewCardSerializer).as_json
 
   .status__action-bar
     .status__action-bar__counter
-      = link_to remote_interaction_path(status), class: 'status__action-bar-button icon-button modal-button', style: 'font-size: 18px; width: 23.1429px; height: 23.1429px; line-height: 23.15px;' do
+      = link_to remote_interaction_path(status, type: :reply), class: 'status__action-bar-button icon-button modal-button', style: 'font-size: 18px; width: 23.1429px; height: 23.1429px; line-height: 23.15px;' do
         - if status.in_reply_to_id.nil?
           = fa_icon 'reply fw'
         - else
           = fa_icon 'reply-all fw'
       .status__action-bar__counter__label= obscured_counter status.replies_count
-    = link_to remote_interaction_path(status), class: 'status__action-bar-button icon-button modal-button', style: 'font-size: 18px; width: 23.1429px; height: 23.1429px; line-height: 23.15px;' do
+    = link_to remote_interaction_path(status, type: :reblog), class: 'status__action-bar-button icon-button modal-button', style: 'font-size: 18px; width: 23.1429px; height: 23.1429px; line-height: 23.15px;' do
       - if status.public_visibility? || status.unlisted_visibility?
         = fa_icon 'retweet fw'
       - elsif status.private_visibility?
         = fa_icon 'lock fw'
       - else
         = fa_icon 'envelope fw'
-    = link_to remote_interaction_path(status), class: 'status__action-bar-button icon-button modal-button', style: 'font-size: 18px; width: 23.1429px; height: 23.1429px; line-height: 23.15px;' do
+    = link_to remote_interaction_path(status, type: :favourite), class: 'status__action-bar-button icon-button modal-button', style: 'font-size: 18px; width: 23.1429px; height: 23.1429px; line-height: 23.15px;' do
       = fa_icon 'star fw'