DG IZ albums are now posts
This commit is contained in:
parent
516a667ce4
commit
803de25cc0
2 changed files with 2 additions and 37 deletions
|
|
@ -1,16 +1,8 @@
|
||||||
class Album
|
class Album < Post
|
||||||
require 'lib/diaspora/webhooks'
|
|
||||||
include MongoMapper::Document
|
|
||||||
include ROXML
|
|
||||||
include Diaspora::Webhooks
|
|
||||||
include Encryptable
|
|
||||||
|
|
||||||
xml_reader :name
|
xml_reader :name
|
||||||
xml_reader :person, :as => Person
|
|
||||||
xml_reader :_id
|
|
||||||
key :name, String
|
key :name, String
|
||||||
|
|
||||||
belongs_to :person, :class_name => 'Person'
|
|
||||||
many :photos, :class_name => 'Photo', :foreign_key => :album_id
|
many :photos, :class_name => 'Photo', :foreign_key => :album_id
|
||||||
|
|
||||||
timestamps!
|
timestamps!
|
||||||
|
|
@ -19,11 +11,6 @@ class Album
|
||||||
|
|
||||||
before_destroy :destroy_photos
|
before_destroy :destroy_photos
|
||||||
|
|
||||||
before_destroy :propagate_retraction
|
|
||||||
|
|
||||||
def self.instantiate params
|
|
||||||
self.create params
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.mine_or_friends(friend_param, current_user)
|
def self.mine_or_friends(friend_param, current_user)
|
||||||
if friend_param
|
if friend_param
|
||||||
|
|
@ -44,30 +31,9 @@ class Album
|
||||||
p_photo ? p_photo : self.photos.sort(:created_at.desc).last
|
p_photo ? p_photo : self.photos.sort(:created_at.desc).last
|
||||||
end
|
end
|
||||||
|
|
||||||
#ENCRYPTION
|
|
||||||
xml_accessor :creator_signature
|
|
||||||
key :creator_signature, String
|
|
||||||
|
|
||||||
def signable_accessors
|
|
||||||
accessors = self.class.roxml_attrs.collect{|definition|
|
|
||||||
definition.accessor}
|
|
||||||
accessors.delete 'person'
|
|
||||||
accessors.delete 'creator_signature'
|
|
||||||
accessors
|
|
||||||
end
|
|
||||||
|
|
||||||
def signable_string
|
|
||||||
signable_accessors.collect{|accessor|
|
|
||||||
(self.send accessor.to_sym).to_s}.join ';'
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
def destroy_photos
|
def destroy_photos
|
||||||
photos.each{|p| p.destroy}
|
self.photos.each{|p| p.destroy}
|
||||||
end
|
end
|
||||||
|
|
||||||
def propagate_retraction
|
|
||||||
self.person.owner.retract(self)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
class StatusMessage < Post
|
class StatusMessage < Post
|
||||||
#include StatusMessagesHelper
|
|
||||||
|
|
||||||
xml_name :status_message
|
xml_name :status_message
|
||||||
xml_accessor :message
|
xml_accessor :message
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue