Skip to content
Extraits de code Groupes Projets
service.rb 857 octets
Newer Older
  • Learn to ignore specific revisions
  • maxwell's avatar
    maxwell a validé
    #   Copyright (c) 2010, Diaspora Inc.  This file is
    #   licensed under the Affero General Public License version 3 or later.  See
    #   the COPYRIGHT file.
    
    
    maxwell's avatar
    maxwell a validé
      include MongoMapper::Document
    
    maxwell's avatar
    maxwell a validé
      include ActionView::Helpers::TextHelper
    
    maxwell's avatar
    maxwell a validé
      belongs_to :user
    
      key :provider, String
      key :uid, String
    
      key :access_token, String
      key :access_secret, String
      key :nickname, String
    
    Raphael's avatar
    Raphael a validé
      timestamps!
    
    maxwell's avatar
    maxwell a validé
      def public_message(post, length, url = "")
    
        url = "" if post.respond_to?(:photos) && post.photos.count == 0
    
        space_for_url = url.blank? ? 0 : (url.length + 1)
    
    maxwell's avatar
    maxwell a validé
        truncated = truncate(post.message, :length => (length - space_for_url))
    
        truncated = "#{truncated} #{url}" unless url.blank?
        return truncated
      end
    
    maxwell's avatar
    maxwell a validé
    end
    
    MrZYX's avatar
    MrZYX a validé
    require File.join(Rails.root, 'app/models/services/facebook')
    require File.join(Rails.root, 'app/models/services/twitter')