You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

370 lines
18 KiB

8 years ago
Account domain blocks (#2381) * Add <ostatus:conversation /> tag to Atom input/output Only uses ref attribute (not href) because href would be the alternate link that's always included also. Creates new conversation for every non-reply status. Carries over conversation for every reply. Keeps remote URIs verbatim, generates local URIs on the fly like the rest of them. * Conversation muting - prevents notifications that reference a conversation (including replies, favourites, reblogs) from being created. API endpoints /api/v1/statuses/:id/mute and /api/v1/statuses/:id/unmute Currently no way to tell when a status/conversation is muted, so the web UI only has a "disable notifications" button, doesn't work as a toggle * Display "Dismiss notifications" on all statuses in notifications column, not just own * Add "muted" as a boolean attribute on statuses JSON For now always false on contained reblogs, since it's only relevant for statuses returned from the notifications endpoint, which are not nested Remove "Disable notifications" from detailed status view, since it's only relevant in the notifications column * Up max class length * Remove pending test for conversation mute * Add tests, clean up * Rename to "mute conversation" and "unmute conversation" * Raise validation error when trying to mute/unmute status without conversation * Adding account domain blocks that filter notifications and public timelines * Add tests for domain blocks in notifications, public timelines Filter reblogs of blocked domains from home * Add API for listing and creating account domain blocks * API for creating/deleting domain blocks, tests for Status#ancestors and Status#descendants, filter domain blocks from them * Filter domains in streaming API * Update account_domain_block_spec.rb
7 years ago
8 years ago
Account domain blocks (#2381) * Add <ostatus:conversation /> tag to Atom input/output Only uses ref attribute (not href) because href would be the alternate link that's always included also. Creates new conversation for every non-reply status. Carries over conversation for every reply. Keeps remote URIs verbatim, generates local URIs on the fly like the rest of them. * Conversation muting - prevents notifications that reference a conversation (including replies, favourites, reblogs) from being created. API endpoints /api/v1/statuses/:id/mute and /api/v1/statuses/:id/unmute Currently no way to tell when a status/conversation is muted, so the web UI only has a "disable notifications" button, doesn't work as a toggle * Display "Dismiss notifications" on all statuses in notifications column, not just own * Add "muted" as a boolean attribute on statuses JSON For now always false on contained reblogs, since it's only relevant for statuses returned from the notifications endpoint, which are not nested Remove "Disable notifications" from detailed status view, since it's only relevant in the notifications column * Up max class length * Remove pending test for conversation mute * Add tests, clean up * Rename to "mute conversation" and "unmute conversation" * Raise validation error when trying to mute/unmute status without conversation * Adding account domain blocks that filter notifications and public timelines * Add tests for domain blocks in notifications, public timelines Filter reblogs of blocked domains from home * Add API for listing and creating account domain blocks * API for creating/deleting domain blocks, tests for Status#ancestors and Status#descendants, filter domain blocks from them * Filter domains in streaming API * Update account_domain_block_spec.rb
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
7 years ago
7 years ago
7 years ago
8 years ago
  1. # This file is auto-generated from the current state of the database. Instead
  2. # of editing this file, please use the migrations feature of Active Record to
  3. # incrementally modify your database, and then regenerate this schema definition.
  4. #
  5. # Note that this schema.rb definition is the authoritative source for your
  6. # database schema. If you need to create the application database on another
  7. # system, you should be using db:schema:load, not running all the migrations
  8. # from scratch. The latter is a flawed and unsustainable approach (the more migrations
  9. # you'll amass, the slower it'll run and the greater likelihood for issues).
  10. #
  11. # It's strongly recommended that you check this file into your version control system.
  12. ActiveRecord::Schema.define(version: 20170517205741) do
  13. # These are extensions that must be enabled in order to support this database
  14. enable_extension "plpgsql"
  15. create_table "account_domain_blocks", force: :cascade do |t|
  16. t.integer "account_id"
  17. t.string "domain"
  18. t.datetime "created_at", null: false
  19. t.datetime "updated_at", null: false
  20. t.index ["account_id", "domain"], name: "index_account_domain_blocks_on_account_id_and_domain", unique: true, using: :btree
  21. end
  22. create_table "accounts", force: :cascade do |t|
  23. t.string "username", default: "", null: false
  24. t.string "domain"
  25. t.string "secret", default: "", null: false
  26. t.text "private_key"
  27. t.text "public_key", default: "", null: false
  28. t.string "remote_url", default: "", null: false
  29. t.string "salmon_url", default: "", null: false
  30. t.string "hub_url", default: "", null: false
  31. t.datetime "created_at", null: false
  32. t.datetime "updated_at", null: false
  33. t.text "note", default: "", null: false
  34. t.string "display_name", default: "", null: false
  35. t.string "uri", default: "", null: false
  36. t.string "url"
  37. t.string "avatar_file_name"
  38. t.string "avatar_content_type"
  39. t.integer "avatar_file_size"
  40. t.datetime "avatar_updated_at"
  41. t.string "header_file_name"
  42. t.string "header_content_type"
  43. t.integer "header_file_size"
  44. t.datetime "header_updated_at"
  45. t.string "avatar_remote_url"
  46. t.datetime "subscription_expires_at"
  47. t.boolean "silenced", default: false, null: false
  48. t.boolean "suspended", default: false, null: false
  49. t.boolean "locked", default: false, null: false
  50. t.string "header_remote_url", default: "", null: false
  51. t.integer "statuses_count", default: 0, null: false
  52. t.integer "followers_count", default: 0, null: false
  53. t.integer "following_count", default: 0, null: false
  54. t.datetime "last_webfingered_at"
  55. t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin
  56. t.index "lower((username)::text), lower((domain)::text)", name: "index_accounts_on_username_and_domain_lower", using: :btree
  57. t.index ["uri"], name: "index_accounts_on_uri", using: :btree
  58. t.index ["url"], name: "index_accounts_on_url", using: :btree
  59. t.index ["username", "domain"], name: "index_accounts_on_username_and_domain", unique: true, using: :btree
  60. end
  61. create_table "blocks", force: :cascade do |t|
  62. t.integer "account_id", null: false
  63. t.integer "target_account_id", null: false
  64. t.datetime "created_at", null: false
  65. t.datetime "updated_at", null: false
  66. t.index ["account_id", "target_account_id"], name: "index_blocks_on_account_id_and_target_account_id", unique: true, using: :btree
  67. end
  68. create_table "conversation_mutes", force: :cascade do |t|
  69. t.integer "account_id", null: false
  70. t.bigint "conversation_id", null: false
  71. t.index ["account_id", "conversation_id"], name: "index_conversation_mutes_on_account_id_and_conversation_id", unique: true, using: :btree
  72. end
  73. create_table "conversations", id: :bigserial, force: :cascade do |t|
  74. t.string "uri"
  75. t.datetime "created_at", null: false
  76. t.datetime "updated_at", null: false
  77. t.index ["uri"], name: "index_conversations_on_uri", unique: true, using: :btree
  78. end
  79. create_table "domain_blocks", force: :cascade do |t|
  80. t.string "domain", default: "", null: false
  81. t.datetime "created_at", null: false
  82. t.datetime "updated_at", null: false
  83. t.integer "severity", default: 0
  84. t.boolean "reject_media"
  85. t.index ["domain"], name: "index_domain_blocks_on_domain", unique: true, using: :btree
  86. end
  87. create_table "favourites", force: :cascade do |t|
  88. t.integer "account_id", null: false
  89. t.integer "status_id", null: false
  90. t.datetime "created_at", null: false
  91. t.datetime "updated_at", null: false
  92. t.index ["account_id", "status_id"], name: "index_favourites_on_account_id_and_status_id", unique: true, using: :btree
  93. t.index ["status_id"], name: "index_favourites_on_status_id", using: :btree
  94. end
  95. create_table "follow_requests", force: :cascade do |t|
  96. t.integer "account_id", null: false
  97. t.integer "target_account_id", null: false
  98. t.datetime "created_at", null: false
  99. t.datetime "updated_at", null: false
  100. t.index ["account_id", "target_account_id"], name: "index_follow_requests_on_account_id_and_target_account_id", unique: true, using: :btree
  101. end
  102. create_table "follows", force: :cascade do |t|
  103. t.integer "account_id", null: false
  104. t.integer "target_account_id", null: false
  105. t.datetime "created_at", null: false
  106. t.datetime "updated_at", null: false
  107. t.index ["account_id", "target_account_id"], name: "index_follows_on_account_id_and_target_account_id", unique: true, using: :btree
  108. end
  109. create_table "imports", force: :cascade do |t|
  110. t.integer "account_id", null: false
  111. t.integer "type", null: false
  112. t.boolean "approved"
  113. t.datetime "created_at", null: false
  114. t.datetime "updated_at", null: false
  115. t.string "data_file_name"
  116. t.string "data_content_type"
  117. t.integer "data_file_size"
  118. t.datetime "data_updated_at"
  119. end
  120. create_table "media_attachments", force: :cascade do |t|
  121. t.bigint "status_id"
  122. t.string "file_file_name"
  123. t.string "file_content_type"
  124. t.integer "file_file_size"
  125. t.datetime "file_updated_at"
  126. t.string "remote_url", default: "", null: false
  127. t.integer "account_id"
  128. t.datetime "created_at", null: false
  129. t.datetime "updated_at", null: false
  130. t.string "shortcode"
  131. t.integer "type", default: 0, null: false
  132. t.json "file_meta"
  133. t.index ["shortcode"], name: "index_media_attachments_on_shortcode", unique: true, using: :btree
  134. t.index ["status_id"], name: "index_media_attachments_on_status_id", using: :btree
  135. end
  136. create_table "mentions", force: :cascade do |t|
  137. t.integer "account_id"
  138. t.bigint "status_id"
  139. t.datetime "created_at", null: false
  140. t.datetime "updated_at", null: false
  141. t.index ["account_id", "status_id"], name: "index_mentions_on_account_id_and_status_id", unique: true, using: :btree
  142. t.index ["status_id"], name: "index_mentions_on_status_id", using: :btree
  143. end
  144. create_table "mutes", force: :cascade do |t|
  145. t.integer "account_id", null: false
  146. t.integer "target_account_id", null: false
  147. t.datetime "created_at", null: false
  148. t.datetime "updated_at", null: false
  149. t.index ["account_id", "target_account_id"], name: "index_mutes_on_account_id_and_target_account_id", unique: true, using: :btree
  150. end
  151. create_table "notifications", force: :cascade do |t|
  152. t.integer "account_id"
  153. t.bigint "activity_id"
  154. t.string "activity_type"
  155. t.datetime "created_at", null: false
  156. t.datetime "updated_at", null: false
  157. t.integer "from_account_id"
  158. t.index ["account_id", "activity_id", "activity_type"], name: "account_activity", unique: true, using: :btree
  159. t.index ["activity_id", "activity_type"], name: "index_notifications_on_activity_id_and_activity_type", using: :btree
  160. end
  161. create_table "oauth_access_grants", force: :cascade do |t|
  162. t.integer "resource_owner_id", null: false
  163. t.integer "application_id", null: false
  164. t.string "token", null: false
  165. t.integer "expires_in", null: false
  166. t.text "redirect_uri", null: false
  167. t.datetime "created_at", null: false
  168. t.datetime "revoked_at"
  169. t.string "scopes"
  170. t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree
  171. end
  172. create_table "oauth_access_tokens", force: :cascade do |t|
  173. t.integer "resource_owner_id"
  174. t.integer "application_id"
  175. t.string "token", null: false
  176. t.string "refresh_token"
  177. t.integer "expires_in"
  178. t.datetime "revoked_at"
  179. t.datetime "created_at", null: false
  180. t.string "scopes"
  181. t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true, using: :btree
  182. t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree
  183. t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree
  184. end
  185. create_table "oauth_applications", force: :cascade do |t|
  186. t.string "name", null: false
  187. t.string "uid", null: false
  188. t.string "secret", null: false
  189. t.text "redirect_uri", null: false
  190. t.string "scopes", default: "", null: false
  191. t.datetime "created_at"
  192. t.datetime "updated_at"
  193. t.boolean "superapp", default: false, null: false
  194. t.string "website"
  195. t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
  196. end
  197. create_table "preview_cards", force: :cascade do |t|
  198. t.bigint "status_id"
  199. t.string "url", default: "", null: false
  200. t.string "title"
  201. t.string "description"
  202. t.string "image_file_name"
  203. t.string "image_content_type"
  204. t.integer "image_file_size"
  205. t.datetime "image_updated_at"
  206. t.datetime "created_at", null: false
  207. t.datetime "updated_at", null: false
  208. t.integer "type", default: 0, null: false
  209. t.text "html", default: "", null: false
  210. t.string "author_name", default: "", null: false
  211. t.string "author_url", default: "", null: false
  212. t.string "provider_name", default: "", null: false
  213. t.string "provider_url", default: "", null: false
  214. t.integer "width", default: 0, null: false
  215. t.integer "height", default: 0, null: false
  216. t.index ["status_id"], name: "index_preview_cards_on_status_id", unique: true, using: :btree
  217. end
  218. create_table "reports", force: :cascade do |t|
  219. t.integer "account_id", null: false
  220. t.integer "target_account_id", null: false
  221. t.bigint "status_ids", default: [], null: false, array: true
  222. t.text "comment", default: "", null: false
  223. t.boolean "action_taken", default: false, null: false
  224. t.datetime "created_at", null: false
  225. t.datetime "updated_at", null: false
  226. t.integer "action_taken_by_account_id"
  227. t.index ["account_id"], name: "index_reports_on_account_id", using: :btree
  228. t.index ["target_account_id"], name: "index_reports_on_target_account_id", using: :btree
  229. end
  230. create_table "settings", force: :cascade do |t|
  231. t.string "var", null: false
  232. t.text "value"
  233. t.string "thing_type"
  234. t.integer "thing_id"
  235. t.datetime "created_at"
  236. t.datetime "updated_at"
  237. t.index ["thing_type", "thing_id", "var"], name: "index_settings_on_thing_type_and_thing_id_and_var", unique: true, using: :btree
  238. end
  239. create_table "statuses", id: :bigserial, force: :cascade do |t|
  240. t.string "uri"
  241. t.integer "account_id", null: false
  242. t.text "text", default: "", null: false
  243. t.datetime "created_at", null: false
  244. t.datetime "updated_at", null: false
  245. t.bigint "in_reply_to_id"
  246. t.bigint "reblog_of_id"
  247. t.string "url"
  248. t.boolean "sensitive", default: false
  249. t.integer "visibility", default: 0, null: false
  250. t.integer "in_reply_to_account_id"
  251. t.integer "application_id"
  252. t.text "spoiler_text", default: "", null: false
  253. t.boolean "reply", default: false
  254. t.integer "favourites_count", default: 0, null: false
  255. t.integer "reblogs_count", default: 0, null: false
  256. t.string "language", default: "en", null: false
  257. t.bigint "conversation_id"
  258. t.index ["account_id"], name: "index_statuses_on_account_id", using: :btree
  259. t.index ["conversation_id"], name: "index_statuses_on_conversation_id", using: :btree
  260. t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id", using: :btree
  261. t.index ["reblog_of_id"], name: "index_statuses_on_reblog_of_id", using: :btree
  262. t.index ["uri"], name: "index_statuses_on_uri", unique: true, using: :btree
  263. end
  264. create_table "statuses_tags", id: false, force: :cascade do |t|
  265. t.bigint "status_id", null: false
  266. t.integer "tag_id", null: false
  267. t.index ["status_id"], name: "index_statuses_tags_on_status_id", using: :btree
  268. t.index ["tag_id", "status_id"], name: "index_statuses_tags_on_tag_id_and_status_id", unique: true, using: :btree
  269. end
  270. create_table "stream_entries", force: :cascade do |t|
  271. t.integer "account_id"
  272. t.bigint "activity_id"
  273. t.string "activity_type"
  274. t.datetime "created_at", null: false
  275. t.datetime "updated_at", null: false
  276. t.boolean "hidden", default: false, null: false
  277. t.index ["account_id"], name: "index_stream_entries_on_account_id", using: :btree
  278. t.index ["activity_id", "activity_type"], name: "index_stream_entries_on_activity_id_and_activity_type", using: :btree
  279. end
  280. create_table "subscriptions", force: :cascade do |t|
  281. t.string "callback_url", default: "", null: false
  282. t.string "secret"
  283. t.datetime "expires_at"
  284. t.boolean "confirmed", default: false, null: false
  285. t.integer "account_id", null: false
  286. t.datetime "created_at", null: false
  287. t.datetime "updated_at", null: false
  288. t.datetime "last_successful_delivery_at"
  289. t.index ["account_id", "callback_url"], name: "index_subscriptions_on_account_id_and_callback_url", unique: true, using: :btree
  290. end
  291. create_table "tags", force: :cascade do |t|
  292. t.string "name", default: "", null: false
  293. t.datetime "created_at", null: false
  294. t.datetime "updated_at", null: false
  295. t.index "to_tsvector('simple'::regconfig, (name)::text)", name: "hashtag_search_index", using: :gin
  296. t.index ["name"], name: "index_tags_on_name", unique: true, using: :btree
  297. end
  298. create_table "users", force: :cascade do |t|
  299. t.string "email", default: "", null: false
  300. t.integer "account_id", null: false
  301. t.datetime "created_at", null: false
  302. t.datetime "updated_at", null: false
  303. t.string "encrypted_password", default: "", null: false
  304. t.string "reset_password_token"
  305. t.datetime "reset_password_sent_at"
  306. t.datetime "remember_created_at"
  307. t.integer "sign_in_count", default: 0, null: false
  308. t.datetime "current_sign_in_at"
  309. t.datetime "last_sign_in_at"
  310. t.inet "current_sign_in_ip"
  311. t.inet "last_sign_in_ip"
  312. t.boolean "admin", default: false
  313. t.string "confirmation_token"
  314. t.datetime "confirmed_at"
  315. t.datetime "confirmation_sent_at"
  316. t.string "unconfirmed_email"
  317. t.string "locale"
  318. t.string "encrypted_otp_secret"
  319. t.string "encrypted_otp_secret_iv"
  320. t.string "encrypted_otp_secret_salt"
  321. t.integer "consumed_timestep"
  322. t.boolean "otp_required_for_login"
  323. t.datetime "last_emailed_at"
  324. t.string "otp_backup_codes", array: true
  325. t.string "allowed_languages", default: [], null: false, array: true
  326. t.index ["account_id"], name: "index_users_on_account_id", using: :btree
  327. t.index ["allowed_languages"], name: "index_users_on_allowed_languages", using: :gin
  328. t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
  329. t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
  330. t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
  331. end
  332. create_table "web_settings", force: :cascade do |t|
  333. t.integer "user_id"
  334. t.json "data"
  335. t.datetime "created_at", null: false
  336. t.datetime "updated_at", null: false
  337. t.index ["user_id"], name: "index_web_settings_on_user_id", unique: true, using: :btree
  338. end
  339. add_foreign_key "statuses", "statuses", column: "reblog_of_id", on_delete: :cascade
  340. end