Add ApplicationRecord
This commit is contained in:
parent
fe57bd88e8
commit
eb19c327e2
56 changed files with 73 additions and 70 deletions
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class AccountDeletion < ActiveRecord::Base
|
||||
class AccountDeletion < ApplicationRecord
|
||||
include Diaspora::Federated::Base
|
||||
|
||||
scope :uncompleted, -> { where('completed_at is null') }
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module Api
|
||||
module OpenidConnect
|
||||
class Authorization < ActiveRecord::Base
|
||||
class Authorization < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :o_auth_application
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
module Api
|
||||
module OpenidConnect
|
||||
class OAuthAccessToken < ActiveRecord::Base
|
||||
class OAuthAccessToken < ApplicationRecord
|
||||
belongs_to :authorization
|
||||
|
||||
before_validation :setup, on: :create
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ require "digest"
|
|||
|
||||
module Api
|
||||
module OpenidConnect
|
||||
class OAuthApplication < ActiveRecord::Base
|
||||
class OAuthApplication < ApplicationRecord
|
||||
has_many :authorizations, dependent: :destroy
|
||||
has_many :user, through: :authorizations
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
module Api
|
||||
module OpenidConnect
|
||||
class PairwisePseudonymousIdentifier < ActiveRecord::Base
|
||||
class PairwisePseudonymousIdentifier < ApplicationRecord
|
||||
self.table_name = "ppid"
|
||||
|
||||
belongs_to :o_auth_application
|
||||
|
|
|
|||
3
app/models/application_record.rb
Normal file
3
app/models/application_record.rb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class Aspect < ActiveRecord::Base
|
||||
class Aspect < ApplicationRecord
|
||||
belongs_to :user
|
||||
|
||||
has_many :aspect_memberships, :dependent => :destroy
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class AspectMembership < ActiveRecord::Base
|
||||
class AspectMembership < ApplicationRecord
|
||||
|
||||
belongs_to :aspect
|
||||
belongs_to :contact
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class AspectVisibility < ActiveRecord::Base
|
||||
class AspectVisibility < ApplicationRecord
|
||||
|
||||
belongs_to :aspect
|
||||
validates :aspect, :presence => true
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Block < ActiveRecord::Base
|
||||
class Block < ApplicationRecord
|
||||
belongs_to :person
|
||||
belongs_to :user
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class Comment < ActiveRecord::Base
|
||||
class Comment < ApplicationRecord
|
||||
|
||||
include Diaspora::Federated::Base
|
||||
include Diaspora::Fields::Guid
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class CommentSignature < ActiveRecord::Base
|
||||
class CommentSignature < ApplicationRecord
|
||||
include Diaspora::Signature
|
||||
|
||||
self.primary_key = :comment_id
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class Contact < ActiveRecord::Base
|
||||
class Contact < ApplicationRecord
|
||||
include Diaspora::Federated::Base
|
||||
|
||||
belongs_to :user
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Conversation < ActiveRecord::Base
|
||||
class Conversation < ApplicationRecord
|
||||
include Diaspora::Federated::Base
|
||||
include Diaspora::Fields::Guid
|
||||
include Diaspora::Fields::Author
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class ConversationVisibility < ActiveRecord::Base
|
||||
class ConversationVisibility < ApplicationRecord
|
||||
|
||||
belongs_to :conversation
|
||||
belongs_to :person
|
||||
|
|
@ -6,7 +6,7 @@ class ConversationVisibility < ActiveRecord::Base
|
|||
after_destroy :check_orphan_conversation
|
||||
|
||||
private
|
||||
|
||||
|
||||
def check_orphan_conversation
|
||||
conversation = Conversation.find_by_id(self.conversation.id)
|
||||
if conversation
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class InvitationCode < ActiveRecord::Base
|
||||
class InvitationCode < ApplicationRecord
|
||||
belongs_to :user
|
||||
|
||||
validates_presence_of :user
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class Like < ActiveRecord::Base
|
||||
class Like < ApplicationRecord
|
||||
include Diaspora::Federated::Base
|
||||
include Diaspora::Fields::Guid
|
||||
include Diaspora::Fields::Author
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class LikeSignature < ActiveRecord::Base
|
||||
class LikeSignature < ApplicationRecord
|
||||
include Diaspora::Signature
|
||||
|
||||
self.primary_key = :like_id
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Location < ActiveRecord::Base
|
||||
class Location < ApplicationRecord
|
||||
before_validation :split_coords, on: :create
|
||||
validates_presence_of :lat, :lng
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class Mention < ActiveRecord::Base
|
||||
class Mention < ApplicationRecord
|
||||
belongs_to :mentions_container, polymorphic: true
|
||||
belongs_to :person
|
||||
validates :mentions_container, presence: true
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Message < ActiveRecord::Base
|
||||
class Message < ApplicationRecord
|
||||
include Diaspora::Federated::Base
|
||||
include Diaspora::Fields::Guid
|
||||
include Diaspora::Fields::Author
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
#
|
||||
class Notification < ActiveRecord::Base
|
||||
class Notification < ApplicationRecord
|
||||
belongs_to :recipient, class_name: "User"
|
||||
has_many :notification_actors, dependent: :destroy
|
||||
has_many :actors, class_name: "Person", through: :notification_actors, source: :person
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class NotificationActor < ActiveRecord::Base
|
||||
class NotificationActor < ApplicationRecord
|
||||
|
||||
belongs_to :notification
|
||||
belongs_to :person
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class OEmbedCache < ActiveRecord::Base
|
||||
class OEmbedCache < ApplicationRecord
|
||||
serialize :data
|
||||
validates :data, :presence => true
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class OpenGraphCache < ActiveRecord::Base
|
||||
class OpenGraphCache < ApplicationRecord
|
||||
validates :title, :presence => true
|
||||
validates :ob_type, :presence => true
|
||||
validates :image, :presence => true
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Participation < ActiveRecord::Base
|
||||
class Participation < ApplicationRecord
|
||||
include Diaspora::Federated::Base
|
||||
include Diaspora::Fields::Guid
|
||||
include Diaspora::Fields::Author
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class Person < ActiveRecord::Base
|
||||
class Person < ApplicationRecord
|
||||
include Diaspora::Fields::Guid
|
||||
|
||||
# NOTE API V1 to be extracted
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class Photo < ActiveRecord::Base
|
||||
class Photo < ApplicationRecord
|
||||
include Diaspora::Federated::Base
|
||||
include Diaspora::Commentable
|
||||
include Diaspora::Shareable
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Pod < ActiveRecord::Base
|
||||
class Pod < ApplicationRecord
|
||||
enum status: %i(
|
||||
unchecked
|
||||
no_errors
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Poll < ActiveRecord::Base
|
||||
class Poll < ApplicationRecord
|
||||
include Diaspora::Federated::Base
|
||||
include Diaspora::Fields::Guid
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class PollAnswer < ActiveRecord::Base
|
||||
class PollAnswer < ApplicationRecord
|
||||
include Diaspora::Federated::Base
|
||||
include Diaspora::Fields::Guid
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class PollParticipation < ActiveRecord::Base
|
||||
class PollParticipation < ApplicationRecord
|
||||
include Diaspora::Federated::Base
|
||||
include Diaspora::Fields::Guid
|
||||
include Diaspora::Fields::Author
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class PollParticipationSignature < ActiveRecord::Base
|
||||
class PollParticipationSignature < ApplicationRecord
|
||||
include Diaspora::Signature
|
||||
|
||||
self.primary_key = :poll_participation_id
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class Post < ActiveRecord::Base
|
||||
class Post < ApplicationRecord
|
||||
self.include_root_in_json = false
|
||||
|
||||
include ApplicationHelper
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class Profile < ActiveRecord::Base
|
||||
class Profile < ApplicationRecord
|
||||
self.include_root_in_json = false
|
||||
|
||||
include Diaspora::Federated::Base
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Report < ActiveRecord::Base
|
||||
class Report < ApplicationRecord
|
||||
validates :user_id, presence: true
|
||||
validates :item_id, presence: true
|
||||
validates :item_type, presence: true, inclusion: {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# NOTE add the person object you want to attach role to...
|
||||
|
||||
class Role < ActiveRecord::Base
|
||||
class Role < ApplicationRecord
|
||||
belongs_to :person
|
||||
|
||||
validates :person, presence: true
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class Service < ActiveRecord::Base
|
||||
class Service < ApplicationRecord
|
||||
attr_accessor :provider, :info, :access_level
|
||||
|
||||
belongs_to :user
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class ShareVisibility < ActiveRecord::Base
|
||||
class ShareVisibility < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :shareable, polymorphic: :true
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
class SignatureOrder < ActiveRecord::Base
|
||||
class SignatureOrder < ApplicationRecord
|
||||
validates :order, presence: true, uniqueness: true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class TagFollowing < ActiveRecord::Base
|
||||
class TagFollowing < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :tag, :class_name => "ActsAsTaggableOn::Tag"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class User < ActiveRecord::Base
|
||||
class User < ApplicationRecord
|
||||
include AuthenticationToken
|
||||
include Connecting
|
||||
include Querying
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class UserPreference < ActiveRecord::Base
|
||||
class UserPreference < ApplicationRecord
|
||||
belongs_to :user
|
||||
|
||||
validate :must_be_valid_email_type
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class MigrateActivityStreamToStatusMessage < ActiveRecord::Migration
|
||||
class Post < ActiveRecord::Base; self.inheritance_column = false; end
|
||||
class Post < ApplicationRecord; self.inheritance_column = false; end
|
||||
def up
|
||||
posts_stream_photos = Post.where(type: 'ActivityStreams::Photo')
|
||||
posts_stream_photos.each do |p|
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class ExtendPods < ActiveRecord::Migration
|
||||
class Pod < ActiveRecord::Base
|
||||
class Pod < ApplicationRecord
|
||||
has_many :people
|
||||
|
||||
DEFAULT_PORTS = [URI::HTTP::DEFAULT_PORT, URI::HTTPS::DEFAULT_PORT]
|
||||
|
|
@ -18,7 +18,7 @@ class ExtendPods < ActiveRecord::Migration
|
|||
end
|
||||
end
|
||||
|
||||
class Person < ActiveRecord::Base
|
||||
class Person < ApplicationRecord
|
||||
belongs_to :owner, class_name: "User"
|
||||
belongs_to :pod
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ class ExtendPods < ActiveRecord::Migration
|
|||
end
|
||||
end
|
||||
|
||||
class User < ActiveRecord::Base
|
||||
class User < ApplicationRecord
|
||||
has_one :person, inverse_of: :owner, foreign_key: :owner_id
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class LinkShareVisibilitiesWithUser < ActiveRecord::Migration
|
||||
class ShareVisibility < ActiveRecord::Base
|
||||
class ShareVisibility < ApplicationRecord
|
||||
end
|
||||
|
||||
def up
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class CleanupAspectVisibility < ActiveRecord::Migration
|
||||
class AspectVisibility < ActiveRecord::Base
|
||||
class AspectVisibility < ApplicationRecord
|
||||
end
|
||||
|
||||
def up
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class CleanupParticipations < ActiveRecord::Migration
|
||||
class Participation < ActiveRecord::Base
|
||||
class Participation < ApplicationRecord
|
||||
end
|
||||
|
||||
def up
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class CreateSignatureTables < ActiveRecord::Migration
|
||||
class SignatureOrder < ActiveRecord::Base
|
||||
class SignatureOrder < ApplicationRecord
|
||||
end
|
||||
|
||||
RELAYABLES = %i(comment like poll_participation).freeze
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
class ParticipationCounter < ActiveRecord::Migration
|
||||
class Comment < ActiveRecord::Base
|
||||
class Comment < ApplicationRecord
|
||||
end
|
||||
|
||||
class Like < ActiveRecord::Base
|
||||
class Like < ApplicationRecord
|
||||
end
|
||||
|
||||
class Participation < ActiveRecord::Base
|
||||
class Participation < ApplicationRecord
|
||||
belongs_to :author, class_name: "Person"
|
||||
end
|
||||
|
||||
class Poll < ActiveRecord::Base
|
||||
class Poll < ApplicationRecord
|
||||
end
|
||||
|
||||
class PollParticipation < ActiveRecord::Base
|
||||
class PollParticipation < ApplicationRecord
|
||||
belongs_to :poll
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
class CleanupInvitationColumnsFromUsers < ActiveRecord::Migration
|
||||
class InvitationCode < ActiveRecord::Base
|
||||
class InvitationCode < ApplicationRecord
|
||||
end
|
||||
|
||||
class User < ActiveRecord::Base
|
||||
class User < ApplicationRecord
|
||||
end
|
||||
|
||||
def change
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class RemoveStartedSharingNotificationsWithoutContact < ActiveRecord::Migration
|
||||
class Notification < ActiveRecord::Base
|
||||
class Notification < ApplicationRecord
|
||||
end
|
||||
|
||||
def up
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class RemoveInvalidUnconfirmedEmails < ActiveRecord::Migration
|
||||
class User < ActiveRecord::Base
|
||||
class User < ApplicationRecord
|
||||
end
|
||||
|
||||
def up
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
class FixPhotosShareVisibilities < ActiveRecord::Migration
|
||||
class Photo < ActiveRecord::Base
|
||||
class Photo < ApplicationRecord
|
||||
end
|
||||
|
||||
class ShareVisibility < ActiveRecord::Base
|
||||
class ShareVisibility < ApplicationRecord
|
||||
end
|
||||
|
||||
def up
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ class PolymorphicMentions < ActiveRecord::Migration
|
|||
reversible(&method(:up_down))
|
||||
end
|
||||
|
||||
class Mention < ActiveRecord::Base
|
||||
class Mention < ApplicationRecord
|
||||
end
|
||||
|
||||
class Notification < ActiveRecord::Base
|
||||
class Notification < ApplicationRecord
|
||||
end
|
||||
|
||||
def up_down(change)
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
#we dont have the environment, and it is not carring over from the migration
|
||||
unless defined?(Person)
|
||||
class Person < ActiveRecord::Base
|
||||
class Person < ApplicationRecord
|
||||
belongs_to :owner, :class_name => 'User'
|
||||
end
|
||||
end
|
||||
|
||||
unless defined?(User)
|
||||
class User < ActiveRecord::Base
|
||||
class User < ApplicationRecord
|
||||
serialize :hidden_shareables, Hash
|
||||
end
|
||||
end
|
||||
|
||||
unless defined?(Contact)
|
||||
class Contact < ActiveRecord::Base
|
||||
class Contact < ApplicationRecord
|
||||
belongs_to :user
|
||||
end
|
||||
end
|
||||
|
||||
unless defined?(ShareVisibility)
|
||||
class ShareVisibility < ActiveRecord::Base
|
||||
class ShareVisibility < ApplicationRecord
|
||||
belongs_to :contact
|
||||
end
|
||||
end
|
||||
|
|
@ -28,14 +28,14 @@ class ShareVisibilityConverter
|
|||
def self.copy_hidden_share_visibilities_to_users(only_recent = false)
|
||||
query = ShareVisibility.where(:hidden => true).includes(:contact => :user)
|
||||
query = query.where('share_visibilities.updated_at > ?', RECENT.weeks.ago) if only_recent
|
||||
count = query.count
|
||||
count = query.count
|
||||
puts "Updating #{count} records in batches of 1000..."
|
||||
|
||||
batch_count = 1
|
||||
query.find_in_batches do |visibilities|
|
||||
puts "Updating batch ##{batch_count} of #{(count/1000)+1}..."
|
||||
batch_count += 1
|
||||
visibilities.each do |visibility|
|
||||
visibilities.each do |visibility|
|
||||
begin
|
||||
type = visibility.shareable_type
|
||||
id = visibility.shareable_id.to_s
|
||||
|
|
|
|||
Loading…
Reference in a new issue