Sensitive content federates using the "nsfw" hashtag

This commit is contained in:
Eugen Rochko 2016-12-11 22:49:25 +01:00
parent f90133d2ad
commit e90fcb46e3
3 changed files with 18 additions and 5 deletions

View File

@ -10,7 +10,8 @@ const messages = defineMessages({
block: { id: 'account.block', defaultMessage: 'Block' }, block: { id: 'account.block', defaultMessage: 'Block' },
reply: { id: 'status.reply', defaultMessage: 'Reply' }, reply: { id: 'status.reply', defaultMessage: 'Reply' },
reblog: { id: 'status.reblog', defaultMessage: 'Reblog' }, reblog: { id: 'status.reblog', defaultMessage: 'Reblog' },
favourite: { id: 'status.favourite', defaultMessage: 'Favourite' } favourite: { id: 'status.favourite', defaultMessage: 'Favourite' },
open: { id: 'status.open', defaultMessage: 'Expand' }
}); });
const StatusActionBar = React.createClass({ const StatusActionBar = React.createClass({
@ -55,10 +56,16 @@ const StatusActionBar = React.createClass({
this.props.onBlock(this.props.status.get('account')); this.props.onBlock(this.props.status.get('account'));
}, },
handleOpen () {
this.context.router.push(`/statuses/${this.props.status.get('id')}`);
},
render () { render () {
const { status, me, intl } = this.props; const { status, me, intl } = this.props;
let menu = []; let menu = [];
menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen });
if (status.getIn(['account', 'id']) === me) { if (status.getIn(['account', 'id']) === me) {
menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick }); menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick });
} else { } else {

View File

@ -53,8 +53,8 @@ module AtomBuilderHelper
xml.author(&block) xml.author(&block)
end end
def category(xml, tag) def category(xml, term)
xml.category(term: tag.name) xml.category(term: term)
end end
def target(xml, &block) def target(xml, &block)
@ -203,8 +203,10 @@ module AtomBuilderHelper
end end
stream_entry.target.tags.each do |tag| stream_entry.target.tags.each do |tag|
category xml, tag category xml, tag.name
end end
category(xml, 'nsfw') if stream_entry.target.sensitive?
end end
end end
end end
@ -222,8 +224,10 @@ module AtomBuilderHelper
end end
stream_entry.activity.tags.each do |tag| stream_entry.activity.tags.each do |tag|
category xml, tag category xml, tag.name
end end
category(xml, 'nsfw') if stream_entry.activity.sensitive?
end end
private private

View File

@ -7,5 +7,7 @@ class ProcessHashtagsService < BaseService
tags.map { |str| str.mb_chars.downcase }.uniq.each do |tag| tags.map { |str| str.mb_chars.downcase }.uniq.each do |tag|
status.tags << Tag.where(name: tag).first_or_initialize(name: tag) status.tags << Tag.where(name: tag).first_or_initialize(name: tag)
end end
status.update(sensitive: true) if tags.include?('nsfw')
end end
end end