From 13299233c06cab52a769ec93c1619e12b2519151 Mon Sep 17 00:00:00 2001 From: Alessio Date: Tue, 21 Dec 2021 16:05:51 -0500 Subject: [PATCH] Add 'suspended' tombstone text; add 'violated twitter rules' and 'account no longer exists' tombstone types --- persistence/schema.sql | 6 ++++-- persistence/versions.go | 7 +++++-- scraper/api_types.go | 3 +++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/persistence/schema.sql b/persistence/schema.sql index 545293e..5737b27 100644 --- a/persistence/schema.sql +++ b/persistence/schema.sql @@ -27,9 +27,11 @@ create table tombstone_types (rowid integer primary key, ); insert into tombstone_types(rowid, short_name, tombstone_text) values (1, 'deleted', 'This Tweet was deleted by the Tweet author'), - (2, 'suspended', '???'), + (2, 'suspended', 'This Tweet is from a suspended account'), (3, 'hidden', 'You’re unable to view this Tweet because this account owner limits who can view their Tweets'), - (4, 'unavailable', 'This Tweet is unavailable'); + (4, 'unavailable', 'This Tweet is unavailable'), + (5, 'violated', 'This Tweet violated the Twitter Rules'), + (6, 'no longer exists', 'This Tweet is from an account that no longer exists'); create table tweets (rowid integer primary key, id integer unique not null check(typeof(id) = 'integer'), diff --git a/persistence/versions.go b/persistence/versions.go index 40b21f5..010baeb 100644 --- a/persistence/versions.go +++ b/persistence/versions.go @@ -8,7 +8,7 @@ import ( ) -const ENGINE_DATABASE_VERSION = 2 +const ENGINE_DATABASE_VERSION = 3 type VersionMismatchError struct { @@ -25,7 +25,8 @@ Please upgrade this application to a newer version to use this profile. Or down /** - * The Nth entry is the migration that moves you from version N to version N+1 + * The Nth entry is the migration that moves you from version N to version N+1. + * `len(MIGRATIONS)` should always equal `ENGINE_DATABASE_VERSION`. */ var MIGRATIONS = []string{ `create table polls (rowid integer primary key, @@ -51,6 +52,8 @@ var MIGRATIONS = []string{ );`, `alter table tweets add column is_conversation_scraped boolean default 0; alter table tweets add column last_scraped_at integer not null default 0`, +`update tombstone_types set tombstone_text = 'This Tweet is from a suspended account' where rowid = 2; + insert into tombstone_types (rowid, short_name, tombstone_text) values (5, 'violated', 'This Tweet violated the Twitter Rules'), (6, 'no longer exists', 'This Tweet is from an account that no longer exists')` } /** diff --git a/scraper/api_types.go b/scraper/api_types.go index 87250cc..a15ffe5 100644 --- a/scraper/api_types.go +++ b/scraper/api_types.go @@ -297,8 +297,11 @@ type TweetResponse struct { var tombstone_types = map[string]string{ "This Tweet was deleted by the Tweet author. Learn more": "deleted", + "This Tweet is from a suspended account. Learn more": "suspended", "You’re unable to view this Tweet because this account owner limits who can view their Tweets. Learn more": "hidden", "This Tweet is unavailable. Learn more": "unavailable", + "This Tweet violated the Twitter Rules. Learn more": "violated", + "This Tweet is from an account that no longer exists. Learn more": "no longer exists", } /** * Insert tweets into GlobalObjects for each tombstone. Returns a list of users that need to