make status message controller spec pass and deprecation free
This commit is contained in:
parent
2cca5745c9
commit
a9e107364a
6 changed files with 6 additions and 5 deletions
|
|
@ -26,6 +26,8 @@ class Post < ActiveRecord::Base
|
|||
belongs_to :o_embed_cache
|
||||
belongs_to :open_graph_cache
|
||||
|
||||
validates_uniqueness_of :id
|
||||
|
||||
after_commit :on => :create do
|
||||
self.touch(:interacted_at)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class StatusMessage < Post
|
|||
|
||||
def attach_photos_by_ids(photo_ids)
|
||||
return [] unless photo_ids.present?
|
||||
self.photos << Photo.where(:id => photo_ids, :author_id => self.author_id).all
|
||||
self.photos << Photo.where(:id => photo_ids, :author_id => self.author_id)
|
||||
end
|
||||
|
||||
def nsfw
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def unread_message_count
|
||||
ConversationVisibility.sum(:unread, :conditions => "person_id = #{self.person.id}")
|
||||
ConversationVisibility.where(person_id: self.person_id).sum(:unread)
|
||||
end
|
||||
|
||||
#@deprecated
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ module Workers
|
|||
user = User.find(user_id)
|
||||
object = object_class_name.constantize.find(object_id)
|
||||
opts = HashWithIndifferentAccess.new(opts)
|
||||
opts[:services] = user.services.where(:type => opts.delete(:service_types)).all
|
||||
opts[:services] = user.services.where(:type => opts.delete(:service_types))
|
||||
|
||||
if opts[:additional_subscribers].present?
|
||||
opts[:additional_subscribers] = Person.where(:id => opts[:additional_subscribers])
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module Diaspora
|
|||
def self.included(model)
|
||||
model.instance_eval do
|
||||
|
||||
has_many :aspect_visibilities, :as => :shareable
|
||||
has_many :aspect_visibilities, :as => :shareable, :validate => false
|
||||
has_many :aspects, :through => :aspect_visibilities
|
||||
|
||||
has_many :share_visibilities, :as => :shareable
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ class User
|
|||
|
||||
p = build_post(class_name, opts)
|
||||
p.aspects = aspects
|
||||
|
||||
if p.save!
|
||||
self.aspects.reload
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue