Class: Reshare

Inherits:
Post
  • Object
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

#activity_streams?, diaspora_initialize, excluding_blocks, excluding_hidden_content, excluding_hidden_shareables, find_by_guid_or_id_with_user, for_a_stream, #like_for, #mutable?, newer, #nsfw, older, #poll, #post_type, #reshare_for, #root, visible_from_author

Methods included from Diaspora::Shareable

included, #update_reshares_counter

Methods included from Diaspora::Commentable

included, #last_three_comments, #update_comments_counter

Methods included from Diaspora::Likeable

included, #update_likes_counter

Methods included from Diaspora::Federated::Shareable

included

Methods included from ApplicationHelper

#all_services_connected?, #bookmarklet, #changelog_url, #contacts_link, #jquery_include_tag, #magic_bookmarklet_link, #pod_name, #pod_version, #popover_with_close_html, #raw_bookmarklet, #timeago

Instance Method Details

#absolute_rootObject


68
69
70
71
72
# File 'app/models/reshare.rb', line 68

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

#addressObject


48
49
50
# File 'app/models/reshare.rb', line 48

def address
  absolute_root.try(:location).try(:address)
end

#comment_email_subjectObject


60
61
62
# File 'app/models/reshare.rb', line 60

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

#mentioned_peopleObject


40
41
42
# File 'app/models/reshare.rb', line 40

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

#notification_type(user, person) ⇒ Object


64
65
66
# File 'app/models/reshare.rb', line 64

def notification_type(user, person)
  Notifications::Reshared if root.author == user.person
end

#photosObject


44
45
46
# File 'app/models/reshare.rb', line 44

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

#raw_messageObject


36
37
38
# File 'app/models/reshare.rb', line 36

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

#receive(recipient, sender) ⇒ Object


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

def receive(recipient, sender)
  local_reshare = Reshare.where(:guid => self.guid).first
  if local_reshare && local_reshare.root.author_id == recipient.person.id
    return unless recipient.has_contact_for?(sender)
  end
  super(recipient, sender)
end

#root_diaspora_idObject


28
29
30
# File 'app/models/reshare.rb', line 28

def root_diaspora_id
  self.root.author.diaspora_handle
end