* Throw away old system * Add new system * Add new example files * Replace all calls * add the most important docs * Add Specs * rename disable_ssl_requirement to require_ssl * cloudfiles isn't used/called in our code * since community_spotlight.list is only used as enable flag replace it with such one and remove all legacy and irelevant codepaths around it * die if session secret is unset and on heroku * First basic infrastructure for version information
31 lines
1,007 B
Ruby
31 lines
1,007 B
Ruby
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
|
# licensed under the Affero General Public License version 3 or later. See
|
|
# the COPYRIGHT file.
|
|
|
|
class Service < ActiveRecord::Base
|
|
include ActionView::Helpers::TextHelper
|
|
|
|
belongs_to :user
|
|
validates_uniqueness_of :uid, :scope => :type
|
|
|
|
def self.titles(service_strings)
|
|
service_strings.map{|s| "Services::#{s.titleize}"}
|
|
end
|
|
|
|
def public_message(post, length, url = "")
|
|
Rails.logger.info("Posting out to #{self.class}")
|
|
url = Rails.application.routes.url_helpers.short_post_url(post, :protocol => AppConfig.pod_uri.scheme, :host => AppConfig.pod_uri.authority)
|
|
space_for_url = 21 + 1
|
|
truncated = truncate(post.text(:plain_text => true), :length => (length - space_for_url))
|
|
truncated = "#{truncated} #{url}"
|
|
return truncated
|
|
end
|
|
|
|
|
|
def profile_photo_url
|
|
nil
|
|
end
|
|
|
|
end
|
|
require Rails.root.join('app', 'models', 'services', 'facebook')
|
|
require Rails.root.join('app', 'models', 'services', 'twitter')
|