From 5cbbd2c3b5b1298dc0ed5a0110c20a49bdb7d84e Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 12 Oct 2018 02:04:07 +0200 Subject: Fix microformats on statuses according to updated spec (#8958) --- .../stream_entries/_detailed_status.html.haml | 25 ++++++++++---------- app/views/stream_entries/_simple_status.html.haml | 27 +++++++++++----------- 2 files changed, 27 insertions(+), 25 deletions(-) (limited to 'app/views') diff --git a/app/views/stream_entries/_detailed_status.html.haml b/app/views/stream_entries/_detailed_status.html.haml index 6cedfb337..0b204d437 100644 --- a/app/views/stream_entries/_detailed_status.html.haml +++ b/app/views/stream_entries/_detailed_status.html.haml @@ -1,16 +1,17 @@ .detailed-status.detailed-status--flex - = link_to TagManager.instance.url_for(status.account), class: 'detailed-status__display-name p-author h-card', target: stream_link_target, rel: 'noopener' do - .detailed-status__display-avatar - - if current_account&.user&.setting_auto_play_gif || autoplay - = image_tag status.account.avatar_original_url, width: 48, height: 48, alt: '', class: 'account__avatar u-photo' - - else - = image_tag status.account.avatar_static_url, width: 48, height: 48, alt: '', class: 'account__avatar u-photo' - %span.display-name - %bdi - %strong.display-name__html.p-name.emojify= display_name(status.account, custom_emojify: true, autoplay: autoplay) - %span.display-name__account - = acct(status.account) - = fa_icon('lock') if status.account.locked? + .p-author.h-card + = link_to TagManager.instance.url_for(status.account), class: 'detailed-status__display-name u-url', target: stream_link_target, rel: 'noopener' do + .detailed-status__display-avatar + - if current_account&.user&.setting_auto_play_gif || autoplay + = image_tag status.account.avatar_original_url, width: 48, height: 48, alt: '', class: 'account__avatar u-photo' + - else + = image_tag status.account.avatar_static_url, width: 48, height: 48, alt: '', class: 'account__avatar u-photo' + %span.display-name + %bdi + %strong.display-name__html.p-name.emojify= display_name(status.account, custom_emojify: true, autoplay: autoplay) + %span.display-name__account + = acct(status.account) + = fa_icon('lock') if status.account.locked? = account_action_button(status.account) diff --git a/app/views/stream_entries/_simple_status.html.haml b/app/views/stream_entries/_simple_status.html.haml index 7401f82c2..1b00388b1 100644 --- a/app/views/stream_entries/_simple_status.html.haml +++ b/app/views/stream_entries/_simple_status.html.haml @@ -4,19 +4,20 @@ %time.time-ago{ datetime: status.created_at.iso8601, title: l(status.created_at) }= l(status.created_at) %data.dt-published{ value: status.created_at.to_time.iso8601 } - = link_to TagManager.instance.url_for(status.account), class: 'status__display-name p-author h-card', target: stream_link_target, rel: 'noopener' do - .status__avatar - %div - - if current_account&.user&.setting_auto_play_gif || autoplay - = image_tag status.account.avatar_original_url, width: 48, height: 48, alt: '', class: 'u-photo account__avatar' - - else - = image_tag status.account.avatar_static_url, width: 48, height: 48, alt: '', class: 'u-photo account__avatar' - %span.display-name - %bdi - %strong.display-name__html.p-name.emojify= display_name(status.account, custom_emojify: true, autoplay: autoplay) - %span.display-name__account - = acct(status.account) - = fa_icon('lock') if status.account.locked? + .p-author.h-card + = link_to TagManager.instance.url_for(status.account), class: 'status__display-name u-url', target: stream_link_target, rel: 'noopener' do + .status__avatar + %div + - if current_account&.user&.setting_auto_play_gif || autoplay + = image_tag status.account.avatar_original_url, width: 48, height: 48, alt: '', class: 'u-photo account__avatar' + - else + = image_tag status.account.avatar_static_url, width: 48, height: 48, alt: '', class: 'u-photo account__avatar' + %span.display-name + %bdi + %strong.display-name__html.p-name.emojify= display_name(status.account, custom_emojify: true, autoplay: autoplay) + %span.display-name__account + = acct(status.account) + = fa_icon('lock') if status.account.locked? .status__content.emojify< - if status.spoiler_text? %p{ :style => ('margin-bottom: 0' unless current_account&.user&.setting_expand_spoilers) }< -- cgit From 22de24b8ca707d8eac26eab6615377a290ff1f4e Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 12 Oct 2018 02:19:10 +0200 Subject: Fix missing protocol in dns-prefetch, improve code style (#8963) Regression from #8942 --- app/helpers/application_helper.rb | 6 +++--- app/views/layouts/embedded.html.haml | 6 ++++++ config/environments/production.rb | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'app/views') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8533b398a..c33975cac 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -83,7 +83,7 @@ module ApplicationHelper end def cdn_host - ENV['CDN_HOST'].presence + Rails.configuration.action_controller.asset_host end def cdn_host? @@ -91,10 +91,10 @@ module ApplicationHelper end def storage_host - ENV['S3_ALIAS_HOST'].presence || ENV['S3_CLOUDFRONT_HOST'].presence + "https://#{ENV['S3_ALIAS_HOST'].presence || ENV['S3_CLOUDFRONT_HOST']}" end def storage_host? - storage_host.present? + ENV['S3_ALIAS_HOST'].present? || ENV['S3_CLOUDFRONT_HOST'].present? end end diff --git a/app/views/layouts/embedded.html.haml b/app/views/layouts/embedded.html.haml index ac11cfbe7..0503dcdc1 100644 --- a/app/views/layouts/embedded.html.haml +++ b/app/views/layouts/embedded.html.haml @@ -4,6 +4,12 @@ %meta{ charset: 'utf-8' }/ %meta{ name: 'robots', content: 'noindex' }/ + - if cdn_host? + %link{ rel: 'dns-prefetch', href: cdn_host }/ + + - if storage_host? + %link{ rel: 'dns-prefetch', href: storage_host }/ + = stylesheet_pack_tag 'common', media: 'all' = stylesheet_pack_tag Setting.default_settings['theme'], media: 'all' = javascript_pack_tag 'common', integrity: true, crossorigin: 'anonymous' diff --git a/config/environments/production.rb b/config/environments/production.rb index ed2d885b0..70baa6ad1 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -13,7 +13,7 @@ Rails.application.configure do # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true - config.action_controller.asset_host = ENV['CDN_HOST'] if ENV.key?('CDN_HOST') + config.action_controller.asset_host = ENV['CDN_HOST'] if ENV['CDN_HOST'].present? # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). -- cgit From 9d4541c612b506889675c4c19ced5cd17ad3710f Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 12 Oct 2018 04:04:08 +0200 Subject: Display customized mascot in web UI and fix admin form for it (#8964) Follow-up to #8766 --- app/javascript/mastodon/features/compose/index.js | 3 ++- app/javascript/mastodon/initial_state.js | 1 + app/serializers/initial_state_serializer.rb | 7 +++++++ app/views/admin/settings/edit.html.haml | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) (limited to 'app/views') diff --git a/app/javascript/mastodon/features/compose/index.js b/app/javascript/mastodon/features/compose/index.js index cf1714b71..d76cd76e6 100644 --- a/app/javascript/mastodon/features/compose/index.js +++ b/app/javascript/mastodon/features/compose/index.js @@ -13,6 +13,7 @@ import spring from 'react-motion/lib/spring'; import SearchResultsContainer from './containers/search_results_container'; import { changeComposing } from '../../actions/compose'; import elephantUIPlane from '../../../images/elephant_ui_plane.svg'; +import { mascot } from '../../initial_state'; const messages = defineMessages({ start: { id: 'getting_started.heading', defaultMessage: 'Getting started' }, @@ -107,7 +108,7 @@ class Compose extends React.PureComponent { {multiColumn && (
- +
)} } diff --git a/app/javascript/mastodon/initial_state.js b/app/javascript/mastodon/initial_state.js index 262c93195..6e9e3ddd8 100644 --- a/app/javascript/mastodon/initial_state.js +++ b/app/javascript/mastodon/initial_state.js @@ -14,5 +14,6 @@ export const me = getMeta('me'); export const searchEnabled = getMeta('search_enabled'); export const invitesEnabled = getMeta('invites_enabled'); export const version = getMeta('version'); +export const mascot = getMeta('mascot'); export default initialState; diff --git a/app/serializers/initial_state_serializer.rb b/app/serializers/initial_state_serializer.rb index cdc470831..57f1e0098 100644 --- a/app/serializers/initial_state_serializer.rb +++ b/app/serializers/initial_state_serializer.rb @@ -16,6 +16,7 @@ class InitialStateSerializer < ActiveModel::Serializer search_enabled: Chewy.enabled?, version: Mastodon::Version.to_s, invites_enabled: Setting.min_invite_role == 'user', + mascot: instance_presenter.mascot&.file&.url, } if object.current_account @@ -56,4 +57,10 @@ class InitialStateSerializer < ActiveModel::Serializer def media_attachments { accept_content_types: MediaAttachment::IMAGE_FILE_EXTENSIONS + MediaAttachment::VIDEO_FILE_EXTENSIONS + MediaAttachment::IMAGE_MIME_TYPES + MediaAttachment::VIDEO_MIME_TYPES } end + + private + + def instance_presenter + @instance_presenter ||= InstancePresenter.new + end end diff --git a/app/views/admin/settings/edit.html.haml b/app/views/admin/settings/edit.html.haml index f3f9bdaf0..04b1a6754 100644 --- a/app/views/admin/settings/edit.html.haml +++ b/app/views/admin/settings/edit.html.haml @@ -26,6 +26,8 @@ = f.input :thumbnail, as: :file, wrapper: :with_block_label, label: t('admin.settings.thumbnail.title'), hint: t('admin.settings.thumbnail.desc_html') .fields-row__column.fields-row__column-6.fields-group = f.input :hero, as: :file, wrapper: :with_block_label, label: t('admin.settings.hero.title'), hint: t('admin.settings.hero.desc_html') + + .fields-row .fields-row__column.fields-row__column-6.fields-group = f.input :mascot, as: :file, wrapper: :with_block_label, label: t('admin.settings.mascot.title'), hint: t('admin.settings.mascot.desc_html') -- cgit From 35b576dbecfd9e980206189b61efe58fba9269b9 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 16 Oct 2018 14:07:54 +0200 Subject: Improve form for selecting media display preference (#8965) Regression from #8569 --- app/views/settings/preferences/show.html.haml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'app/views') diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml index 608a290e7..d889702fe 100644 --- a/app/views/settings/preferences/show.html.haml +++ b/app/views/settings/preferences/show.html.haml @@ -36,9 +36,11 @@ %hr#settings_web/ - - if Themes.instance.names.size > 1 - .fields-group - = f.input :setting_theme, collection: Themes.instance.names, label_method: lambda { |theme| I18n.t("themes.#{theme}", default: theme) }, wrapper: :with_block_label, include_blank: false + .fields-row + .fields-group.fields-row__column.fields-row__column-6 + = f.input :setting_theme, collection: Themes.instance.names, label_method: lambda { |theme| I18n.t("themes.#{theme}", default: theme) }, wrapper: :with_label, include_blank: false, hint: false + .fields-group.fields-row__column.fields-row__column-6 + = f.input :setting_display_media, collection: ['default', 'show_all', 'hide_all'], wrapper: :with_label, include_blank: false, label_method: lambda { |item| t("simple_form.hints.defaults.setting_display_media_#{item}") }, hint: false .fields-group = f.input :setting_unfollow_modal, as: :boolean, wrapper: :with_label @@ -47,7 +49,6 @@ .fields-group = f.input :setting_auto_play_gif, as: :boolean, wrapper: :with_label - = f.input :setting_display_media, collection: ['default', 'show_all', 'hide_all'], wrapper: :with_label, include_blank: false, label_method: lambda { |item| safe_join([t("simple_form.labels.defaults.setting_display_media_#{item}"), content_tag(:span, t("simple_form.hints.defaults.setting_display_media_#{item}"), class: 'hint')]) }, required: false, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li' = f.input :setting_expand_spoilers, as: :boolean, wrapper: :with_label = f.input :setting_reduce_motion, as: :boolean, wrapper: :with_label = f.input :setting_system_font_ui, as: :boolean, wrapper: :with_label -- cgit From ddd30f331c7a2af38176d72d9ce2265068984bed Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 17 Oct 2018 17:13:04 +0200 Subject: Improve support for aspects/circles (#8950) * Add silent column to mentions * Save silent mentions in ActivityPub Create handler and optimize it Move networking calls out of the database transaction * Add "limited" visibility level masked as "private" in the API Unlike DMs, limited statuses are pushed into home feeds. The access control rules between direct and limited statuses is almost the same, except for counter and conversation logic * Ensure silent column is non-null, add spec * Ensure filters don't check silent mentions for blocks/mutes As those are "this person is also allowed to see" rather than "this person is involved", therefore does not warrant filtering * Clean up code * Use Status#active_mentions to limit returned mentions * Fix code style issues * Use Status#active_mentions in Notification And remove stream_entry eager-loading from Notification --- app/lib/activitypub/activity.rb | 2 +- app/lib/activitypub/activity/create.rb | 24 +++++++++++++++++- app/lib/activitypub/tag_manager.rb | 6 ++--- app/lib/feed_manager.rb | 8 +++--- app/lib/formatter.rb | 2 +- app/lib/ostatus/atom_serializer.rb | 2 +- app/models/account_conversation.rb | 2 +- app/models/mention.rb | 8 ++++++ app/models/notification.rb | 2 +- app/models/status.rb | 15 +++++++---- app/models/stream_entry.rb | 2 +- app/policies/status_policy.rb | 8 +++--- app/serializers/activitypub/note_serializer.rb | 2 +- app/serializers/rest/status_serializer.rb | 13 +++++++++- app/services/batched_remove_status_service.rb | 2 +- app/services/fan_out_on_write_service.rb | 12 +++++++++ app/services/remove_status_service.rb | 2 +- .../stream_entries/_detailed_status.html.haml | 2 +- app/workers/activitypub/distribution_worker.rb | 2 +- .../activitypub/reply_distribution_worker.rb | 6 +---- .../20181010141500_add_silent_to_mentions.rb | 23 +++++++++++++++++ db/schema.rb | 3 ++- spec/lib/activitypub/activity/create_spec.rb | 29 ++++++++++++++++++++++ 23 files changed, 142 insertions(+), 35 deletions(-) create mode 100644 db/migrate/20181010141500_add_silent_to_mentions.rb (limited to 'app/views') diff --git a/app/lib/activitypub/activity.rb b/app/lib/activitypub/activity.rb index 3a39b723e..999954cb5 100644 --- a/app/lib/activitypub/activity.rb +++ b/app/lib/activitypub/activity.rb @@ -96,7 +96,7 @@ class ActivityPub::Activity end def notify_about_mentions(status) - status.mentions.includes(:account).each do |mention| + status.active_mentions.includes(:account).each do |mention| next unless mention.account.local? && audience_includes?(mention.account) NotifyService.new.call(mention.account, mention) end diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index 73475bf02..7e6702a63 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -28,6 +28,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity process_status_params process_tags + process_audience ApplicationRecord.transaction do @status = Status.create!(@params) @@ -66,6 +67,27 @@ class ActivityPub::Activity::Create < ActivityPub::Activity end end + def process_audience + (as_array(@object['to']) + as_array(@object['cc'])).uniq.each do |audience| + next if audience == ActivityPub::TagManager::COLLECTIONS[:public] + + # Unlike with tags, there is no point in resolving accounts we don't already + # know here, because silent mentions would only be used for local access + # control anyway + account = account_from_uri(audience) + + next if account.nil? || @mentions.any? { |mention| mention.account_id == account.id } + + @mentions << Mention.new(account: account, silent: true) + + # If there is at least one silent mention, then the status can be considered + # as a limited-audience status, and not strictly a direct message + next unless @params[:visibility] == :direct + + @params[:visibility] = :limited + end + end + def attach_tags(status) @tags.each do |tag| status.tags << tag @@ -113,7 +135,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity return if account.nil? - @mentions << Mention.new(account: account) + @mentions << Mention.new(account: account, silent: false) end def process_emoji(tag) diff --git a/app/lib/activitypub/tag_manager.rb b/app/lib/activitypub/tag_manager.rb index 95d1cf9f3..be3a562d0 100644 --- a/app/lib/activitypub/tag_manager.rb +++ b/app/lib/activitypub/tag_manager.rb @@ -58,8 +58,8 @@ class ActivityPub::TagManager [COLLECTIONS[:public]] when 'unlisted', 'private' [account_followers_url(status.account)] - when 'direct' - status.mentions.map { |mention| uri_for(mention.account) } + when 'direct', 'limited' + status.active_mentions.map { |mention| uri_for(mention.account) } end end @@ -80,7 +80,7 @@ class ActivityPub::TagManager cc << COLLECTIONS[:public] end - cc.concat(status.mentions.map { |mention| uri_for(mention.account) }) unless status.direct_visibility? + cc.concat(status.active_mentions.map { |mention| uri_for(mention.account) }) unless status.direct_visibility? || status.limited_visibility? cc end diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index b10e5dd24..3d7db2721 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -88,7 +88,7 @@ class FeedManager end query.each do |status| - next if status.direct_visibility? || filter?(:home, status, into_account) + next if status.direct_visibility? || status.limited_visibility? || filter?(:home, status, into_account) add_to_feed(:home, into_account.id, status) end @@ -156,12 +156,12 @@ class FeedManager return true if status.reply? && (status.in_reply_to_id.nil? || status.in_reply_to_account_id.nil?) return true if phrase_filtered?(status, receiver_id, :home) - check_for_blocks = status.mentions.pluck(:account_id) + check_for_blocks = status.active_mentions.pluck(:account_id) check_for_blocks.concat([status.account_id]) if status.reblog? check_for_blocks.concat([status.reblog.account_id]) - check_for_blocks.concat(status.reblog.mentions.pluck(:account_id)) + check_for_blocks.concat(status.reblog.active_mentions.pluck(:account_id)) end return true if blocks_or_mutes?(receiver_id, check_for_blocks, :home) @@ -188,7 +188,7 @@ class FeedManager # This filter is called from NotifyService, but already after the sender of # the notification has been checked for mute/block. Therefore, it's not # necessary to check the author of the toot for mute/block again - check_for_blocks = status.mentions.pluck(:account_id) + check_for_blocks = status.active_mentions.pluck(:account_id) check_for_blocks.concat([status.in_reply_to_account]) if status.reply? && !status.in_reply_to_account_id.nil? should_filter = blocks_or_mutes?(receiver_id, check_for_blocks, :mentions) # Filter if it's from someone I blocked, in reply to someone I blocked, or mentioning someone I blocked (or muted) diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index 35d5a09b7..d13884ec8 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -27,7 +27,7 @@ class Formatter return html.html_safe # rubocop:disable Rails/OutputSafety end - linkable_accounts = status.mentions.map(&:account) + linkable_accounts = status.active_mentions.map(&:account) linkable_accounts << status.account html = raw_content diff --git a/app/lib/ostatus/atom_serializer.rb b/app/lib/ostatus/atom_serializer.rb index 1a0a635b3..7a181fb40 100644 --- a/app/lib/ostatus/atom_serializer.rb +++ b/app/lib/ostatus/atom_serializer.rb @@ -354,7 +354,7 @@ class OStatus::AtomSerializer append_element(entry, 'summary', status.spoiler_text, 'xml:lang': status.language) if status.spoiler_text? append_element(entry, 'content', Formatter.instance.format(status).to_str || '.', type: 'html', 'xml:lang': status.language) - status.mentions.sort_by(&:id).each do |mentioned| + status.active_mentions.sort_by(&:id).each do |mentioned| append_element(entry, 'link', nil, rel: :mentioned, 'ostatus:object-type': OStatus::TagManager::TYPES[:person], href: OStatus::TagManager.instance.uri_for(mentioned.account)) end diff --git a/app/models/account_conversation.rb b/app/models/account_conversation.rb index a7205ec1a..c12c8d233 100644 --- a/app/models/account_conversation.rb +++ b/app/models/account_conversation.rb @@ -85,7 +85,7 @@ class AccountConversation < ApplicationRecord private def participants_from_status(recipient, status) - ((status.mentions.pluck(:account_id) + [status.account_id]).uniq - [recipient.id]).sort + ((status.active_mentions.pluck(:account_id) + [status.account_id]).uniq - [recipient.id]).sort end end diff --git a/app/models/mention.rb b/app/models/mention.rb index 8ab886b18..d01a88e32 100644 --- a/app/models/mention.rb +++ b/app/models/mention.rb @@ -8,6 +8,7 @@ # created_at :datetime not null # updated_at :datetime not null # account_id :bigint(8) +# silent :boolean default(FALSE), not null # class Mention < ApplicationRecord @@ -18,10 +19,17 @@ class Mention < ApplicationRecord validates :account, uniqueness: { scope: :status } + scope :active, -> { where(silent: false) } + scope :silent, -> { where(silent: true) } + delegate( :username, :acct, to: :account, prefix: true ) + + def active? + !silent? + end end diff --git a/app/models/notification.rb b/app/models/notification.rb index b9bec0808..78b180301 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -24,7 +24,7 @@ class Notification < ApplicationRecord favourite: 'Favourite', }.freeze - STATUS_INCLUDES = [:account, :application, :stream_entry, :media_attachments, :tags, mentions: :account, reblog: [:stream_entry, :account, :application, :media_attachments, :tags, mentions: :account]].freeze + STATUS_INCLUDES = [:account, :application, :media_attachments, :tags, active_mentions: :account, reblog: [:account, :application, :media_attachments, :tags, active_mentions: :account]].freeze belongs_to :account, optional: true belongs_to :from_account, class_name: 'Account', optional: true diff --git a/app/models/status.rb b/app/models/status.rb index f61bd0fee..b18cb56b2 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -37,7 +37,7 @@ class Status < ApplicationRecord update_index('statuses#status', :proper) if Chewy.enabled? - enum visibility: [:public, :unlisted, :private, :direct], _suffix: :visibility + enum visibility: [:public, :unlisted, :private, :direct, :limited], _suffix: :visibility belongs_to :application, class_name: 'Doorkeeper::Application', optional: true @@ -51,7 +51,8 @@ class Status < ApplicationRecord has_many :favourites, inverse_of: :status, dependent: :destroy has_many :reblogs, foreign_key: 'reblog_of_id', class_name: 'Status', inverse_of: :reblog, dependent: :destroy has_many :replies, foreign_key: 'in_reply_to_id', class_name: 'Status', inverse_of: :thread - has_many :mentions, dependent: :destroy + has_many :mentions, dependent: :destroy, inverse_of: :status + has_many :active_mentions, -> { active }, class_name: 'Mention', inverse_of: :status has_many :media_attachments, dependent: :nullify has_and_belongs_to_many :tags @@ -89,7 +90,7 @@ class Status < ApplicationRecord :status_stat, :tags, :stream_entry, - mentions: :account, + active_mentions: :account, reblog: [ :account, :application, @@ -98,7 +99,7 @@ class Status < ApplicationRecord :media_attachments, :conversation, :status_stat, - mentions: :account, + active_mentions: :account, ], thread: :account @@ -171,7 +172,11 @@ class Status < ApplicationRecord end def hidden? - private_visibility? || direct_visibility? + private_visibility? || direct_visibility? || limited_visibility? + end + + def distributable? + public_visibility? || unlisted_visibility? end def with_media? diff --git a/app/models/stream_entry.rb b/app/models/stream_entry.rb index a2f273281..1a9afc5c7 100644 --- a/app/models/stream_entry.rb +++ b/app/models/stream_entry.rb @@ -48,7 +48,7 @@ class StreamEntry < ApplicationRecord end def mentions - orphaned? ? [] : status.mentions.map(&:account) + orphaned? ? [] : status.active_mentions.map(&:account) end private diff --git a/app/policies/status_policy.rb b/app/policies/status_policy.rb index 6addc8a8a..64a5111fc 100644 --- a/app/policies/status_policy.rb +++ b/app/policies/status_policy.rb @@ -12,7 +12,7 @@ class StatusPolicy < ApplicationPolicy end def show? - if direct? + if requires_mention? owned? || mention_exists? elsif private? owned? || following_author? || mention_exists? @@ -22,7 +22,7 @@ class StatusPolicy < ApplicationPolicy end def reblog? - !direct? && (!private? || owned?) && show? && !blocking_author? + !requires_mention? && (!private? || owned?) && show? && !blocking_author? end def favourite? @@ -41,8 +41,8 @@ class StatusPolicy < ApplicationPolicy private - def direct? - record.direct_visibility? + def requires_mention? + record.direct_visibility? || record.limited_visibility? end def owned? diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb index 82b7ffe95..c9d23e25f 100644 --- a/app/serializers/activitypub/note_serializer.rb +++ b/app/serializers/activitypub/note_serializer.rb @@ -68,7 +68,7 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer end def virtual_tags - object.mentions.to_a.sort_by(&:id) + object.tags + object.emojis + object.active_mentions.to_a.sort_by(&:id) + object.tags + object.emojis end def atom_uri diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index 61423f961..1f2f46b7e 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -36,6 +36,17 @@ class REST::StatusSerializer < ActiveModel::Serializer !current_user.nil? end + def visibility + # This visibility is masked behind "private" + # to avoid API changes because there are no + # UX differences + if object.limited_visibility? + 'private' + else + object.visibility + end + end + def uri OStatus::TagManager.instance.uri_for(object) end @@ -88,7 +99,7 @@ class REST::StatusSerializer < ActiveModel::Serializer end def ordered_mentions - object.mentions.to_a.sort_by(&:id) + object.active_mentions.to_a.sort_by(&:id) end class ApplicationSerializer < ActiveModel::Serializer diff --git a/app/services/batched_remove_status_service.rb b/app/services/batched_remove_status_service.rb index 2fcb3cc66..b8ab58938 100644 --- a/app/services/batched_remove_status_service.rb +++ b/app/services/batched_remove_status_service.rb @@ -12,7 +12,7 @@ class BatchedRemoveStatusService < BaseService def call(statuses) statuses = Status.where(id: statuses.map(&:id)).includes(:account, :stream_entry).flat_map { |status| [status] + status.reblogs.includes(:account, :stream_entry).to_a } - @mentions = statuses.map { |s| [s.id, s.mentions.includes(:account).to_a] }.to_h + @mentions = statuses.map { |s| [s.id, s.active_mentions.includes(:account).to_a] }.to_h @tags = statuses.map { |s| [s.id, s.tags.pluck(:name)] }.to_h @stream_entry_batches = [] diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 5ddddf3a9..7f2a91775 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -10,6 +10,8 @@ class FanOutOnWriteService < BaseService if status.direct_visibility? deliver_to_own_conversation(status) + elsif status.limited_visibility? + deliver_to_mentioned_followers(status) else deliver_to_self(status) if status.account.local? deliver_to_followers(status) @@ -53,6 +55,16 @@ class FanOutOnWriteService < BaseService end end + def deliver_to_mentioned_followers(status) + Rails.logger.debug "Delivering status #{status.id} to limited followers" + + status.mentions.includes(:account).each do |mention| + mentioned_account = mention.account + next if !mentioned_account.local? || !mentioned_account.following?(status.account) || FeedManager.instance.filter?(:home, status, mention.account_id) + FeedManager.instance.push_to_home(mentioned_account, status) + end + end + def render_anonymous_payload(status) @payload = InlineRenderer.render(status, nil, :status) @payload = Oj.dump(event: :update, payload: @payload) diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index 1ee645e6d..11d28e783 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -8,7 +8,7 @@ class RemoveStatusService < BaseService @status = status @account = status.account @tags = status.tags.pluck(:name).to_a - @mentions = status.mentions.includes(:account).to_a + @mentions = status.active_mentions.includes(:account).to_a @reblogs = status.reblogs.to_a @stream_entry = status.stream_entry @options = options diff --git a/app/views/stream_entries/_detailed_status.html.haml b/app/views/stream_entries/_detailed_status.html.haml index 0b204d437..6e6d0eda8 100644 --- a/app/views/stream_entries/_detailed_status.html.haml +++ b/app/views/stream_entries/_detailed_status.html.haml @@ -51,7 +51,7 @@ - if status.direct_visibility? %span.detailed-status__link< = fa_icon('envelope') - - elsif status.private_visibility? + - elsif status.private_visibility? || status.limited_visibility? %span.detailed-status__link< = fa_icon('lock') - else diff --git a/app/workers/activitypub/distribution_worker.rb b/app/workers/activitypub/distribution_worker.rb index c2bfd4f2f..17c1ef7ff 100644 --- a/app/workers/activitypub/distribution_worker.rb +++ b/app/workers/activitypub/distribution_worker.rb @@ -23,7 +23,7 @@ class ActivityPub::DistributionWorker private def skip_distribution? - @status.direct_visibility? + @status.direct_visibility? || @status.limited_visibility? end def relayable? diff --git a/app/workers/activitypub/reply_distribution_worker.rb b/app/workers/activitypub/reply_distribution_worker.rb index fe99fc05f..c0ed3a1f4 100644 --- a/app/workers/activitypub/reply_distribution_worker.rb +++ b/app/workers/activitypub/reply_distribution_worker.rb @@ -9,7 +9,7 @@ class ActivityPub::ReplyDistributionWorker @status = Status.find(status_id) @account = @status.thread&.account - return if @account.nil? || skip_distribution? + return unless @account.present? && @status.distributable? ActivityPub::DeliveryWorker.push_bulk(inboxes) do |inbox_url| [signed_payload, @status.account_id, inbox_url] @@ -20,10 +20,6 @@ class ActivityPub::ReplyDistributionWorker private - def skip_distribution? - @status.private_visibility? || @status.direct_visibility? - end - def inboxes @inboxes ||= @account.followers.inboxes end diff --git a/db/migrate/20181010141500_add_silent_to_mentions.rb b/db/migrate/20181010141500_add_silent_to_mentions.rb new file mode 100644 index 000000000..dbb4fba26 --- /dev/null +++ b/db/migrate/20181010141500_add_silent_to_mentions.rb @@ -0,0 +1,23 @@ +require Rails.root.join('lib', 'mastodon', 'migration_helpers') + +class AddSilentToMentions < ActiveRecord::Migration[5.2] + include Mastodon::MigrationHelpers + + disable_ddl_transaction! + + def up + safety_assured do + add_column_with_default( + :mentions, + :silent, + :boolean, + allow_null: false, + default: false + ) + end + end + + def down + remove_column :mentions, :silent + end +end diff --git a/db/schema.rb b/db/schema.rb index bf6ab4e68..f79f26f16 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2018_10_07_025445) do +ActiveRecord::Schema.define(version: 2018_10_10_141500) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -301,6 +301,7 @@ ActiveRecord::Schema.define(version: 2018_10_07_025445) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.bigint "account_id" + t.boolean "silent", default: false, null: false t.index ["account_id", "status_id"], name: "index_mentions_on_account_id_and_status_id", unique: true t.index ["status_id"], name: "index_mentions_on_status_id" end diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb index 62b9db8c2..cd20b7c7c 100644 --- a/spec/lib/activitypub/activity/create_spec.rb +++ b/spec/lib/activitypub/activity/create_spec.rb @@ -105,6 +105,31 @@ RSpec.describe ActivityPub::Activity::Create do end end + context 'limited' do + let(:recipient) { Fabricate(:account) } + + let(:object_json) do + { + id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, + type: 'Note', + content: 'Lorem ipsum', + to: ActivityPub::TagManager.instance.uri_for(recipient), + } + end + + it 'creates status' do + status = sender.statuses.first + + expect(status).to_not be_nil + expect(status.visibility).to eq 'limited' + end + + it 'creates silent mention' do + status = sender.statuses.first + expect(status.mentions.first).to be_silent + end + end + context 'direct' do let(:recipient) { Fabricate(:account) } @@ -114,6 +139,10 @@ RSpec.describe ActivityPub::Activity::Create do type: 'Note', content: 'Lorem ipsum', to: ActivityPub::TagManager.instance.uri_for(recipient), + tag: { + type: 'Mention', + href: ActivityPub::TagManager.instance.uri_for(recipient), + }, } end -- cgit From 72d7d3003b1e21ef8a6f5112f1e8cb32c72e8992 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 17 Oct 2018 22:04:40 +0200 Subject: Do not show "limited" visibility in default visibility preference (#8999) * Do not show "limited" visibility in default visibility preference Fix regression from #8950 * Fix code style issue --- app/models/status.rb | 4 ++++ app/views/settings/preferences/show.html.haml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'app/views') diff --git a/app/models/status.rb b/app/models/status.rb index b18cb56b2..bcb7dd373 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -238,6 +238,10 @@ class Status < ApplicationRecord left_outer_joins(:status_stat).select('statuses.id, greatest(statuses.updated_at, status_stats.updated_at) AS updated_at') end + def selectable_visibilities + visibilities.keys - %w(direct limited) + end + def in_chosen_languages(account) where(language: nil).or where(language: account.chosen_languages) end diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml index d889702fe..ecb789f93 100644 --- a/app/views/settings/preferences/show.html.haml +++ b/app/views/settings/preferences/show.html.haml @@ -22,7 +22,7 @@ %hr#settings_publishing/ .fields-group - = f.input :setting_default_privacy, collection: Status.visibilities.keys - ['direct'], wrapper: :with_floating_label, include_blank: false, label_method: lambda { |visibility| safe_join([I18n.t("statuses.visibilities.#{visibility}"), content_tag(:span, I18n.t("statuses.visibilities.#{visibility}_long"), class: 'hint')]) }, required: false, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li' + = f.input :setting_default_privacy, collection: Status.selectable_visibilities, wrapper: :with_floating_label, include_blank: false, label_method: lambda { |visibility| safe_join([I18n.t("statuses.visibilities.#{visibility}"), content_tag(:span, I18n.t("statuses.visibilities.#{visibility}_long"), class: 'hint')]) }, required: false, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li' = f.input :setting_default_sensitive, as: :boolean, wrapper: :with_label -- cgit From 9486f0ca7774a148845a45db74ae8527cc963e85 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 20 Oct 2018 02:39:39 +0200 Subject: Add "disable" button to report screen (#9024) * Add "disable" button to report screen * i18n-tasks remove-unused --- app/controllers/admin/reports_controller.rb | 9 +++++++++ app/views/admin/accounts/show.html.haml | 6 +++--- app/views/admin/reports/show.html.haml | 6 ++++-- config/locales/ar.yml | 2 -- config/locales/ca.yml | 2 -- config/locales/co.yml | 2 -- config/locales/cs.yml | 2 -- config/locales/cy.yml | 1 - config/locales/da.yml | 2 -- config/locales/de.yml | 2 -- config/locales/el.yml | 2 -- config/locales/en.yml | 4 +--- config/locales/eo.yml | 2 -- config/locales/es.yml | 2 -- config/locales/eu.yml | 2 -- config/locales/fa.yml | 2 -- config/locales/fi.yml | 2 -- config/locales/fr.yml | 2 -- config/locales/gl.yml | 2 -- config/locales/he.yml | 2 -- config/locales/hu.yml | 2 -- config/locales/id.yml | 2 -- config/locales/io.yml | 2 -- config/locales/it.yml | 2 -- config/locales/ja.yml | 2 -- config/locales/ka.yml | 2 -- config/locales/ko.yml | 2 -- config/locales/nl.yml | 2 -- config/locales/no.yml | 2 -- config/locales/oc.yml | 3 --- config/locales/pl.yml | 2 -- config/locales/pt-BR.yml | 2 -- config/locales/pt.yml | 2 -- config/locales/ru.yml | 2 -- config/locales/sk.yml | 2 -- config/locales/sr-Latn.yml | 2 -- config/locales/sr.yml | 2 -- config/locales/sv.yml | 2 -- config/locales/th.yml | 2 -- config/locales/tr.yml | 2 -- config/locales/uk.yml | 2 -- config/locales/zh-CN.yml | 2 -- config/locales/zh-HK.yml | 2 -- config/locales/zh-TW.yml | 2 -- 44 files changed, 17 insertions(+), 88 deletions(-) (limited to 'app/views') diff --git a/app/controllers/admin/reports_controller.rb b/app/controllers/admin/reports_controller.rb index 5d7f43e00..e97ddb9b6 100644 --- a/app/controllers/admin/reports_controller.rb +++ b/app/controllers/admin/reports_controller.rb @@ -44,6 +44,14 @@ module Admin when 'resolve' @report.resolve!(current_account) log_action :resolve, @report + when 'disable' + @report.resolve!(current_account) + @report.target_account.user.disable! + + log_action :resolve, @report + log_action :disable, @report.target_account.user + + resolve_all_target_account_reports when 'silence' @report.resolve!(current_account) @report.target_account.update!(silenced: true) @@ -55,6 +63,7 @@ module Admin else raise ActiveRecord::RecordNotFound end + @report.reload end diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml index f2c53e3fe..17f1f224d 100644 --- a/app/views/admin/accounts/show.html.haml +++ b/app/views/admin/accounts/show.html.haml @@ -106,7 +106,7 @@ - if @account.user&.otp_required_for_login? = link_to t('admin.accounts.disable_two_factor_authentication'), admin_user_two_factor_authentication_path(@account.user.id), method: :delete, class: 'button' if can?(:disable_2fa, @account.user) - unless @account.memorial? - = link_to t('admin.accounts.memorialize'), memorialize_admin_account_path(@account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') }, class: 'button' if can?(:memorialize, @account) + = link_to t('admin.accounts.memorialize'), memorialize_admin_account_path(@account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') }, class: 'button button--destructive' if can?(:memorialize, @account) - else = link_to t('admin.accounts.redownload'), redownload_admin_account_path(@account.id), method: :post, class: 'button' if can?(:redownload, @account) @@ -114,7 +114,7 @@ - if @account.silenced? = link_to t('admin.accounts.undo_silenced'), admin_account_silence_path(@account.id), method: :delete, class: 'button' if can?(:unsilence, @account) - else - = link_to t('admin.accounts.silence'), admin_account_silence_path(@account.id), method: :post, class: 'button' if can?(:silence, @account) + = link_to t('admin.accounts.silence'), admin_account_silence_path(@account.id), method: :post, class: 'button button--destructive' if can?(:silence, @account) - if @account.local? - unless @account.user_confirmed? @@ -123,7 +123,7 @@ - if @account.suspended? = link_to t('admin.accounts.undo_suspension'), admin_account_suspension_path(@account.id), method: :delete, class: 'button' if can?(:unsuspend, @account) - else - = link_to t('admin.accounts.perform_full_suspension'), new_admin_account_suspension_path(@account.id), class: 'button' if can?(:suspend, @account) + = link_to t('admin.accounts.perform_full_suspension'), new_admin_account_suspension_path(@account.id), class: 'button button--destructive' if can?(:suspend, @account) - if !@account.local? && @account.hub_url.present? %hr.spacer/ diff --git a/app/views/admin/reports/show.html.haml b/app/views/admin/reports/show.html.haml index ef0e4aa41..3588d151d 100644 --- a/app/views/admin/reports/show.html.haml +++ b/app/views/admin/reports/show.html.haml @@ -7,8 +7,10 @@ %div{ style: 'overflow: hidden; margin-bottom: 20px' } - if @report.unresolved? %div{ style: 'float: right' } - = link_to t('admin.reports.silence_account'), admin_report_path(@report, outcome: 'silence'), method: :put, class: 'button' - = link_to t('admin.reports.suspend_account'), new_admin_account_suspension_path(@report.target_account_id, report_id: @report.id), class: 'button' + - if @report.target_account.local? + = link_to t('admin.accounts.disable'), admin_report_path(@report, outcome: 'disable'), method: :put, class: 'button button--destructive' + = link_to t('admin.accounts.silence'), admin_report_path(@report, outcome: 'silence'), method: :put, class: 'button button--destructive' + = link_to t('admin.accounts.perform_full_suspension'), new_admin_account_suspension_path(@report.target_account_id, report_id: @report.id), class: 'button button--destructive' %div{ style: 'float: left' } = link_to t('admin.reports.mark_as_resolved'), admin_report_path(@report, outcome: 'resolve'), method: :put, class: 'button' - else diff --git a/config/locales/ar.yml b/config/locales/ar.yml index 0a8d3fdd4..4499830f9 100644 --- a/config/locales/ar.yml +++ b/config/locales/ar.yml @@ -346,9 +346,7 @@ ar: reported_by: أبلغ عنه من طرف resolved: معالجة resolved_msg: تم حل تقرير بنجاح! - silence_account: كتم و إخفاء الحساب status: الحالة - suspend_account: فرض تعليق على الحساب title: التقارير unassign: إلغاء تعيين unresolved: غير معالجة diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 354d45713..d7211f654 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -336,9 +336,7 @@ ca: reported_by: Reportat per resolved: Resolt resolved_msg: Informe resolt amb èxit! - silence_account: Silencia el compte status: Estat - suspend_account: Suspèn el compte title: Informes unassign: Treure assignació unresolved: No resolt diff --git a/config/locales/co.yml b/config/locales/co.yml index 0eac457e8..7b810e2ed 100644 --- a/config/locales/co.yml +++ b/config/locales/co.yml @@ -345,9 +345,7 @@ co: reported_by: Palisatu da resolved: Scioltu è chjosu resolved_msg: Signalamentu scioltu! - silence_account: Silenzà u contu status: Statutu - suspend_account: Suspende u contu title: Signalamenti unassign: Disassignà unresolved: Micca sciolti diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 2ab2beec5..67bda70f1 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -345,9 +345,7 @@ cs: reported_by: Nahlášeno uživatelem resolved: Vyřešeno resolved_msg: Nahlášení úspěšně vyřešeno! - silence_account: Utišit účet status: Stav - suspend_account: Suspendovat účet title: Nahlášení unassign: Odebrat unresolved: Nevyřešeno diff --git a/config/locales/cy.yml b/config/locales/cy.yml index 88aa3ee56..8b16949a5 100644 --- a/config/locales/cy.yml +++ b/config/locales/cy.yml @@ -329,7 +329,6 @@ cy: reported_by: Adroddwyd gan resolved: Wedi ei ddatrys resolved_msg: Llwyddwyd i ddatrys yr adroddiad! - silence_account: Tawelwch y cyfrif status: Statws title: Adroddiadau unassign: Dadneilltuo diff --git a/config/locales/da.yml b/config/locales/da.yml index 7cda5cbca..0cd3e78f7 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -336,9 +336,7 @@ da: reported_by: Anmeldt af resolved: Løst resolved_msg: Anmeldelse er sat til at være løst! - silence_account: Dæmp konto status: Status - suspend_account: Udeluk konto title: Anmeldelser unassign: Utildel unresolved: Uløst diff --git a/config/locales/de.yml b/config/locales/de.yml index fb0235e0c..12e015226 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -344,9 +344,7 @@ de: reported_by: Gemeldet von resolved: Gelöst resolved_msg: Meldung erfolgreich gelöst! - silence_account: Konto stummschalten status: Status - suspend_account: Konto sperren title: Meldungen unassign: Zuweisung entfernen unresolved: Ungelöst diff --git a/config/locales/el.yml b/config/locales/el.yml index 63c438a93..fbd8a6461 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -345,9 +345,7 @@ el: reported_by: Αναφέρθηκε από resolved: Επιλύθηκε resolved_msg: Η καταγγελία επιλύθηκε επιτυχώς! - silence_account: Αποσιώπηση λογαριασμού status: Κατάσταση - suspend_account: Ανέστειλε λογαριασμό title: Αναφορές unassign: Αποσύνδεση unresolved: Άλυτη diff --git a/config/locales/en.yml b/config/locales/en.yml index 26fe0080d..0360e719e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -128,7 +128,7 @@ en: most_recent: Most recent title: Order outbox_url: Outbox URL - perform_full_suspension: Perform full suspension + perform_full_suspension: Suspend profile_url: Profile URL promote: Promote protocol: Protocol @@ -346,9 +346,7 @@ en: reported_by: Reported by resolved: Resolved resolved_msg: Report successfully resolved! - silence_account: Silence account status: Status - suspend_account: Suspend account title: Reports unassign: Unassign unresolved: Unresolved diff --git a/config/locales/eo.yml b/config/locales/eo.yml index 454eeae9d..72628a944 100644 --- a/config/locales/eo.yml +++ b/config/locales/eo.yml @@ -325,9 +325,7 @@ eo: reported_by: Signalita de resolved: Solvita resolved_msg: Signalo sukcese solvita! - silence_account: Kaŝi konton status: Mesaĝoj - suspend_account: Haltigi konton title: Signaloj unassign: Malasigni unresolved: Nesolvita diff --git a/config/locales/es.yml b/config/locales/es.yml index 5adfafeca..ccb7439ae 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -336,9 +336,7 @@ es: reported_by: Reportado por resolved: Resuelto resolved_msg: "¡La denuncia se ha resuelto correctamente!" - silence_account: Silenciar cuenta status: Estado - suspend_account: Suspender cuenta title: Reportes unassign: Desasignar unresolved: No resuelto diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 1a6558d9f..f0ddb6adb 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -336,9 +336,7 @@ eu: reported_by: Salatzailea resolved: Konponduta resolved_msg: Salaketa ongi konpondu da! - silence_account: Isilarazi kontua status: Mezua - suspend_account: Kanporatu kontua title: Salaketak unassign: Kendu esleipena unresolved: Konpondu gabea diff --git a/config/locales/fa.yml b/config/locales/fa.yml index d620dcf4b..a9cf5868f 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -336,9 +336,7 @@ fa: reported_by: گزارش از طرف resolved: حل‌شده resolved_msg: گزارش با موفقیت حل شد! - silence_account: بی‌صدا کردن حساب status: نوشته - suspend_account: معلق‌کردن حساب title: گزارش‌ها unassign: پس‌گرفتن مسئولیت unresolved: حل‌نشده diff --git a/config/locales/fi.yml b/config/locales/fi.yml index c4d1dd871..e62931129 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -282,9 +282,7 @@ fi: reported_by: Raportoija resolved: Ratkaistut resolved_msg: Raportti onnistuneesti ratkaistu! - silence_account: Hiljennä tili status: Tila - suspend_account: Siirrä tili jäähylle title: Raportit unresolved: Ratkaisemattomat updated_at: Päivitetty diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 51a308553..f0eaf8d3f 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -345,9 +345,7 @@ fr: reported_by: Signalé par resolved: Résolus resolved_msg: Signalement résolu avec succès ! - silence_account: Masquer le compte status: Statut - suspend_account: Suspendre le compte title: Signalements unassign: Dés-assigner unresolved: Non résolus diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 49cc94f30..090796413 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -345,9 +345,7 @@ gl: reported_by: Reportada por resolved: Resolto resolved_msg: Resolveuse con éxito o informe! - silence_account: Acalar conta status: Estado - suspend_account: Suspender conta title: Informes unassign: Non asignar unresolved: Non resolto diff --git a/config/locales/he.yml b/config/locales/he.yml index 3d24f22d2..09d57da3b 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -189,9 +189,7 @@ he: reported_account: חשבון מדווח reported_by: דווח על ידי resolved: פתור - silence_account: השתקת חשבון status: הודעה - suspend_account: השעיית חשבון title: דיווחים unresolved: לא פתור settings: diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 0c4046785..92d11f0d8 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -249,9 +249,7 @@ hu: reported_account: Bejelentett fiók reported_by: 'Jelentette:' resolved: Megoldott - silence_account: Felhasználó némítása status: Állapot - suspend_account: Felhasználó felfüggesztése title: Jelentések unresolved: Megoldatlan settings: diff --git a/config/locales/id.yml b/config/locales/id.yml index b186b7652..3da3583f6 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -114,9 +114,7 @@ id: reported_account: Akun yang dilaporkan reported_by: Dilaporkan oleh resolved: Terseleseikan - silence_account: Akun yang didiamkan status: Status - suspend_account: Akun yang disuspen title: Laporan unresolved: Belum Terseleseikan settings: diff --git a/config/locales/io.yml b/config/locales/io.yml index be8a87acd..b739df3af 100644 --- a/config/locales/io.yml +++ b/config/locales/io.yml @@ -107,9 +107,7 @@ io: reported_account: Reported account reported_by: Reported by resolved: Resolved - silence_account: Silence account status: Status - suspend_account: Suspend account title: Reports unresolved: Unresolved settings: diff --git a/config/locales/it.yml b/config/locales/it.yml index 5182e3372..6a831ab2c 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -324,9 +324,7 @@ it: report: 'Rapporto #%{id}' reported_by: Inviato da resolved: Risolto - silence_account: Silenzia account status: Stato - suspend_account: Sospendi account title: Rapporti unassign: Non assegnare unresolved: Non risolto diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 84426f84e..ea1d665da 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -346,9 +346,7 @@ ja: reported_by: 報告者 resolved: 解決済み resolved_msg: レポートを解決済みにしました! - silence_account: アカウントをサイレンス status: ステータス - suspend_account: アカウントを停止 title: レポート unassign: 担当を外す unresolved: 未解決 diff --git a/config/locales/ka.yml b/config/locales/ka.yml index f782db09b..5ac254df4 100644 --- a/config/locales/ka.yml +++ b/config/locales/ka.yml @@ -325,9 +325,7 @@ ka: reported_by: დაარეპორტა resolved: გადაწყვეტილი resolved_msg: რეპორტი წარმატებით გადაწყდა! - silence_account: ანგარიშის გაჩუმება status: სტატუსი - suspend_account: ანგარიშის შეჩერება title: რეპორტები unassign: გადაყენება unresolved: გადაუწყვეტელი diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 6f281a302..9f9875a16 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -338,9 +338,7 @@ ko: reported_by: 신고자 resolved: 해결됨 resolved_msg: 리포트가 성공적으로 해결되었습니다! - silence_account: 계정을 침묵 처리 status: 상태 - suspend_account: 계정을 정지 title: 신고 unassign: 할당 해제 unresolved: 미해결 diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 7e206d938..997df0164 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -336,9 +336,7 @@ nl: reported_by: Gerapporteerd door resolved: Opgelost resolved_msg: Rapportage succesvol opgelost! - silence_account: Account negeren status: Toot - suspend_account: Account opschorten title: Rapportages unassign: Niet langer toewijzen unresolved: Onopgelost diff --git a/config/locales/no.yml b/config/locales/no.yml index bbfa9b5da..61466fa20 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -249,9 +249,7 @@ reported_account: Rapportert konto reported_by: Rapportert av resolved: Løst - silence_account: Målbind konto status: Status - suspend_account: Utvis konto title: Rapporter unresolved: Uløst settings: diff --git a/config/locales/oc.yml b/config/locales/oc.yml index af11d18e4..01063ab57 100644 --- a/config/locales/oc.yml +++ b/config/locales/oc.yml @@ -144,7 +144,6 @@ oc: role: Permissions roles: admin: Administrator - bot: Robòt moderator: Moderador staff: Personnal user: Uitlizaire @@ -337,9 +336,7 @@ oc: reported_by: Senhalat per resolved: Resolgut resolved_msg: Rapòrt corrèctament resolgut  ! - silence_account: Metre lo compte en silenci status: Estatut - suspend_account: Suspendre lo compte title: Senhalament unassign: Levar unresolved: Pas resolgut diff --git a/config/locales/pl.yml b/config/locales/pl.yml index dfebe25bd..4921055e3 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -354,9 +354,7 @@ pl: reported_by: Zgłaszający resolved: Rozwiązane resolved_msg: Pomyślnie rozwiązano zgłoszenie. - silence_account: Wycisz konto status: Stan - suspend_account: Zawieś konto title: Zgłoszenia unassign: Cofnij przypisanie unresolved: Nierozwiązane diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 3e56f0731..1ec00f85f 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -334,9 +334,7 @@ pt-BR: reported_by: Denunciada por resolved: Resolvido resolved_msg: Denúncia resolvida com sucesso! - silence_account: Silenciar conta status: Status - suspend_account: Suspender conta title: Denúncias unassign: Desatribuir unresolved: Não resolvido diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 2bada74fe..5f532ea37 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -249,9 +249,7 @@ pt: reported_account: Conta denunciada reported_by: Denúnciada por resolved: Resolvido - silence_account: Conta silenciada status: Estado - suspend_account: Conta suspensa title: Denúncias unresolved: Por resolver settings: diff --git a/config/locales/ru.yml b/config/locales/ru.yml index e8bbb94ca..2eef00170 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -345,9 +345,7 @@ ru: reported_by: Отправитель жалобы resolved: Разрешено resolved_msg: Жалоба успешно обработана! - silence_account: Заглушить аккаунт status: Статус - suspend_account: Блокировать аккаунт title: Жалобы unassign: Снять назначение unresolved: Неразрешенные diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 3e337fa42..2bdd3afa6 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -337,9 +337,7 @@ sk: reported_by: Nahlásené užívateľom resolved: Vyriešené resolved_msg: Hlásenie úspešne vyriešené! - silence_account: Zamĺčať účet status: Stav - suspend_account: Pozastaviť účet title: Reporty unassign: Odobrať unresolved: Nevyriešené diff --git a/config/locales/sr-Latn.yml b/config/locales/sr-Latn.yml index d6800a8fb..ff31203c8 100644 --- a/config/locales/sr-Latn.yml +++ b/config/locales/sr-Latn.yml @@ -251,9 +251,7 @@ sr-Latn: reported_account: Prijavljeni nalog reported_by: Prijavio resolved: Rešeni - silence_account: Ućutkaj nalog status: Status - suspend_account: Suspenduj nalog title: Prijave unresolved: Nerešeni settings: diff --git a/config/locales/sr.yml b/config/locales/sr.yml index 53981b0f0..36d81886e 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -338,9 +338,7 @@ sr: reported_by: Пријавио resolved: Решена resolved_msg: Пријава успешно разрешена! - silence_account: Ућуткај налог status: Статус - suspend_account: Суспендуј налог title: Пријаве unassign: Уклони доделу unresolved: Нерешене diff --git a/config/locales/sv.yml b/config/locales/sv.yml index b7229aebe..4f80a46f1 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -285,9 +285,7 @@ sv: reported_by: Anmäld av resolved: Löst resolved_msg: Anmälan har lösts framgångsrikt! - silence_account: Tysta ner konto status: Status - suspend_account: Suspendera konto title: Anmälningar unassign: Otilldela unresolved: Olösta diff --git a/config/locales/th.yml b/config/locales/th.yml index 8c411f252..3ed73c7f5 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -116,9 +116,7 @@ th: reported_account: รายงานแอคเคาท์ reported_by: รายงานโดย resolved: จัดการแล้ว - silence_account: แอคเค๊าท์ที่ปิดเสียง status: สถานะ - suspend_account: แอคเค๊าท์ที่หยุดไว้ title: รายงาน unresolved: Unresolved settings: diff --git a/config/locales/tr.yml b/config/locales/tr.yml index d7ecb480f..99ba89397 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -115,9 +115,7 @@ tr: reported_account: Şikayet edilen hesap reported_by: Şikayet eden resolved: Giderildi - silence_account: Hesabı sustur status: Durum - suspend_account: Hesabı uzaklaştır title: Şikayetler unresolved: Giderilmedi settings: diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 22d5e98df..83a315a37 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -313,9 +313,7 @@ uk: reported_by: Відправник скарги resolved: Вирішено resolved_msg: Скаргу успішно вирішено! - silence_account: Заглушити акаунт status: Статус - suspend_account: Заблокувати акаунт title: Скарги unassign: Зняти призначення unresolved: Невирішені diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 9a1b47fdb..0ce1a0ed7 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -332,9 +332,7 @@ zh-CN: reported_by: 举报人 resolved: 已处理 resolved_msg: 举报处理成功! - silence_account: 隐藏用户 status: 状态 - suspend_account: 封禁用户 title: 举报 unassign: 取消接管 unresolved: 未处理 diff --git a/config/locales/zh-HK.yml b/config/locales/zh-HK.yml index abbb1b809..db7c0c47c 100644 --- a/config/locales/zh-HK.yml +++ b/config/locales/zh-HK.yml @@ -285,9 +285,7 @@ zh-HK: reported_by: 舉報者 resolved: 已處理 resolved_msg: 舉報已處理。 - silence_account: 將用戶靜音 status: 狀態 - suspend_account: 將用戶停權 title: 舉報 unassign: 取消指派 unresolved: 未處理 diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 338c40d09..d1b7633f3 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -295,9 +295,7 @@ zh-TW: reported_by: 檢舉人 resolved: 已解決 resolved_msg: 檢舉已處理! - silence_account: 靜音使用者 status: 狀態 - suspend_account: 停權使用者 title: 檢舉 unassign: 取消指派 unresolved: 未解決 -- cgit From fd5285658f477c5b6a9c7af0935b5c889729b2e0 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 20 Oct 2018 08:02:44 +0200 Subject: Add option to block reports from domain (#8830) --- app/controllers/admin/domain_blocks_controller.rb | 2 +- app/javascript/packs/admin.js | 21 ++++++++------------- app/lib/activitypub/activity/flag.rb | 8 ++++++++ app/models/domain_block.rb | 13 +++++++------ .../admin/domain_blocks/_domain_block.html.haml | 5 ++++- app/views/admin/domain_blocks/index.html.haml | 1 + app/views/admin/domain_blocks/new.html.haml | 3 +++ .../_email_domain_block.html.haml | 2 +- app/views/admin/instances/_instance.html.haml | 2 +- config/locales/en.yml | 2 ++ ...017170937_add_reject_reports_to_domain_blocks.rb | 17 +++++++++++++++++ db/schema.rb | 1 + 12 files changed, 54 insertions(+), 23 deletions(-) create mode 100644 db/migrate/20181017170937_add_reject_reports_to_domain_blocks.rb (limited to 'app/views') diff --git a/app/controllers/admin/domain_blocks_controller.rb b/app/controllers/admin/domain_blocks_controller.rb index 64de2cbf0..90c70275a 100644 --- a/app/controllers/admin/domain_blocks_controller.rb +++ b/app/controllers/admin/domain_blocks_controller.rb @@ -46,7 +46,7 @@ module Admin end def resource_params - params.require(:domain_block).permit(:domain, :severity, :reject_media, :retroactive) + params.require(:domain_block).permit(:domain, :severity, :reject_media, :reject_reports, :retroactive) end def retroactive_unblock? diff --git a/app/javascript/packs/admin.js b/app/javascript/packs/admin.js index ce5f70ee7..f0c0ee0b7 100644 --- a/app/javascript/packs/admin.js +++ b/app/javascript/packs/admin.js @@ -1,17 +1,5 @@ import { delegate } from 'rails-ujs'; -function handleDeleteStatus(event) { - const [data] = event.detail; - const element = document.querySelector(`[data-id="${data.id}"]`); - if (element) { - element.parentNode.removeChild(element); - } -} - -[].forEach.call(document.querySelectorAll('.trash-button'), (content) => { - content.addEventListener('ajax:success', handleDeleteStatus); -}); - const batchCheckboxClassName = '.batch-checkbox input[type="checkbox"]'; delegate(document, '#batch_checkbox_all', 'change', ({ target }) => { @@ -22,6 +10,7 @@ delegate(document, '#batch_checkbox_all', 'change', ({ target }) => { delegate(document, batchCheckboxClassName, 'change', () => { const checkAllElement = document.querySelector('#batch_checkbox_all'); + if (checkAllElement) { checkAllElement.checked = [].every.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked); checkAllElement.indeterminate = !checkAllElement.checked && [].some.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked); @@ -41,8 +30,14 @@ delegate(document, '.media-spoiler-hide-button', 'click', () => { }); delegate(document, '#domain_block_severity', 'change', ({ target }) => { - const rejectMediaDiv = document.querySelector('.input.with_label.domain_block_reject_media'); + const rejectMediaDiv = document.querySelector('.input.with_label.domain_block_reject_media'); + const rejectReportsDiv = document.querySelector('.input.with_label.domain_block_reject_reports'); + if (rejectMediaDiv) { rejectMediaDiv.style.display = (target.value === 'suspend') ? 'none' : 'block'; } + + if (rejectReportsDiv) { + rejectReportsDiv.style.display = (target.value === 'suspend') ? 'none' : 'block'; + } }); diff --git a/app/lib/activitypub/activity/flag.rb b/app/lib/activitypub/activity/flag.rb index 36d3c5730..92e59bb81 100644 --- a/app/lib/activitypub/activity/flag.rb +++ b/app/lib/activitypub/activity/flag.rb @@ -2,6 +2,8 @@ class ActivityPub::Activity::Flag < ActivityPub::Activity def perform + return if skip_reports? + target_accounts = object_uris.map { |uri| account_from_uri(uri) }.compact.select(&:local?) target_statuses_by_account = object_uris.map { |uri| status_from_uri(uri) }.compact.select(&:local?).group_by(&:account_id) @@ -19,6 +21,12 @@ class ActivityPub::Activity::Flag < ActivityPub::Activity end end + private + + def skip_reports? + DomainBlock.find_by(domain: @account.domain)&.reject_reports? + end + def object_uris @object_uris ||= Array(@object.is_a?(Array) ? @object.map { |item| value_or_id(item) } : value_or_id(@object)) end diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb index 93658793b..b828a9d71 100644 --- a/app/models/domain_block.rb +++ b/app/models/domain_block.rb @@ -3,12 +3,13 @@ # # Table name: domain_blocks # -# id :bigint(8) not null, primary key -# domain :string default(""), not null -# created_at :datetime not null -# updated_at :datetime not null -# severity :integer default("silence") -# reject_media :boolean default(FALSE), not null +# id :bigint(8) not null, primary key +# domain :string default(""), not null +# created_at :datetime not null +# updated_at :datetime not null +# severity :integer default("silence") +# reject_media :boolean default(FALSE), not null +# reject_reports :boolean default(FALSE), not null # class DomainBlock < ApplicationRecord diff --git a/app/views/admin/domain_blocks/_domain_block.html.haml b/app/views/admin/domain_blocks/_domain_block.html.haml index 17a3de81c..7bfea3574 100644 --- a/app/views/admin/domain_blocks/_domain_block.html.haml +++ b/app/views/admin/domain_blocks/_domain_block.html.haml @@ -1,10 +1,13 @@ %tr - %td.domain + %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 index 42b8ca53f..4c5221c42 100644 --- a/app/views/admin/domain_blocks/index.html.haml +++ b/app/views/admin/domain_blocks/index.html.haml @@ -8,6 +8,7 @@ %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 diff --git a/app/views/admin/domain_blocks/new.html.haml b/app/views/admin/domain_blocks/new.html.haml index f0eb217eb..055d2fbd7 100644 --- a/app/views/admin/domain_blocks/new.html.haml +++ b/app/views/admin/domain_blocks/new.html.haml @@ -17,5 +17,8 @@ .fields-group = f.input :reject_media, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_media'), hint: I18n.t('admin.domain_blocks.reject_media_hint') + .fields-group + = f.input :reject_reports, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_reports'), hint: I18n.t('admin.domain_blocks.reject_reports_hint') + .actions = f.button :button, t('.create'), type: :submit diff --git a/app/views/admin/email_domain_blocks/_email_domain_block.html.haml b/app/views/admin/email_domain_blocks/_email_domain_block.html.haml index 61cff9395..bf66c9001 100644 --- a/app/views/admin/email_domain_blocks/_email_domain_block.html.haml +++ b/app/views/admin/email_domain_blocks/_email_domain_block.html.haml @@ -1,5 +1,5 @@ %tr - %td.domain + %td %samp= email_domain_block.domain %td = table_link_to 'trash', t('admin.email_domain_blocks.delete'), admin_email_domain_block_path(email_domain_block), method: :delete diff --git a/app/views/admin/instances/_instance.html.haml b/app/views/admin/instances/_instance.html.haml index 6efbbbe60..e36ebae47 100644 --- a/app/views/admin/instances/_instance.html.haml +++ b/app/views/admin/instances/_instance.html.haml @@ -1,5 +1,5 @@ %tr - %td.domain + %td = link_to instance.domain, admin_accounts_path(by_domain: instance.domain) %td.count = instance.accounts_count diff --git a/config/locales/en.yml b/config/locales/en.yml index 0360e719e..a2859aa5d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -263,6 +263,8 @@ en: title: New domain block reject_media: Reject media files reject_media_hint: Removes locally stored media files and refuses to download any in the future. Irrelevant for suspensions + reject_reports: Reject reports + reject_reports_hint: Ignore all reports coming from this domain. Irrelevant for suspensions severities: noop: None silence: Silence diff --git a/db/migrate/20181017170937_add_reject_reports_to_domain_blocks.rb b/db/migrate/20181017170937_add_reject_reports_to_domain_blocks.rb new file mode 100644 index 000000000..f05d50fcd --- /dev/null +++ b/db/migrate/20181017170937_add_reject_reports_to_domain_blocks.rb @@ -0,0 +1,17 @@ +require Rails.root.join('lib', 'mastodon', 'migration_helpers') + +class AddRejectReportsToDomainBlocks < ActiveRecord::Migration[5.2] + include Mastodon::MigrationHelpers + + disable_ddl_transaction! + + def up + safety_assured do + add_column_with_default :domain_blocks, :reject_reports, :boolean, default: false, allow_null: false + end + end + + def down + remove_column :domain_blocks, :reject_reports + end +end diff --git a/db/schema.rb b/db/schema.rb index 046975ac9..8facfa259 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -186,6 +186,7 @@ ActiveRecord::Schema.define(version: 2018_10_18_205649) do t.datetime "updated_at", null: false t.integer "severity", default: 0 t.boolean "reject_media", default: false, null: false + t.boolean "reject_reports", default: false, null: false t.index ["domain"], name: "index_domain_blocks_on_domain", unique: true end -- cgit From 84cf78da8ad80d8a4128451d8d96ae74acbac318 Mon Sep 17 00:00:00 2001 From: ThibG Date: Sun, 21 Oct 2018 22:52:10 +0200 Subject: Fix og:url on toots' public view (#9047) Fixes #9045 --- app/views/stream_entries/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views') diff --git a/app/views/stream_entries/show.html.haml b/app/views/stream_entries/show.html.haml index 2edc155bf..0e81c4f68 100644 --- a/app/views/stream_entries/show.html.haml +++ b/app/views/stream_entries/show.html.haml @@ -12,7 +12,7 @@ = opengraph 'og:site_name', site_title = opengraph 'og:type', 'article' = opengraph 'og:title', "#{display_name(@account)} (@#{@account.local_username_and_domain})" - = opengraph 'og:url', short_account_status_url(@account, @stream_entry) + = opengraph 'og:url', short_account_status_url(@account, @stream_entry.activity) = render 'stream_entries/og_description', activity: @stream_entry.activity = render 'stream_entries/og_image', activity: @stream_entry.activity, account: @account -- cgit