Merge branch 'main' into glitch-soc/merge-upstream

Conflicts:
- `app/views/admin/trends/links/index.html.haml`:
  Not really a conflict, upstream change textually too close to a glitch-soc
  change (removed `javascript_pack_tag` to accomodate for glitch-soc's theming
  system).
  Ported upstream changes.
- `app/views/admin/trends/links/preview_card_providers/index.html.haml`:
  Not really a conflict, upstream change textually too close to a glitch-soc
  change (removed `javascript_pack_tag` to accomodate for glitch-soc's theming
  system).
  Ported upstream changes.
- `app/views/admin/trends/statuses/index.html.haml`:
  Not really a conflict, upstream change textually too close to a glitch-soc
  change (removed `javascript_pack_tag` to accomodate for glitch-soc's theming
  system).
  Ported upstream changes.
- `app/views/admin/trends/tags/index.html.haml`:
  Not really a conflict, upstream change textually too close to a glitch-soc
  change (removed `javascript_pack_tag` to accomodate for glitch-soc's theming
  system).
  Ported upstream changes.
This commit is contained in:
Claire
2022-03-02 20:48:27 +01:00
14 changed files with 100 additions and 31 deletions

View File

@@ -10,9 +10,7 @@ class Api::V1::ReportsController < Api::BaseController
@report = ReportService.new.call(
current_account,
reported_account,
status_ids: reported_status_ids,
comment: report_params[:comment],
forward: report_params[:forward]
report_params
)
render json: @report, serializer: REST::ReportSerializer
@@ -20,14 +18,6 @@ class Api::V1::ReportsController < Api::BaseController
private
def reported_status_ids
reported_account.statuses.with_discarded.find(status_ids).pluck(:id)
end
def status_ids
Array(report_params[:status_ids])
end
def reported_account
Account.find(report_params[:account_id])
end

View File

@@ -94,8 +94,9 @@ class Api::V1::StatusesController < Api::BaseController
end
def set_thread
@thread = status_params[:in_reply_to_id].blank? ? nil : Status.find(status_params[:in_reply_to_id])
rescue ActiveRecord::RecordNotFound
@thread = Status.find(status_params[:in_reply_to_id]) if status_params[:in_reply_to_id].present?
authorize(@thread, :show?) if @thread.present?
rescue ActiveRecord::RecordNotFound, Mastodon::NotPermittedError
render json: { error: I18n.t('statuses.errors.in_reply_not_found') }, status: 404
end

View File

@@ -904,6 +904,14 @@ a.name-tag,
text-align: center;
}
.applications-list__item {
padding: 15px 0;
background: $ui-base-color;
border: 1px solid lighten($ui-base-color, 4%);
border-radius: 4px;
margin-top: 15px;
}
.announcements-list {
border: 1px solid lighten($ui-base-color, 4%);
border-radius: 4px;

View File

@@ -1069,6 +1069,7 @@ code {
&:last-child {
border-bottom: 0;
padding-bottom: 0;
}
}
}

View File

@@ -6,10 +6,10 @@ class ReportService < BaseService
def call(source_account, target_account, options = {})
@source_account = source_account
@target_account = target_account
@status_ids = options.delete(:status_ids) || []
@comment = options.delete(:comment) || ''
@category = options.delete(:category) || 'other'
@rule_ids = options.delete(:rule_ids)
@status_ids = options.delete(:status_ids).presence || []
@comment = options.delete(:comment).presence || ''
@category = options.delete(:category).presence || 'other'
@rule_ids = options.delete(:rule_ids).presence
@options = options
raise ActiveRecord::RecordNotFound if @target_account.suspended?
@@ -26,7 +26,7 @@ class ReportService < BaseService
def create_report!
@report = @source_account.reports.create!(
target_account: @target_account,
status_ids: @status_ids,
status_ids: reported_status_ids,
comment: @comment,
uri: @options[:uri],
forwarded: forward?,
@@ -56,6 +56,10 @@ class ReportService < BaseService
!@target_account.local? && ActiveModel::Type::Boolean.new.cast(@options[:forward])
end
def reported_status_ids
@target_account.statuses.with_discarded.find(Array(@status_ids)).pluck(:id)
end
def payload
Oj.dump(serialize_payload(@report, ActivityPub::FlagSerializer, account: some_local_account))
end

View File

@@ -1,6 +1,10 @@
- content_for :page_title do
= t('admin.trends.links.title')
%p= t('admin.trends.links.description_html')
%hr.spacer/
= form_tag admin_trends_links_path, method: 'GET', class: 'simple_form' do
- Trends::PreviewCardFilter::KEYS.each do |key|
= hidden_field_tag key, params[key] if params[key].present?

View File

@@ -1,6 +1,10 @@
- content_for :page_title do
= t('admin.trends.preview_card_providers.title')
%p= t('admin.trends.preview_card_providers.description_html')
%hr.spacer/
.filters
.filter-subset
%strong= t('admin.tags.review')
@@ -14,7 +18,6 @@
= fa_icon 'chevron-left fw'
= t('admin.trends.links.title')
%hr.spacer/
= form_for(@form, url: batch_admin_trends_links_preview_card_providers_path) do |f|

View File

@@ -22,6 +22,9 @@
- if status.language.present?
= standard_locale_name(status.language)
- if status.trendable? && !status.account.discoverable?
= t('admin.trends.statuses.not_discoverable')
- if status.trendable? && (rank = Trends.statuses.rank(status.id))
%abbr{ title: t('admin.trends.tags.current_score', score: Trends.statuses.score(status.id)) }= t('admin.trends.tags.trending_rank', rank: rank + 1)

View File

@@ -1,6 +1,10 @@
- content_for :page_title do
= t('admin.trends.statuses.title')
%p= t('admin.trends.statuses.description_html')
%hr.spacer/
= form_tag admin_trends_statuses_path, method: 'GET', class: 'simple_form' do
- Trends::StatusFilter::KEYS.each do |key|
= hidden_field_tag key, params[key] if params[key].present?

View File

@@ -1,6 +1,10 @@
- content_for :page_title do
= t('admin.trends.tags.title')
%p= t('admin.trends.tags.description_html')
%hr.spacer/
.filters
.filter-subset
%strong= t('admin.tags.review')

View File

@@ -5,9 +5,9 @@
%hr.spacer/
.announcements-list
.applications-list
- @applications.each do |application|
.announcements-list__item
.applications-list__item
- if application.website.present?
= link_to application.name, application.website, target: '_blank', rel: 'noopener noreferrer', class: 'announcements-list__item__title'
- else