Add ApplicationRecord

parent fe57bd88
......@@ -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
......
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
......
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
......
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
......
class Conversation < ActiveRecord::Base
class Conversation < ApplicationRecord
include Diaspora::Federated::Base
include Diaspora::Fields::Guid
include Diaspora::Fields::Author
......
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
......
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
......
class LikeSignature < ActiveRecord::Base
class LikeSignature < ApplicationRecord
include Diaspora::Signature
self.primary_key = :like_id
......
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
......
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
......
class OEmbedCache < ActiveRecord::Base
class OEmbedCache < ApplicationRecord
serialize :data
validates :data, :presence => true
......
class OpenGraphCache < ActiveRecord::Base
class OpenGraphCache < ApplicationRecord
validates :title, :presence => true
validates :ob_type, :presence => true
validates :image, :presence => true
......
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
......
class Pod < ActiveRecord::Base
class Pod < ApplicationRecord
enum status: %i(
unchecked
no_errors
......
class Poll < ActiveRecord::Base
class Poll < ApplicationRecord
include Diaspora::Federated::Base
include Diaspora::Fields::Guid
......
class PollAnswer < ActiveRecord::Base
class PollAnswer < ApplicationRecord
include Diaspora::Federated::Base
include Diaspora::Fields::Guid
......
class PollParticipation < ActiveRecord::Base
class PollParticipation < ApplicationRecord
include Diaspora::Federated::Base
include Diaspora::Fields::Guid
include Diaspora::Fields::Author
......
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
......
class Report < ActiveRecord::Base
class Report < ApplicationRecord
validates :user_id, presence: true
validates :item_id, presence: true
validates :item_type, presence: true, inclusion: {
......
# 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
......
class SignatureOrder < ActiveRecord::Base
class SignatureOrder < ApplicationRecord
validates :order, presence: true, uniqueness: true
end
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
......
class UserPreference < ActiveRecord::Base
class UserPreference < ApplicationRecord
belongs_to :user
validate :must_be_valid_email_type
......
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|
......
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
......
class LinkShareVisibilitiesWithUser < ActiveRecord::Migration
class ShareVisibility < ActiveRecord::Base
class ShareVisibility < ApplicationRecord
end
def up
......
class CleanupAspectVisibility < ActiveRecord::Migration
class AspectVisibility < ActiveRecord::Base
class AspectVisibility < ApplicationRecord
end
def up
......
class CleanupParticipations < ActiveRecord::Migration
class Participation < ActiveRecord::Base
class Participation < ApplicationRecord
end
def up
......
class CreateSignatureTables < ActiveRecord::Migration
class SignatureOrder < ActiveRecord::Base
class SignatureOrder < ApplicationRecord
end
RELAYABLES = %i(comment like poll_participation).freeze
......
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
......
class CleanupInvitationColumnsFromUsers < ActiveRecord::Migration
class InvitationCode < ActiveRecord::Base
class InvitationCode < ApplicationRecord
end
class User < ActiveRecord::Base
class User < ApplicationRecord
end
def change
......
class RemoveStartedSharingNotificationsWithoutContact < ActiveRecord::Migration
class Notification < ActiveRecord::Base
class Notification < ApplicationRecord
end
def up
......
class RemoveInvalidUnconfirmedEmails < ActiveRecord::Migration
class User < ActiveRecord::Base
class User < ApplicationRecord
end
def up
......
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)
......
#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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment