Fix `Chewy::UndefinedUpdateStrategy` in `dev:populate_sample_data` task when Elasticsearch is enabled (#35615)

pull/35616/head
Claire 3 months ago committed by GitHub
parent 2dfdcc7dcb
commit f7388af721
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -3,420 +3,422 @@
namespace :dev do namespace :dev do
desc 'Populate database with test data. Can be run multiple times. Should not be run in production environments' desc 'Populate database with test data. Can be run multiple times. Should not be run in production environments'
task populate_sample_data: :environment do task populate_sample_data: :environment do
# Create a valid account to showcase multiple post types Chewy.strategy(:mastodon) do
showcase_account = Account.create_with(username: 'showcase_account').find_or_create_by!(id: 10_000_000) # Create a valid account to showcase multiple post types
showcase_user = User.create_with( showcase_account = Account.create_with(username: 'showcase_account').find_or_create_by!(id: 10_000_000)
account_id: showcase_account.id, showcase_user = User.create_with(
agreement: true, account_id: showcase_account.id,
password: SecureRandom.hex, agreement: true,
email: ENV.fetch('TEST_DATA_SHOWCASE_EMAIL', 'showcase_account@joinmastodon.org'), password: SecureRandom.hex,
confirmed_at: Time.now.utc, email: ENV.fetch('TEST_DATA_SHOWCASE_EMAIL', 'showcase_account@joinmastodon.org'),
approved: true, confirmed_at: Time.now.utc,
bypass_registration_checks: true approved: true,
).find_or_create_by!(id: 10_000_000) bypass_registration_checks: true
showcase_user.mark_email_as_confirmed! ).find_or_create_by!(id: 10_000_000)
showcase_user.approve! showcase_user.mark_email_as_confirmed!
showcase_user.approve!
french_post = Status.create_with( french_post = Status.create_with(
text: 'Ceci est un sondage public écrit en Français', text: 'Ceci est un sondage public écrit en Français',
language: 'fr', language: 'fr',
account: showcase_account,
visibility: :public,
poll_attributes: {
voters_count: 0,
account: showcase_account, account: showcase_account,
expires_at: 1.day.from_now, visibility: :public,
options: ['ceci est un choix', 'ceci est un autre choix'], poll_attributes: {
multiple: false, voters_count: 0,
} account: showcase_account,
).find_or_create_by!(id: 10_000_000) expires_at: 1.day.from_now,
options: ['ceci est un choix', 'ceci est un autre choix'],
multiple: false,
}
).find_or_create_by!(id: 10_000_000)
private_mentionless = Status.create_with( private_mentionless = Status.create_with(
text: 'This is a private message written in English', text: 'This is a private message written in English',
language: 'en', language: 'en',
account: showcase_account,
visibility: :private
).find_or_create_by!(id: 10_000_001)
public_self_reply_with_cw = Status.create_with(
text: 'This is a public self-reply written in English; it has a CW and a multi-choice poll',
spoiler_text: 'poll (CW example)',
language: 'en',
account: showcase_account,
visibility: :public,
thread: french_post,
poll_attributes: {
voters_count: 0,
account: showcase_account, account: showcase_account,
expires_at: 1.day.from_now, visibility: :private
options: ['this is a choice', 'this is another choice', 'you can chose any number of them'], ).find_or_create_by!(id: 10_000_001)
multiple: true,
}
).find_or_create_by!(id: 10_000_002)
ProcessHashtagsService.new.call(public_self_reply_with_cw)
unlisted_self_reply_with_cw_tag_mention = Status.create_with(
text: 'This is an unlisted (Quiet Public) self-reply written in #English; it has a CW, mentions @showcase_account, and uses an emoji 🦣',
spoiler_text: 'CW example',
language: 'en',
account: showcase_account,
visibility: :unlisted,
thread: public_self_reply_with_cw
).find_or_create_by!(id: 10_000_003)
Mention.find_or_create_by!(status: unlisted_self_reply_with_cw_tag_mention, account: showcase_account)
ProcessHashtagsService.new.call(unlisted_self_reply_with_cw_tag_mention)
media_attachment = MediaAttachment.create_with(
account: showcase_account,
file: File.open('spec/fixtures/files/600x400.png'),
description: 'Mastodon logo'
).find_or_create_by!(id: 10_000_000)
status_with_media = Status.create_with(
text: "This is a public status with a picture and tags. The attached picture has an alt text\n\n#Mastodon #Logo #English #Test",
ordered_media_attachment_ids: [media_attachment.id],
account: showcase_account,
visibility: :public
).find_or_create_by!(id: 10_000_004)
media_attachment.update(status_id: status_with_media.id)
ProcessHashtagsService.new.call(status_with_media)
media_attachment = MediaAttachment.create_with( public_self_reply_with_cw = Status.create_with(
account: showcase_account, text: 'This is a public self-reply written in English; it has a CW and a multi-choice poll',
file: File.open('spec/fixtures/files/600x400.png'), spoiler_text: 'poll (CW example)',
description: 'Mastodon logo' language: 'en',
).find_or_create_by!(id: 10_000_001) account: showcase_account,
status_with_sensitive_media = Status.create_with( visibility: :public,
text: "This is the same public status with a picture and tags, but it is marked as sensitive. The attached picture has an alt text\n\n#Mastodon #Logo #English #Test", thread: french_post,
ordered_media_attachment_ids: [media_attachment.id], poll_attributes: {
account: showcase_account, voters_count: 0,
visibility: :public, account: showcase_account,
sensitive: true, expires_at: 1.day.from_now,
thread: status_with_media options: ['this is a choice', 'this is another choice', 'you can chose any number of them'],
).find_or_create_by!(id: 10_000_005) multiple: true,
media_attachment.update(status_id: status_with_sensitive_media.id) }
ProcessHashtagsService.new.call(status_with_sensitive_media) ).find_or_create_by!(id: 10_000_002)
ProcessHashtagsService.new.call(public_self_reply_with_cw)
media_attachment = MediaAttachment.create_with(
account: showcase_account,
file: File.open('spec/fixtures/files/600x400.png'),
description: 'Mastodon logo'
).find_or_create_by!(id: 10_000_002)
status_with_cw_media = Status.create_with(
text: "This is the same public status with a picture and tags, but it is behind a CW. The attached picture has an alt text\n\n#Mastodon #Logo #English #Test",
spoiler_text: 'Mastodon logo',
ordered_media_attachment_ids: [media_attachment.id],
account: showcase_account,
visibility: :public,
sensitive: true,
thread: status_with_sensitive_media
).find_or_create_by!(id: 10_000_006)
media_attachment.update(status_id: status_with_cw_media.id)
ProcessHashtagsService.new.call(status_with_cw_media)
media_attachment = MediaAttachment.create_with( unlisted_self_reply_with_cw_tag_mention = Status.create_with(
account: showcase_account, text: 'This is an unlisted (Quiet Public) self-reply written in #English; it has a CW, mentions @showcase_account, and uses an emoji 🦣',
file: File.open('spec/fixtures/files/boop.ogg'), spoiler_text: 'CW example',
description: 'Mastodon boop' language: 'en',
).find_or_create_by!(id: 10_000_003) account: showcase_account,
status_with_audio = Status.create_with( visibility: :unlisted,
text: "This is the same public status with an audio file and tags. The attached picture has an alt text\n\n#Mastodon #English #Test", thread: public_self_reply_with_cw
ordered_media_attachment_ids: [media_attachment.id], ).find_or_create_by!(id: 10_000_003)
account: showcase_account, Mention.find_or_create_by!(status: unlisted_self_reply_with_cw_tag_mention, account: showcase_account)
visibility: :public, ProcessHashtagsService.new.call(unlisted_self_reply_with_cw_tag_mention)
thread: status_with_cw_media
).find_or_create_by!(id: 10_000_007)
media_attachment.update(status_id: status_with_audio.id)
ProcessHashtagsService.new.call(status_with_audio)
media_attachment = MediaAttachment.create_with( media_attachment = MediaAttachment.create_with(
account: showcase_account, account: showcase_account,
file: File.open('spec/fixtures/files/boop.ogg'), file: File.open('spec/fixtures/files/600x400.png'),
description: 'Mastodon boop' description: 'Mastodon logo'
).find_or_create_by!(id: 10_000_004) ).find_or_create_by!(id: 10_000_000)
status_with_sensitive_audio = Status.create_with( status_with_media = Status.create_with(
text: "This is the same public status with an audio file and tags, but it is marked as sensitive. The attached picture has an alt text\n\n#Mastodon #English #Test", text: "This is a public status with a picture and tags. The attached picture has an alt text\n\n#Mastodon #Logo #English #Test",
ordered_media_attachment_ids: [media_attachment.id], ordered_media_attachment_ids: [media_attachment.id],
account: showcase_account, account: showcase_account,
visibility: :public, visibility: :public
sensitive: true, ).find_or_create_by!(id: 10_000_004)
thread: status_with_audio media_attachment.update(status_id: status_with_media.id)
).find_or_create_by!(id: 10_000_008) ProcessHashtagsService.new.call(status_with_media)
media_attachment.update(status_id: status_with_sensitive_audio.id)
ProcessHashtagsService.new.call(status_with_sensitive_audio)
media_attachment = MediaAttachment.create_with( media_attachment = MediaAttachment.create_with(
account: showcase_account, account: showcase_account,
file: File.open('spec/fixtures/files/boop.ogg'), file: File.open('spec/fixtures/files/600x400.png'),
description: 'Mastodon boop' description: 'Mastodon logo'
).find_or_create_by!(id: 10_000_005) ).find_or_create_by!(id: 10_000_001)
status_with_cw_audio = Status.create_with( status_with_sensitive_media = Status.create_with(
text: "This is the same public status with an audio file and tags, but it is behind a CW. The attached picture has an alt text\n\n#Mastodon #English #Test", text: "This is the same public status with a picture and tags, but it is marked as sensitive. The attached picture has an alt text\n\n#Mastodon #Logo #English #Test",
spoiler_text: 'Mastodon boop', ordered_media_attachment_ids: [media_attachment.id],
ordered_media_attachment_ids: [media_attachment.id], account: showcase_account,
account: showcase_account, visibility: :public,
visibility: :public, sensitive: true,
sensitive: true, thread: status_with_media
thread: status_with_sensitive_audio ).find_or_create_by!(id: 10_000_005)
).find_or_create_by!(id: 10_000_009) media_attachment.update(status_id: status_with_sensitive_media.id)
media_attachment.update(status_id: status_with_cw_audio.id) ProcessHashtagsService.new.call(status_with_sensitive_media)
ProcessHashtagsService.new.call(status_with_cw_audio)
media_attachments = [ media_attachment = MediaAttachment.create_with(
MediaAttachment.create_with(
account: showcase_account, account: showcase_account,
file: File.open('spec/fixtures/files/600x400.png'), file: File.open('spec/fixtures/files/600x400.png'),
description: 'Mastodon logo' description: 'Mastodon logo'
).find_or_create_by!(id: 10_000_006), ).find_or_create_by!(id: 10_000_002)
MediaAttachment.create_with( status_with_cw_media = Status.create_with(
text: "This is the same public status with a picture and tags, but it is behind a CW. The attached picture has an alt text\n\n#Mastodon #Logo #English #Test",
spoiler_text: 'Mastodon logo',
ordered_media_attachment_ids: [media_attachment.id],
account: showcase_account, account: showcase_account,
file: File.open('spec/fixtures/files/attachment.jpg') visibility: :public,
).find_or_create_by!(id: 10_000_007), sensitive: true,
MediaAttachment.create_with( thread: status_with_sensitive_media
).find_or_create_by!(id: 10_000_006)
media_attachment.update(status_id: status_with_cw_media.id)
ProcessHashtagsService.new.call(status_with_cw_media)
media_attachment = MediaAttachment.create_with(
account: showcase_account, account: showcase_account,
file: File.open('spec/fixtures/files/avatar-high.gif'), file: File.open('spec/fixtures/files/boop.ogg'),
description: 'Walking cartoon cat' description: 'Mastodon boop'
).find_or_create_by!(id: 10_000_008), ).find_or_create_by!(id: 10_000_003)
MediaAttachment.create_with( status_with_audio = Status.create_with(
text: "This is the same public status with an audio file and tags. The attached picture has an alt text\n\n#Mastodon #English #Test",
ordered_media_attachment_ids: [media_attachment.id],
account: showcase_account, account: showcase_account,
file: File.open('spec/fixtures/files/text.png'), visibility: :public,
description: 'Text saying “Hello Mastodon”' thread: status_with_cw_media
).find_or_create_by!(id: 10_000_009), ).find_or_create_by!(id: 10_000_007)
] media_attachment.update(status_id: status_with_audio.id)
status_with_multiple_attachments = Status.create_with( ProcessHashtagsService.new.call(status_with_audio)
text: "This is a post with multiple attachments, not all of which have a description\n\n#Mastodon #English #Test",
spoiler_text: 'multiple attachments',
ordered_media_attachment_ids: media_attachments.pluck(:id),
account: showcase_account,
visibility: :public,
sensitive: true,
thread: status_with_cw_audio
).find_or_create_by!(id: 10_000_010)
media_attachments.each { |attachment| attachment.update!(status_id: status_with_multiple_attachments.id) }
ProcessHashtagsService.new.call(status_with_multiple_attachments)
remote_account = Account.create_with( media_attachment = MediaAttachment.create_with(
username: 'fake.example', account: showcase_account,
domain: 'example.org', file: File.open('spec/fixtures/files/boop.ogg'),
uri: 'https://example.org/foo/bar', description: 'Mastodon boop'
url: 'https://example.org/foo/bar', ).find_or_create_by!(id: 10_000_004)
locked: true status_with_sensitive_audio = Status.create_with(
).find_or_create_by!(id: 10_000_001) text: "This is the same public status with an audio file and tags, but it is marked as sensitive. The attached picture has an alt text\n\n#Mastodon #English #Test",
ordered_media_attachment_ids: [media_attachment.id],
account: showcase_account,
visibility: :public,
sensitive: true,
thread: status_with_audio
).find_or_create_by!(id: 10_000_008)
media_attachment.update(status_id: status_with_sensitive_audio.id)
ProcessHashtagsService.new.call(status_with_sensitive_audio)
remote_formatted_post = Status.create_with( media_attachment = MediaAttachment.create_with(
text: <<~HTML, account: showcase_account,
<p>This is a post with a variety of HTML in it</p> file: File.open('spec/fixtures/files/boop.ogg'),
<p>For instance, <strong>this text is bold</strong> and <b>this one as well</b>, while <del>this text is stricken through</del> and <s>this one as well</s>.</p> description: 'Mastodon boop'
<blockquote> ).find_or_create_by!(id: 10_000_005)
<p>This thing, here, is a block quote<br/>with some <strong>bold</strong> as well</p> status_with_cw_audio = Status.create_with(
<ul> text: "This is the same public status with an audio file and tags, but it is behind a CW. The attached picture has an alt text\n\n#Mastodon #English #Test",
<li>a list item</li> spoiler_text: 'Mastodon boop',
<li> ordered_media_attachment_ids: [media_attachment.id],
and another with account: showcase_account,
<ul> visibility: :public,
<li>nested</li> sensitive: true,
<li>items!</li> thread: status_with_sensitive_audio
</ul> ).find_or_create_by!(id: 10_000_009)
</li> media_attachment.update(status_id: status_with_cw_audio.id)
</ul> ProcessHashtagsService.new.call(status_with_cw_audio)
</blockquote>
<pre><code>// And this is some code
// with two lines of comments
</code></pre>
<p>And this is <code>inline</code> code</p>
<p>Finally, please observe this Ruby element: <ruby> <rp>(</rp><rt>Ashita</rt><rp>)</rp> </ruby></p>
HTML
account: remote_account,
uri: 'https://example.org/foo/bar/baz',
url: 'https://example.org/foo/bar/baz'
).find_or_create_by!(id: 10_000_011)
Status.create_with(account: showcase_account, reblog: remote_formatted_post).find_or_create_by!(id: 10_000_012)
unattached_quote_post = Status.create_with( media_attachments = [
text: 'This is a quote of a post that does not exist', MediaAttachment.create_with(
account: showcase_account, account: showcase_account,
visibility: :public file: File.open('spec/fixtures/files/600x400.png'),
).find_or_create_by!(id: 10_000_013) description: 'Mastodon logo'
Quote.create_with( ).find_or_create_by!(id: 10_000_006),
status: unattached_quote_post, MediaAttachment.create_with(
quoted_status: nil account: showcase_account,
).find_or_create_by!(id: 10_000_000) file: File.open('spec/fixtures/files/attachment.jpg')
).find_or_create_by!(id: 10_000_007),
MediaAttachment.create_with(
account: showcase_account,
file: File.open('spec/fixtures/files/avatar-high.gif'),
description: 'Walking cartoon cat'
).find_or_create_by!(id: 10_000_008),
MediaAttachment.create_with(
account: showcase_account,
file: File.open('spec/fixtures/files/text.png'),
description: 'Text saying “Hello Mastodon”'
).find_or_create_by!(id: 10_000_009),
]
status_with_multiple_attachments = Status.create_with(
text: "This is a post with multiple attachments, not all of which have a description\n\n#Mastodon #English #Test",
spoiler_text: 'multiple attachments',
ordered_media_attachment_ids: media_attachments.pluck(:id),
account: showcase_account,
visibility: :public,
sensitive: true,
thread: status_with_cw_audio
).find_or_create_by!(id: 10_000_010)
media_attachments.each { |attachment| attachment.update!(status_id: status_with_multiple_attachments.id) }
ProcessHashtagsService.new.call(status_with_multiple_attachments)
self_quote = Status.create_with( remote_account = Account.create_with(
text: 'This is a quote of a public self-post', username: 'fake.example',
account: showcase_account, domain: 'example.org',
visibility: :public uri: 'https://example.org/foo/bar',
).find_or_create_by!(id: 10_000_014) url: 'https://example.org/foo/bar',
Quote.create_with( locked: true
status: self_quote, ).find_or_create_by!(id: 10_000_001)
quoted_status: status_with_media,
state: :accepted
).find_or_create_by!(id: 10_000_001)
nested_self_quote = Status.create_with( remote_formatted_post = Status.create_with(
text: 'This is a quote of a public self-post which itself is a self-quote', text: <<~HTML,
account: showcase_account, <p>This is a post with a variety of HTML in it</p>
visibility: :public <p>For instance, <strong>this text is bold</strong> and <b>this one as well</b>, while <del>this text is stricken through</del> and <s>this one as well</s>.</p>
).find_or_create_by!(id: 10_000_015) <blockquote>
Quote.create_with( <p>This thing, here, is a block quote<br/>with some <strong>bold</strong> as well</p>
status: nested_self_quote, <ul>
quoted_status: self_quote, <li>a list item</li>
state: :accepted <li>
).find_or_create_by!(id: 10_000_002) and another with
<ul>
<li>nested</li>
<li>items!</li>
</ul>
</li>
</ul>
</blockquote>
<pre><code>// And this is some code
// with two lines of comments
</code></pre>
<p>And this is <code>inline</code> code</p>
<p>Finally, please observe this Ruby element: <ruby> <rp>(</rp><rt>Ashita</rt><rp>)</rp> </ruby></p>
HTML
account: remote_account,
uri: 'https://example.org/foo/bar/baz',
url: 'https://example.org/foo/bar/baz'
).find_or_create_by!(id: 10_000_011)
Status.create_with(account: showcase_account, reblog: remote_formatted_post).find_or_create_by!(id: 10_000_012)
recursive_self_quote = Status.create_with( unattached_quote_post = Status.create_with(
text: 'This is a recursive self-quote; no real reason for it to exist, but just to make sure we handle them gracefuly', text: 'This is a quote of a post that does not exist',
account: showcase_account, account: showcase_account,
visibility: :public visibility: :public
).find_or_create_by!(id: 10_000_016) ).find_or_create_by!(id: 10_000_013)
Quote.create_with( Quote.create_with(
status: recursive_self_quote, status: unattached_quote_post,
quoted_status: recursive_self_quote, quoted_status: nil
state: :accepted ).find_or_create_by!(id: 10_000_000)
).find_or_create_by!(id: 10_000_003)
self_private_quote = Status.create_with( self_quote = Status.create_with(
text: 'This is a public post of a private self-post: the quoted post should not be visible to non-followers', text: 'This is a quote of a public self-post',
account: showcase_account, account: showcase_account,
visibility: :public visibility: :public
).find_or_create_by!(id: 10_000_017) ).find_or_create_by!(id: 10_000_014)
Quote.create_with( Quote.create_with(
status: self_private_quote, status: self_quote,
quoted_status: private_mentionless, quoted_status: status_with_media,
state: :accepted state: :accepted
).find_or_create_by!(id: 10_000_004) ).find_or_create_by!(id: 10_000_001)
uncwed_quote_cwed = Status.create_with( nested_self_quote = Status.create_with(
text: 'This is a quote without CW of a quoted post that has a CW', text: 'This is a quote of a public self-post which itself is a self-quote',
account: showcase_account, account: showcase_account,
visibility: :public visibility: :public
).find_or_create_by!(id: 10_000_018) ).find_or_create_by!(id: 10_000_015)
Quote.create_with( Quote.create_with(
status: uncwed_quote_cwed, status: nested_self_quote,
quoted_status: public_self_reply_with_cw, quoted_status: self_quote,
state: :accepted state: :accepted
).find_or_create_by!(id: 10_000_005) ).find_or_create_by!(id: 10_000_002)
cwed_quote_cwed = Status.create_with( recursive_self_quote = Status.create_with(
text: 'This is a quote with a CW of a quoted post that itself has a CW', text: 'This is a recursive self-quote; no real reason for it to exist, but just to make sure we handle them gracefuly',
spoiler_text: 'Quote post with a CW', account: showcase_account,
account: showcase_account, visibility: :public
visibility: :public ).find_or_create_by!(id: 10_000_016)
).find_or_create_by!(id: 10_000_019) Quote.create_with(
Quote.create_with( status: recursive_self_quote,
status: cwed_quote_cwed, quoted_status: recursive_self_quote,
quoted_status: public_self_reply_with_cw, state: :accepted
state: :accepted ).find_or_create_by!(id: 10_000_003)
).find_or_create_by!(id: 10_000_006)
pending_quote_post = Status.create_with( self_private_quote = Status.create_with(
text: 'This quote post is pending', text: 'This is a public post of a private self-post: the quoted post should not be visible to non-followers',
account: showcase_account, account: showcase_account,
visibility: :public visibility: :public
).find_or_create_by!(id: 10_000_020) ).find_or_create_by!(id: 10_000_017)
Quote.create_with( Quote.create_with(
status: pending_quote_post, status: self_private_quote,
quoted_status: remote_formatted_post, quoted_status: private_mentionless,
activity_uri: 'https://foo/bar', state: :accepted
state: :pending ).find_or_create_by!(id: 10_000_004)
).find_or_create_by!(id: 10_000_007)
rejected_quote_post = Status.create_with( uncwed_quote_cwed = Status.create_with(
text: 'This quote post is rejected', text: 'This is a quote without CW of a quoted post that has a CW',
account: showcase_account, account: showcase_account,
visibility: :public visibility: :public
).find_or_create_by!(id: 10_000_021) ).find_or_create_by!(id: 10_000_018)
Quote.create_with( Quote.create_with(
status: rejected_quote_post, status: uncwed_quote_cwed,
quoted_status: remote_formatted_post, quoted_status: public_self_reply_with_cw,
activity_uri: 'https://foo/foo', state: :accepted
state: :rejected ).find_or_create_by!(id: 10_000_005)
).find_or_create_by!(id: 10_000_008)
revoked_quote_post = Status.create_with( cwed_quote_cwed = Status.create_with(
text: 'This quote post is revoked', text: 'This is a quote with a CW of a quoted post that itself has a CW',
account: showcase_account, spoiler_text: 'Quote post with a CW',
visibility: :public account: showcase_account,
).find_or_create_by!(id: 10_000_022) visibility: :public
Quote.create_with( ).find_or_create_by!(id: 10_000_019)
status: revoked_quote_post, Quote.create_with(
quoted_status: remote_formatted_post, status: cwed_quote_cwed,
activity_uri: 'https://foo/baz', quoted_status: public_self_reply_with_cw,
state: :revoked state: :accepted
).find_or_create_by!(id: 10_000_009) ).find_or_create_by!(id: 10_000_006)
StatusPin.create_with(account: showcase_account, status: public_self_reply_with_cw).find_or_create_by!(id: 10_000_000) pending_quote_post = Status.create_with(
StatusPin.create_with(account: showcase_account, status: private_mentionless).find_or_create_by!(id: 10_000_001) text: 'This quote post is pending',
account: showcase_account,
visibility: :public
).find_or_create_by!(id: 10_000_020)
Quote.create_with(
status: pending_quote_post,
quoted_status: remote_formatted_post,
activity_uri: 'https://foo/bar',
state: :pending
).find_or_create_by!(id: 10_000_007)
showcase_account.update!( rejected_quote_post = Status.create_with(
display_name: 'Mastodon test/showcase account', text: 'This quote post is rejected',
note: 'Test account to showcase many Mastodon features. Most of its posts are public, but some are private!' account: showcase_account,
) visibility: :public
).find_or_create_by!(id: 10_000_021)
Quote.create_with(
status: rejected_quote_post,
quoted_status: remote_formatted_post,
activity_uri: 'https://foo/foo',
state: :rejected
).find_or_create_by!(id: 10_000_008)
remote_quote = Status.create_with( revoked_quote_post = Status.create_with(
text: <<~HTML, text: 'This quote post is revoked',
<p>This is a self-quote of a remote formatted post</p> account: showcase_account,
<p class="quote-inline">RE: <a href="https://example.org/foo/bar/baz">https://example.org/foo/bar/baz</a></p> visibility: :public
HTML ).find_or_create_by!(id: 10_000_022)
account: remote_account, Quote.create_with(
uri: 'https://example.org/foo/bar/quote', status: revoked_quote_post,
url: 'https://example.org/foo/bar/quote' quoted_status: remote_formatted_post,
).find_or_create_by!(id: 10_000_023) activity_uri: 'https://foo/baz',
Quote.create_with( state: :revoked
status: remote_quote, ).find_or_create_by!(id: 10_000_009)
quoted_status: remote_formatted_post,
state: :accepted StatusPin.create_with(account: showcase_account, status: public_self_reply_with_cw).find_or_create_by!(id: 10_000_000)
).find_or_create_by!(id: 10_000_010) StatusPin.create_with(account: showcase_account, status: private_mentionless).find_or_create_by!(id: 10_000_001)
Status.create_with(
account: showcase_account,
reblog: remote_quote
).find_or_create_by!(id: 10_000_024)
media_attachment = MediaAttachment.create_with( showcase_account.update!(
account: showcase_account, display_name: 'Mastodon test/showcase account',
file: File.open('spec/fixtures/files/attachment.jpg') note: 'Test account to showcase many Mastodon features. Most of its posts are public, but some are private!'
).find_or_create_by!(id: 10_000_010) )
quote_post_with_media = Status.create_with(
text: "This is a status with a picture and tags which also quotes a status with a picture.\n\n#Mastodon #Test",
ordered_media_attachment_ids: [media_attachment.id],
account: showcase_account,
visibility: :public
).find_or_create_by!(id: 10_000_025)
media_attachment.update(status_id: quote_post_with_media.id)
ProcessHashtagsService.new.call(quote_post_with_media)
Quote.create_with(
status: quote_post_with_media,
quoted_status: status_with_media,
state: :accepted
).find_or_create_by!(id: 10_000_011)
showcase_sidekick_account = Account.create_with(username: 'showcase_sidekick').find_or_create_by!(id: 10_000_002) remote_quote = Status.create_with(
sidekick_user = User.create_with( text: <<~HTML,
account_id: showcase_sidekick_account.id, <p>This is a self-quote of a remote formatted post</p>
agreement: true, <p class="quote-inline">RE: <a href="https://example.org/foo/bar/baz">https://example.org/foo/bar/baz</a></p>
password: SecureRandom.hex, HTML
email: ENV.fetch('TEST_DATA_SHOWCASE_SIDEKICK_EMAIL', 'showcase_sidekick@joinmastodon.org'), account: remote_account,
confirmed_at: Time.now.utc, uri: 'https://example.org/foo/bar/quote',
approved: true, url: 'https://example.org/foo/bar/quote'
bypass_registration_checks: true ).find_or_create_by!(id: 10_000_023)
).find_or_create_by!(id: 10_000_001) Quote.create_with(
sidekick_user.mark_email_as_confirmed! status: remote_quote,
sidekick_user.approve! quoted_status: remote_formatted_post,
state: :accepted
).find_or_create_by!(id: 10_000_010)
Status.create_with(
account: showcase_account,
reblog: remote_quote
).find_or_create_by!(id: 10_000_024)
sidekick_post = Status.create_with( media_attachment = MediaAttachment.create_with(
text: 'This post only exists to be quoted.', account: showcase_account,
account: showcase_sidekick_account, file: File.open('spec/fixtures/files/attachment.jpg')
visibility: :public ).find_or_create_by!(id: 10_000_010)
).find_or_create_by!(id: 10_000_026) quote_post_with_media = Status.create_with(
sidekick_quote_post = Status.create_with( text: "This is a status with a picture and tags which also quotes a status with a picture.\n\n#Mastodon #Test",
text: 'This is a quote of a different user.', ordered_media_attachment_ids: [media_attachment.id],
account: showcase_account, account: showcase_account,
visibility: :public visibility: :public
).find_or_create_by!(id: 10_000_027) ).find_or_create_by!(id: 10_000_025)
Quote.create_with( media_attachment.update(status_id: quote_post_with_media.id)
status: sidekick_quote_post, ProcessHashtagsService.new.call(quote_post_with_media)
quoted_status: sidekick_post, Quote.create_with(
activity_uri: 'https://foo/cross-account-quote', status: quote_post_with_media,
state: :accepted quoted_status: status_with_media,
).find_or_create_by!(id: 10_000_012) state: :accepted
).find_or_create_by!(id: 10_000_011)
showcase_sidekick_account = Account.create_with(username: 'showcase_sidekick').find_or_create_by!(id: 10_000_002)
sidekick_user = User.create_with(
account_id: showcase_sidekick_account.id,
agreement: true,
password: SecureRandom.hex,
email: ENV.fetch('TEST_DATA_SHOWCASE_SIDEKICK_EMAIL', 'showcase_sidekick@joinmastodon.org'),
confirmed_at: Time.now.utc,
approved: true,
bypass_registration_checks: true
).find_or_create_by!(id: 10_000_001)
sidekick_user.mark_email_as_confirmed!
sidekick_user.approve!
sidekick_post = Status.create_with(
text: 'This post only exists to be quoted.',
account: showcase_sidekick_account,
visibility: :public
).find_or_create_by!(id: 10_000_026)
sidekick_quote_post = Status.create_with(
text: 'This is a quote of a different user.',
account: showcase_account,
visibility: :public
).find_or_create_by!(id: 10_000_027)
Quote.create_with(
status: sidekick_quote_post,
quoted_status: sidekick_post,
activity_uri: 'https://foo/cross-account-quote',
state: :accepted
).find_or_create_by!(id: 10_000_012)
end
end end
end end

Loading…
Cancel
Save