Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
diaspora
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
diasporg
diaspora
Commits
eb19c327
Unverified
Commit
eb19c327
authored
Aug 05, 2017
by
Benjamin Neff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ApplicationRecord
parent
fe57bd88
Changes
56
Hide whitespace changes
Inline
Side-by-side
Showing
56 changed files
with
73 additions
and
70 deletions
+73
-70
app/models/account_deletion.rb
app/models/account_deletion.rb
+1
-1
app/models/api/openid_connect/authorization.rb
app/models/api/openid_connect/authorization.rb
+1
-1
app/models/api/openid_connect/o_auth_access_token.rb
app/models/api/openid_connect/o_auth_access_token.rb
+1
-1
app/models/api/openid_connect/o_auth_application.rb
app/models/api/openid_connect/o_auth_application.rb
+1
-1
app/models/api/openid_connect/pairwise_pseudonymous_identifier.rb
...ls/api/openid_connect/pairwise_pseudonymous_identifier.rb
+1
-1
app/models/application_record.rb
app/models/application_record.rb
+3
-0
app/models/aspect.rb
app/models/aspect.rb
+1
-1
app/models/aspect_membership.rb
app/models/aspect_membership.rb
+1
-1
app/models/aspect_visibility.rb
app/models/aspect_visibility.rb
+1
-1
app/models/block.rb
app/models/block.rb
+1
-1
app/models/comment.rb
app/models/comment.rb
+1
-1
app/models/comment_signature.rb
app/models/comment_signature.rb
+1
-1
app/models/contact.rb
app/models/contact.rb
+1
-1
app/models/conversation.rb
app/models/conversation.rb
+1
-1
app/models/conversation_visibility.rb
app/models/conversation_visibility.rb
+2
-2
app/models/invitation_code.rb
app/models/invitation_code.rb
+1
-1
app/models/like.rb
app/models/like.rb
+1
-1
app/models/like_signature.rb
app/models/like_signature.rb
+1
-1
app/models/location.rb
app/models/location.rb
+1
-1
app/models/mention.rb
app/models/mention.rb
+1
-1
app/models/message.rb
app/models/message.rb
+1
-1
app/models/notification.rb
app/models/notification.rb
+1
-1
app/models/notification_actor.rb
app/models/notification_actor.rb
+1
-1
app/models/o_embed_cache.rb
app/models/o_embed_cache.rb
+1
-1
app/models/open_graph_cache.rb
app/models/open_graph_cache.rb
+1
-1
app/models/participation.rb
app/models/participation.rb
+1
-1
app/models/person.rb
app/models/person.rb
+1
-1
app/models/photo.rb
app/models/photo.rb
+1
-1
app/models/pod.rb
app/models/pod.rb
+1
-1
app/models/poll.rb
app/models/poll.rb
+1
-1
app/models/poll_answer.rb
app/models/poll_answer.rb
+1
-1
app/models/poll_participation.rb
app/models/poll_participation.rb
+1
-1
app/models/poll_participation_signature.rb
app/models/poll_participation_signature.rb
+1
-1
app/models/post.rb
app/models/post.rb
+1
-1
app/models/profile.rb
app/models/profile.rb
+1
-1
app/models/report.rb
app/models/report.rb
+1
-1
app/models/role.rb
app/models/role.rb
+1
-1
app/models/service.rb
app/models/service.rb
+1
-1
app/models/share_visibility.rb
app/models/share_visibility.rb
+1
-1
app/models/signature_order.rb
app/models/signature_order.rb
+1
-1
app/models/tag_following.rb
app/models/tag_following.rb
+1
-1
app/models/user.rb
app/models/user.rb
+1
-1
app/models/user_preference.rb
app/models/user_preference.rb
+1
-1
db/migrate/20130717104359_migrate_activity_stream_to_status_message.rb
...130717104359_migrate_activity_stream_to_status_message.rb
+1
-1
db/migrate/20160124234712_extend_pods.rb
db/migrate/20160124234712_extend_pods.rb
+3
-3
db/migrate/20160225232049_link_share_visibilities_with_user.rb
...grate/20160225232049_link_share_visibilities_with_user.rb
+1
-1
db/migrate/20160302025129_cleanup_aspect_visibility.rb
db/migrate/20160302025129_cleanup_aspect_visibility.rb
+1
-1
db/migrate/20160618033455_cleanup_participations.rb
db/migrate/20160618033455_cleanup_participations.rb
+1
-1
db/migrate/20160720212620_create_signature_tables.rb
db/migrate/20160720212620_create_signature_tables.rb
+1
-1
db/migrate/20160807212443_participation_counter.rb
db/migrate/20160807212443_participation_counter.rb
+5
-5
db/migrate/20160810230114_cleanup_invitation_columns_from_users.rb
...e/20160810230114_cleanup_invitation_columns_from_users.rb
+2
-2
db/migrate/20160822212739_remove_started_sharing_notifications_without_contact.rb
...9_remove_started_sharing_notifications_without_contact.rb
+1
-1
db/migrate/20160902180630_remove_invalid_unconfirmed_emails.rb
...grate/20160902180630_remove_invalid_unconfirmed_emails.rb
+1
-1
db/migrate/20160906225138_fix_photos_share_visibilities.rb
db/migrate/20160906225138_fix_photos_share_visibilities.rb
+2
-2
db/migrate/20161107100840_polymorphic_mentions.rb
db/migrate/20161107100840_polymorphic_mentions.rb
+2
-2
lib/share_visibility_converter.rb
lib/share_visibility_converter.rb
+6
-6
No files found.
app/models/account_deletion.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
AccountDeletion
<
A
ctiveRecord
::
Base
class
AccountDeletion
<
A
pplicationRecord
include
Diaspora
::
Federated
::
Base
scope
:uncompleted
,
->
{
where
(
'completed_at is null'
)
}
...
...
app/models/api/openid_connect/authorization.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
module
Api
module
OpenidConnect
class
Authorization
<
A
ctiveRecord
::
Base
class
Authorization
<
A
pplicationRecord
belongs_to
:user
belongs_to
:o_auth_application
...
...
app/models/api/openid_connect/o_auth_access_token.rb
View file @
eb19c327
...
...
@@ -23,7 +23,7 @@
module
Api
module
OpenidConnect
class
OAuthAccessToken
<
A
ctiveRecord
::
Base
class
OAuthAccessToken
<
A
pplicationRecord
belongs_to
:authorization
before_validation
:setup
,
on: :create
...
...
app/models/api/openid_connect/o_auth_application.rb
View file @
eb19c327
...
...
@@ -25,7 +25,7 @@ require "digest"
module
Api
module
OpenidConnect
class
OAuthApplication
<
A
ctiveRecord
::
Base
class
OAuthApplication
<
A
pplicationRecord
has_many
:authorizations
,
dependent: :destroy
has_many
:user
,
through: :authorizations
...
...
app/models/api/openid_connect/pairwise_pseudonymous_identifier.rb
View file @
eb19c327
...
...
@@ -23,7 +23,7 @@
module
Api
module
OpenidConnect
class
PairwisePseudonymousIdentifier
<
A
ctiveRecord
::
Base
class
PairwisePseudonymousIdentifier
<
A
pplicationRecord
self
.
table_name
=
"ppid"
belongs_to
:o_auth_application
...
...
app/models/application_record.rb
0 → 100644
View file @
eb19c327
class
ApplicationRecord
<
ActiveRecord
::
Base
self
.
abstract_class
=
true
end
app/models/aspect.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
Aspect
<
A
ctiveRecord
::
Base
class
Aspect
<
A
pplicationRecord
belongs_to
:user
has_many
:aspect_memberships
,
:dependent
=>
:destroy
...
...
app/models/aspect_membership.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
AspectMembership
<
A
ctiveRecord
::
Base
class
AspectMembership
<
A
pplicationRecord
belongs_to
:aspect
belongs_to
:contact
...
...
app/models/aspect_visibility.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
AspectVisibility
<
A
ctiveRecord
::
Base
class
AspectVisibility
<
A
pplicationRecord
belongs_to
:aspect
validates
:aspect
,
:presence
=>
true
...
...
app/models/block.rb
View file @
eb19c327
class
Block
<
A
ctiveRecord
::
Base
class
Block
<
A
pplicationRecord
belongs_to
:person
belongs_to
:user
...
...
app/models/comment.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
Comment
<
A
ctiveRecord
::
Base
class
Comment
<
A
pplicationRecord
include
Diaspora
::
Federated
::
Base
include
Diaspora
::
Fields
::
Guid
...
...
app/models/comment_signature.rb
View file @
eb19c327
class
CommentSignature
<
A
ctiveRecord
::
Base
class
CommentSignature
<
A
pplicationRecord
include
Diaspora
::
Signature
self
.
primary_key
=
:comment_id
...
...
app/models/contact.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
Contact
<
A
ctiveRecord
::
Base
class
Contact
<
A
pplicationRecord
include
Diaspora
::
Federated
::
Base
belongs_to
:user
...
...
app/models/conversation.rb
View file @
eb19c327
class
Conversation
<
A
ctiveRecord
::
Base
class
Conversation
<
A
pplicationRecord
include
Diaspora
::
Federated
::
Base
include
Diaspora
::
Fields
::
Guid
include
Diaspora
::
Fields
::
Author
...
...
app/models/conversation_visibility.rb
View file @
eb19c327
class
ConversationVisibility
<
A
ctiveRecord
::
Base
class
ConversationVisibility
<
A
pplicationRecord
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
...
...
app/models/invitation_code.rb
View file @
eb19c327
class
InvitationCode
<
A
ctiveRecord
::
Base
class
InvitationCode
<
A
pplicationRecord
belongs_to
:user
validates_presence_of
:user
...
...
app/models/like.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
Like
<
A
ctiveRecord
::
Base
class
Like
<
A
pplicationRecord
include
Diaspora
::
Federated
::
Base
include
Diaspora
::
Fields
::
Guid
include
Diaspora
::
Fields
::
Author
...
...
app/models/like_signature.rb
View file @
eb19c327
class
LikeSignature
<
A
ctiveRecord
::
Base
class
LikeSignature
<
A
pplicationRecord
include
Diaspora
::
Signature
self
.
primary_key
=
:like_id
...
...
app/models/location.rb
View file @
eb19c327
class
Location
<
A
ctiveRecord
::
Base
class
Location
<
A
pplicationRecord
before_validation
:split_coords
,
on: :create
validates_presence_of
:lat
,
:lng
...
...
app/models/mention.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
Mention
<
A
ctiveRecord
::
Base
class
Mention
<
A
pplicationRecord
belongs_to
:mentions_container
,
polymorphic:
true
belongs_to
:person
validates
:mentions_container
,
presence:
true
...
...
app/models/message.rb
View file @
eb19c327
class
Message
<
A
ctiveRecord
::
Base
class
Message
<
A
pplicationRecord
include
Diaspora
::
Federated
::
Base
include
Diaspora
::
Fields
::
Guid
include
Diaspora
::
Fields
::
Author
...
...
app/models/notification.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
#
class
Notification
<
A
ctiveRecord
::
Base
class
Notification
<
A
pplicationRecord
belongs_to
:recipient
,
class_name:
"User"
has_many
:notification_actors
,
dependent: :destroy
has_many
:actors
,
class_name:
"Person"
,
through: :notification_actors
,
source: :person
...
...
app/models/notification_actor.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
NotificationActor
<
A
ctiveRecord
::
Base
class
NotificationActor
<
A
pplicationRecord
belongs_to
:notification
belongs_to
:person
...
...
app/models/o_embed_cache.rb
View file @
eb19c327
class
OEmbedCache
<
A
ctiveRecord
::
Base
class
OEmbedCache
<
A
pplicationRecord
serialize
:data
validates
:data
,
:presence
=>
true
...
...
app/models/open_graph_cache.rb
View file @
eb19c327
class
OpenGraphCache
<
A
ctiveRecord
::
Base
class
OpenGraphCache
<
A
pplicationRecord
validates
:title
,
:presence
=>
true
validates
:ob_type
,
:presence
=>
true
validates
:image
,
:presence
=>
true
...
...
app/models/participation.rb
View file @
eb19c327
class
Participation
<
A
ctiveRecord
::
Base
class
Participation
<
A
pplicationRecord
include
Diaspora
::
Federated
::
Base
include
Diaspora
::
Fields
::
Guid
include
Diaspora
::
Fields
::
Author
...
...
app/models/person.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
Person
<
A
ctiveRecord
::
Base
class
Person
<
A
pplicationRecord
include
Diaspora
::
Fields
::
Guid
# NOTE API V1 to be extracted
...
...
app/models/photo.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
Photo
<
A
ctiveRecord
::
Base
class
Photo
<
A
pplicationRecord
include
Diaspora
::
Federated
::
Base
include
Diaspora
::
Commentable
include
Diaspora
::
Shareable
...
...
app/models/pod.rb
View file @
eb19c327
class
Pod
<
A
ctiveRecord
::
Base
class
Pod
<
A
pplicationRecord
enum
status:
%i(
unchecked
no_errors
...
...
app/models/poll.rb
View file @
eb19c327
class
Poll
<
A
ctiveRecord
::
Base
class
Poll
<
A
pplicationRecord
include
Diaspora
::
Federated
::
Base
include
Diaspora
::
Fields
::
Guid
...
...
app/models/poll_answer.rb
View file @
eb19c327
class
PollAnswer
<
A
ctiveRecord
::
Base
class
PollAnswer
<
A
pplicationRecord
include
Diaspora
::
Federated
::
Base
include
Diaspora
::
Fields
::
Guid
...
...
app/models/poll_participation.rb
View file @
eb19c327
class
PollParticipation
<
A
ctiveRecord
::
Base
class
PollParticipation
<
A
pplicationRecord
include
Diaspora
::
Federated
::
Base
include
Diaspora
::
Fields
::
Guid
include
Diaspora
::
Fields
::
Author
...
...
app/models/poll_participation_signature.rb
View file @
eb19c327
class
PollParticipationSignature
<
A
ctiveRecord
::
Base
class
PollParticipationSignature
<
A
pplicationRecord
include
Diaspora
::
Signature
self
.
primary_key
=
:poll_participation_id
...
...
app/models/post.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
Post
<
A
ctiveRecord
::
Base
class
Post
<
A
pplicationRecord
self
.
include_root_in_json
=
false
include
ApplicationHelper
...
...
app/models/profile.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
Profile
<
A
ctiveRecord
::
Base
class
Profile
<
A
pplicationRecord
self
.
include_root_in_json
=
false
include
Diaspora
::
Federated
::
Base
...
...
app/models/report.rb
View file @
eb19c327
class
Report
<
A
ctiveRecord
::
Base
class
Report
<
A
pplicationRecord
validates
:user_id
,
presence:
true
validates
:item_id
,
presence:
true
validates
:item_type
,
presence:
true
,
inclusion:
{
...
...
app/models/role.rb
View file @
eb19c327
# NOTE add the person object you want to attach role to...
class
Role
<
A
ctiveRecord
::
Base
class
Role
<
A
pplicationRecord
belongs_to
:person
validates
:person
,
presence:
true
...
...
app/models/service.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
Service
<
A
ctiveRecord
::
Base
class
Service
<
A
pplicationRecord
attr_accessor
:provider
,
:info
,
:access_level
belongs_to
:user
...
...
app/models/share_visibility.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
ShareVisibility
<
A
ctiveRecord
::
Base
class
ShareVisibility
<
A
pplicationRecord
belongs_to
:user
belongs_to
:shareable
,
polymorphic: :true
...
...
app/models/signature_order.rb
View file @
eb19c327
class
SignatureOrder
<
A
ctiveRecord
::
Base
class
SignatureOrder
<
A
pplicationRecord
validates
:order
,
presence:
true
,
uniqueness:
true
end
app/models/tag_following.rb
View file @
eb19c327
class
TagFollowing
<
A
ctiveRecord
::
Base
class
TagFollowing
<
A
pplicationRecord
belongs_to
:user
belongs_to
:tag
,
:class_name
=>
"ActsAsTaggableOn::Tag"
...
...
app/models/user.rb
View file @
eb19c327
...
...
@@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class
User
<
A
ctiveRecord
::
Base
class
User
<
A
pplicationRecord
include
AuthenticationToken
include
Connecting
include
Querying
...
...
app/models/user_preference.rb
View file @
eb19c327
class
UserPreference
<
A
ctiveRecord
::
Base
class
UserPreference
<
A
pplicationRecord
belongs_to
:user
validate
:must_be_valid_email_type
...
...
db/migrate/20130717104359_migrate_activity_stream_to_status_message.rb
View file @
eb19c327
class
MigrateActivityStreamToStatusMessage
<
ActiveRecord
::
Migration
class
Post
<
A
ctiveRecord
::
Base
;
self
.
inheritance_column
=
false
;
end
class
Post
<
A
pplicationRecord
;
self
.
inheritance_column
=
false
;
end
def
up
posts_stream_photos
=
Post
.
where
(
type:
'ActivityStreams::Photo'
)
posts_stream_photos
.
each
do
|
p
|
...
...
db/migrate/20160124234712_extend_pods.rb
View file @
eb19c327
class
ExtendPods
<
ActiveRecord
::
Migration
class
Pod
<
A
ctiveRecord
::
Base
class
Pod
<
A
pplicationRecord
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
<
A
ctiveRecord
::
Base
class
Person
<
A
pplicationRecord
belongs_to
:owner
,
class_name:
"User"
belongs_to
:pod
...
...
@@ -27,7 +27,7 @@ class ExtendPods < ActiveRecord::Migration
end
end
class
User
<
A
ctiveRecord
::
Base
class
User
<
A
pplicationRecord
has_one
:person
,
inverse_of: :owner
,
foreign_key: :owner_id
end
...
...
db/migrate/20160225232049_link_share_visibilities_with_user.rb
View file @
eb19c327
class
LinkShareVisibilitiesWithUser
<
ActiveRecord
::
Migration
class
ShareVisibility
<
A
ctiveRecord
::
Base
class
ShareVisibility
<
A
pplicationRecord
end
def
up
...
...
db/migrate/20160302025129_cleanup_aspect_visibility.rb
View file @
eb19c327
class
CleanupAspectVisibility
<
ActiveRecord
::
Migration
class
AspectVisibility
<
A
ctiveRecord
::
Base
class
AspectVisibility
<
A
pplicationRecord
end
def
up
...
...
db/migrate/20160618033455_cleanup_participations.rb
View file @
eb19c327
class
CleanupParticipations
<
ActiveRecord
::
Migration
class
Participation
<
A
ctiveRecord
::
Base
class
Participation
<
A
pplicationRecord
end
def
up
...
...
db/migrate/20160720212620_create_signature_tables.rb
View file @
eb19c327
class
CreateSignatureTables
<
ActiveRecord
::
Migration
class
SignatureOrder
<
A
ctiveRecord
::
Base
class
SignatureOrder
<
A
pplicationRecord
end
RELAYABLES
=
%i(comment like poll_participation)
.
freeze
...
...
db/migrate/20160807212443_participation_counter.rb
View file @
eb19c327
class
ParticipationCounter
<
ActiveRecord
::
Migration
class
Comment
<
A
ctiveRecord
::
Base
class
Comment
<
A
pplicationRecord
end
class
Like
<
A
ctiveRecord
::
Base
class
Like
<
A
pplicationRecord
end
class
Participation
<
A
ctiveRecord
::
Base
class
Participation
<
A
pplicationRecord
belongs_to
:author
,
class_name:
"Person"
end
class
Poll
<
A
ctiveRecord
::
Base
class
Poll
<
A
pplicationRecord
end
class
PollParticipation
<
A
ctiveRecord
::
Base
class
PollParticipation
<
A
pplicationRecord
belongs_to
:poll
end
...
...
db/migrate/20160810230114_cleanup_invitation_columns_from_users.rb
View file @
eb19c327
class
CleanupInvitationColumnsFromUsers
<
ActiveRecord
::
Migration
class
InvitationCode
<
A
ctiveRecord
::
Base
class
InvitationCode
<
A
pplicationRecord
end
class
User
<
A
ctiveRecord
::
Base
class
User
<
A
pplicationRecord
end
def
change
...
...
db/migrate/20160822212739_remove_started_sharing_notifications_without_contact.rb
View file @
eb19c327
class
RemoveStartedSharingNotificationsWithoutContact
<
ActiveRecord
::
Migration
class
Notification
<
A
ctiveRecord
::
Base
class
Notification
<
A
pplicationRecord
end
def
up
...
...
db/migrate/20160902180630_remove_invalid_unconfirmed_emails.rb
View file @
eb19c327
class
RemoveInvalidUnconfirmedEmails
<
ActiveRecord
::
Migration
class
User
<
A
ctiveRecord
::
Base
class
User
<
A
pplicationRecord
end
def
up
...
...
db/migrate/20160906225138_fix_photos_share_visibilities.rb
View file @
eb19c327
class
FixPhotosShareVisibilities
<
ActiveRecord
::
Migration
class
Photo
<
A
ctiveRecord
::
Base
class
Photo
<
A
pplicationRecord
end
class
ShareVisibility
<
A
ctiveRecord
::
Base
class
ShareVisibility
<
A
pplicationRecord
end
def
up
...
...
db/migrate/20161107100840_polymorphic_mentions.rb
View file @
eb19c327
...
...
@@ -17,10 +17,10 @@ class PolymorphicMentions < ActiveRecord::Migration
reversible
(
&
method
(
:up_down
))
end
class
Mention
<
A
ctiveRecord
::
Base
class
Mention
<
A
pplicationRecord
end
class
Notification
<
A
ctiveRecord
::
Base
class
Notification
<
A
pplicationRecord
end
def
up_down
(
change
)
...
...
lib/share_visibility_converter.rb
View file @
eb19c327
#we dont have the environment, and it is not carring over from the migration
unless
defined?
(
Person
)
class
Person
<
A
ctiveRecord
::
Base
class
Person
<
A
pplicationRecord
belongs_to
:owner
,
:class_name
=>
'User'
end
end
unless
defined?
(
User
)
class
User
<
A
ctiveRecord
::
Base
class
User
<
A
pplicationRecord
serialize
:hidden_shareables
,
Hash
end
end
unless
defined?
(
Contact
)
class
Contact
<
A
ctiveRecord
::
Base
class
Contact
<
A
pplicationRecord
belongs_to
:user
end
end
unless
defined?
(
ShareVisibility
)
class
ShareVisibility
<
A
ctiveRecord
::
Base
class
ShareVisibility
<
A
pplicationRecord
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment