Add 'suspended' tombstone text; add 'violated twitter rules' and 'account no longer exists' tombstone types

This commit is contained in:
Alessio 2021-12-21 16:05:51 -05:00
parent d91e76f664
commit 13299233c0
3 changed files with 12 additions and 4 deletions

View File

@ -27,9 +27,11 @@ create table tombstone_types (rowid integer primary key,
); );
insert into tombstone_types(rowid, short_name, tombstone_text) values insert into tombstone_types(rowid, short_name, tombstone_text) values
(1, 'deleted', 'This Tweet was deleted by the Tweet author'), (1, 'deleted', 'This Tweet was deleted by the Tweet author'),
(2, 'suspended', '???'), (2, 'suspended', 'This Tweet is from a suspended account'),
(3, 'hidden', 'Youre unable to view this Tweet because this account owner limits who can view their Tweets'), (3, 'hidden', 'Youre 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, create table tweets (rowid integer primary key,
id integer unique not null check(typeof(id) = 'integer'), id integer unique not null check(typeof(id) = 'integer'),

View File

@ -8,7 +8,7 @@ import (
) )
const ENGINE_DATABASE_VERSION = 2 const ENGINE_DATABASE_VERSION = 3
type VersionMismatchError struct { 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{ var MIGRATIONS = []string{
`create table polls (rowid integer primary key, `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 is_conversation_scraped boolean default 0;
alter table tweets add column last_scraped_at integer not null 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')`
} }
/** /**

View File

@ -297,8 +297,11 @@ type TweetResponse struct {
var tombstone_types = map[string]string{ var tombstone_types = map[string]string{
"This Tweet was deleted by the Tweet author. Learn more": "deleted", "This Tweet was deleted by the Tweet author. Learn more": "deleted",
"This Tweet is from a suspended account. Learn more": "suspended",
"Youre unable to view this Tweet because this account owner limits who can view their Tweets. Learn more": "hidden", "Youre 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 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 * Insert tweets into GlobalObjects for each tombstone. Returns a list of users that need to