forked from treehouse/mastodon
Remove "nsfw" category for sensitive statuses in OStatus serializer (#7048)
Fix #7011signup-info-prompt
parent
4ca2f73b12
commit
75c4ab9d12
|
@ -364,8 +364,6 @@ class OStatus::AtomSerializer
|
||||||
append_element(entry, 'category', nil, term: tag.name)
|
append_element(entry, 'category', nil, term: tag.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
append_element(entry, 'category', nil, term: 'nsfw') if status.sensitive?
|
|
||||||
|
|
||||||
status.media_attachments.each do |media|
|
status.media_attachments.each do |media|
|
||||||
append_element(entry, 'link', nil, rel: :enclosure, type: media.file_content_type, length: media.file_file_size, href: full_asset_url(media.file.url(:original, false)))
|
append_element(entry, 'link', nil, rel: :enclosure, type: media.file_content_type, length: media.file_file_size, href: full_asset_url(media.file.url(:original, false)))
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,5 @@ class ProcessHashtagsService < BaseService
|
||||||
tags.map { |str| str.mb_chars.downcase }.uniq(&:to_s).each do |tag|
|
tags.map { |str| str.mb_chars.downcase }.uniq(&:to_s).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
|
||||||
|
|
|
@ -386,12 +386,6 @@ RSpec.describe OStatus::AtomSerializer do
|
||||||
expect(entry.category[:term]).to eq 'tag'
|
expect(entry.category[:term]).to eq 'tag'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'appends category element for NSFW if status is sensitive' do
|
|
||||||
status = Fabricate(:status, sensitive: true)
|
|
||||||
entry = OStatus::AtomSerializer.new.entry(status.stream_entry)
|
|
||||||
expect(entry.category[:term]).to eq 'nsfw'
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'appends link elements for media attachments' do
|
it 'appends link elements for media attachments' do
|
||||||
file = attachment_fixture('attachment.jpg')
|
file = attachment_fixture('attachment.jpg')
|
||||||
media_attachment = Fabricate(:media_attachment, file: file)
|
media_attachment = Fabricate(:media_attachment, file: file)
|
||||||
|
|
Loading…
Reference in New Issue