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.

63 lines
2.7 KiB

Add Keybase integration (#10297) * create account_identity_proofs table * add endpoint for keybase to check local proofs * add async task to update validity and liveness of proofs from keybase * first pass keybase proof CRUD * second pass keybase proof creation * clean up proof list and add badges * add avatar url to keybase api * Always highlight the “Identity Proofs” navigation item when interacting with proofs. * Update translations. * Add profile URL. * Reorder proofs. * Add proofs to bio. * Update settings/identity_proofs front-end. * Use `link_to`. * Only encode query params if they exist. URLs without params had a trailing `?`. * Only show live proofs. * change valid to active in proof list and update liveness before displaying * minor fixes * add keybase config at well-known path * extremely naive feature flagging off the identity proof UI * fixes for rubocop * make identity proofs page resilient to potential keybase issues * normalize i18n * tweaks for brakeman * remove two unused translations * cleanup and add more localizations * make keybase_contacts an admin setting * fix ExternalProofService my_domain * use Addressable::URI in identity proofs * use active model serializer for keybase proof config * more cleanup of keybase proof config * rename proof is_valid and is_live to proof_valid and proof_live * cleanup * assorted tweaks for more robust communication with keybase * Clean up * Small fixes * Display verified identity identically to verified links * Clean up unused CSS * Add caching for Keybase avatar URLs * Remove keybase_contacts setting
5 years ago
  1. # frozen_string_literal: true
  2. module AccountAssociations
  3. extend ActiveSupport::Concern
  4. included do
  5. # Local users
  6. has_one :user, inverse_of: :account, dependent: :destroy
  7. # Identity proofs
  8. has_many :identity_proofs, class_name: 'AccountIdentityProof', dependent: :destroy, inverse_of: :account
  9. # Timelines
  10. has_many :statuses, inverse_of: :account, dependent: :destroy
  11. has_many :favourites, inverse_of: :account, dependent: :destroy
  12. has_many :mentions, inverse_of: :account, dependent: :destroy
  13. has_many :notifications, inverse_of: :account, dependent: :destroy
  14. has_many :conversations, class_name: 'AccountConversation', dependent: :destroy, inverse_of: :account
  15. has_many :scheduled_statuses, inverse_of: :account, dependent: :destroy
  16. # Pinned statuses
  17. has_many :status_pins, inverse_of: :account, dependent: :destroy
  18. has_many :pinned_statuses, -> { reorder('status_pins.created_at DESC') }, through: :status_pins, class_name: 'Status', source: :status
  19. # Endorsements
  20. has_many :account_pins, inverse_of: :account, dependent: :destroy
  21. has_many :endorsed_accounts, through: :account_pins, class_name: 'Account', source: :target_account
  22. # Media
  23. has_many :media_attachments, dependent: :destroy
  24. has_many :polls, dependent: :destroy
  25. # PuSH subscriptions
  26. has_many :subscriptions, dependent: :destroy
  27. # Report relationships
  28. has_many :reports, dependent: :destroy, inverse_of: :account
  29. has_many :targeted_reports, class_name: 'Report', foreign_key: :target_account_id, dependent: :destroy, inverse_of: :target_account
  30. has_many :report_notes, dependent: :destroy
  31. has_many :custom_filters, inverse_of: :account, dependent: :destroy
  32. # Moderation notes
  33. has_many :account_moderation_notes, dependent: :destroy, inverse_of: :account
  34. has_many :targeted_moderation_notes, class_name: 'AccountModerationNote', foreign_key: :target_account_id, dependent: :destroy, inverse_of: :target_account
  35. has_many :account_warnings, dependent: :destroy, inverse_of: :account
  36. has_many :targeted_account_warnings, class_name: 'AccountWarning', foreign_key: :target_account_id, dependent: :destroy, inverse_of: :target_account
  37. # Lists (that the account is on, not owned by the account)
  38. has_many :list_accounts, inverse_of: :account, dependent: :destroy
  39. has_many :lists, through: :list_accounts
  40. # Lists (owned by the account)
  41. has_many :owned_lists, class_name: 'List', dependent: :destroy, inverse_of: :account
  42. # Account migrations
  43. belongs_to :moved_to_account, class_name: 'Account', optional: true
  44. # Hashtags
  45. has_and_belongs_to_many :tags
  46. has_many :featured_tags, -> { includes(:tag) }, dependent: :destroy, inverse_of: :account
  47. end
  48. end