Class: Reshare

Inherits:
Post show all
Defined in:
app/models/reshare.rb

Overview

Copyright © 2010-2011, Diaspora Inc. This file is

licensed under the Affero General Public License version 3 or later.  See
the COPYRIGHT file.

Instance Attribute Summary

Attributes inherited from Post

#user_like

Instance Method Summary collapse

Methods inherited from Post

#address, diaspora_initialize, excluding_blocks, excluding_hidden_content, excluding_hidden_shareables, for_a_stream, #like_for, #nsfw, #post_type, #reshare_for, #root, #update_reshares_counter

Methods included from Diaspora::MentionsContainer

#add_mention_subscribers?, #create_mentions, #message

Methods included from Diaspora::Shareable

included, #subscribed_pods_uris

Methods included from Diaspora::Commentable

#comments_authors, included, #last_three_comments, #update_comments_counter

Methods included from Diaspora::Likeable

included, #update_likes_counter

Methods included from Diaspora::Federated::Base

#object_to_receive

Methods included from ApplicationHelper

#all_services_connected?, #bookmarklet_code, #changelog_url, #donations_enabled?, #jquery_include_tag, #pod_name, #pod_version, #popover_with_close_html, #qrcode_uri, #service_unconnected?, #source_url, #timeago

Instance Method Details

#absolute_rootObject


70
71
72
73
74
# File 'app/models/reshare.rb', line 70

def absolute_root
  @absolute_root ||= self
  @absolute_root = @absolute_root.root while @absolute_root.is_a? Reshare
  @absolute_root
end

#comment_email_subjectObject


66
67
68
# File 'app/models/reshare.rb', line 66

def comment_email_subject
  I18n.t('reshares.comment_email_subject', :resharer => author.name, :author => root.author_name)
end

#mentioned_peopleObject


46
47
48
# File 'app/models/reshare.rb', line 46

def mentioned_people
  absolute_root.try(:mentioned_people) || super
end

#photosObject


50
51
52
# File 'app/models/reshare.rb', line 50

def photos
  absolute_root.try(:photos) || super
end

#pollObject


62
63
64
# File 'app/models/reshare.rb', line 62

def poll
  absolute_root.try(:poll) || super
end

#post_locationObject


54
55
56
57
58
59
60
# File 'app/models/reshare.rb', line 54

def post_location
  {
    address: absolute_root.try(:location).try(:address),
    lat:     absolute_root.try(:location).try(:lat),
    lng:     absolute_root.try(:location).try(:lng)
  }
end

#receive(recipient_user_ids) ⇒ Object


76
77
78
79
80
# File 'app/models/reshare.rb', line 76

def receive(recipient_user_ids)
  super(recipient_user_ids)

  root.author.owner.participate!(self) if root.author.local?
end

#root_diaspora_idObject


34
35
36
# File 'app/models/reshare.rb', line 34

def root_diaspora_id
  root.try(:author).try(:diaspora_handle)
end

#subscribersObject


82
83
84
# File 'app/models/reshare.rb', line 82

def subscribers
  super.tap {|people| root.try {|root| people << root.author } }
end

#textObject


42
43
44
# File 'app/models/reshare.rb', line 42

def text
  absolute_root.try(:text) || ""
end