Merge almost complete, 4 failures
This commit is contained in:
commit
738e8c65c8
288 changed files with 6407 additions and 4675 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -19,6 +19,7 @@ public/stylesheets/application.css
|
|||
public/stylesheets/sessions.css
|
||||
public/stylesheets/ui.css
|
||||
public/stylesheets/mobile.css
|
||||
public/diaspora
|
||||
spec/fixtures/users.yaml
|
||||
|
||||
# Uploded files and local files
|
||||
|
|
|
|||
25
Gemfile
25
Gemfile
|
|
@ -4,9 +4,9 @@ gem 'mysql2'
|
|||
gem 'rails', '3.0.3'
|
||||
|
||||
gem 'bundler', '>= 1.0.0'
|
||||
gem "chef", :require => false
|
||||
gem 'chef', :require => false
|
||||
|
||||
gem "nokogiri", "1.4.3.1"
|
||||
gem 'nokogiri', '1.4.3.1'
|
||||
|
||||
#Security
|
||||
gem 'devise', '1.1.3'
|
||||
|
|
@ -26,12 +26,7 @@ gem 'addressable', :require => 'addressable/uri'
|
|||
gem 'json'
|
||||
gem 'http_accept_language', :git => 'git://github.com/iain/http_accept_language.git'
|
||||
|
||||
#Standards
|
||||
gem 'pubsubhubbub'
|
||||
|
||||
#EventMachine
|
||||
gem 'em-http-request',:ref => 'bf62d67fc72d6e701be5', :git => 'git://github.com/igrigorik/em-http-request.git', :require => 'em-http'
|
||||
gem 'thin'
|
||||
gem 'thin', :require => false
|
||||
|
||||
#Websocket
|
||||
gem 'em-websocket', :git => 'git://github.com/igrigorik/em-websocket'
|
||||
|
|
@ -44,16 +39,16 @@ gem 'fastercsv', :require => false
|
|||
gem 'jammit'
|
||||
gem 'rest-client'
|
||||
#Backups
|
||||
gem "cloudfiles", :require => false
|
||||
gem 'cloudfiles', :require => false
|
||||
|
||||
#Queue
|
||||
gem 'resque'
|
||||
gem 'SystemTimer' unless RUBY_VERSION.include? "1.9"
|
||||
gem 'SystemTimer' unless RUBY_VERSION.include? '1.9'
|
||||
|
||||
group :test, :development do
|
||||
gem 'factory_girl_rails', :require => false
|
||||
gem 'ruby-debug19' if RUBY_VERSION.include? "1.9"
|
||||
gem 'ruby-debug' if RUBY_VERSION.include? "1.8"
|
||||
gem 'ruby-debug19' if RUBY_VERSION.include? '1.9'
|
||||
gem 'ruby-debug' if RUBY_VERSION.include? '1.8'
|
||||
gem 'launchy'
|
||||
end
|
||||
|
||||
|
|
@ -67,10 +62,6 @@ group :test do
|
|||
gem 'database_cleaner', '0.5.2'
|
||||
gem 'webmock', :require => false
|
||||
gem 'jasmine', :path => 'vendor/gems/jasmine', :require => false
|
||||
gem 'mongrel', :require => false if RUBY_VERSION.include? "1.8"
|
||||
gem 'mongrel', :require => false if RUBY_VERSION.include? '1.8'
|
||||
gem 'rspec-instafail', :require => false
|
||||
end
|
||||
|
||||
group :deployment do
|
||||
#gem 'sprinkle', :git => 'git://github.com/rsofaer/sprinkle.git'
|
||||
end
|
||||
|
|
|
|||
14
Gemfile.lock
14
Gemfile.lock
|
|
@ -12,15 +12,6 @@ GIT
|
|||
specs:
|
||||
http_accept_language (1.0.1)
|
||||
|
||||
GIT
|
||||
remote: git://github.com/igrigorik/em-http-request.git
|
||||
revision: bf62d67fc72d6e701be5037e239dd470194b8e45
|
||||
ref: bf62d67fc72d6e701be5
|
||||
specs:
|
||||
em-http-request (0.2.13)
|
||||
addressable (>= 2.0.0)
|
||||
eventmachine (>= 0.12.9)
|
||||
|
||||
GIT
|
||||
remote: git://github.com/igrigorik/em-websocket
|
||||
revision: e278f5a1c4db60be7485859520a069e08bfe1247
|
||||
|
|
@ -253,9 +244,6 @@ GEM
|
|||
oa-oauth (= 0.1.6)
|
||||
oa-openid (= 0.1.6)
|
||||
polyglot (0.3.1)
|
||||
pubsubhubbub (0.1.1)
|
||||
em-http-request (>= 0.1.5)
|
||||
eventmachine (>= 0.12.9)
|
||||
pyu-ruby-sasl (0.0.3.2)
|
||||
rack (1.2.1)
|
||||
rack-mount (0.6.13)
|
||||
|
|
@ -365,7 +353,6 @@ DEPENDENCIES
|
|||
database_cleaner (= 0.5.2)
|
||||
devise (= 1.1.3)
|
||||
devise_invitable (= 0.3.5)
|
||||
em-http-request!
|
||||
em-websocket!
|
||||
factory_girl_rails
|
||||
fastercsv
|
||||
|
|
@ -381,7 +368,6 @@ DEPENDENCIES
|
|||
mysql2
|
||||
nokogiri (= 1.4.3.1)
|
||||
omniauth (= 0.1.6)
|
||||
pubsubhubbub
|
||||
rails (= 3.0.3)
|
||||
resque
|
||||
rest-client
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
# has_mobile_fu
|
||||
#has_mobile_fu
|
||||
protect_from_forgery :except => :receive
|
||||
|
||||
# before_filter :mobile_except_ipad
|
||||
#before_filter :mobile_except_ipad
|
||||
before_filter :set_contacts_notifications_and_status, :except => [:create, :update]
|
||||
before_filter :count_requests
|
||||
before_filter :set_invites
|
||||
|
|
@ -15,8 +15,9 @@ class ApplicationController < ActionController::Base
|
|||
def set_contacts_notifications_and_status
|
||||
if user_signed_in?
|
||||
@aspect = nil
|
||||
@aspects = current_user.aspects
|
||||
@aspects_dropdown_array = @aspects.collect{|x| [x.to_s, x.id]}
|
||||
@object_aspect_ids = []
|
||||
@all_aspects = current_user.aspects
|
||||
@aspects_dropdown_array = @all_aspects.collect{|x| [x.to_s, x.id]}
|
||||
@notification_count = Notification.for(current_user, :unread =>true).count
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,16 +10,31 @@ class AspectsController < ApplicationController
|
|||
respond_to :js
|
||||
|
||||
def index
|
||||
@posts = current_user.visible_posts(:type => "StatusMessage").paginate :page => params[:page], :per_page => 15
|
||||
@post_hashes = hashes_for_posts @posts
|
||||
@contacts = current_user.contacts.where(:pending => false)
|
||||
@aspect_hashes = hashes_for_aspects @aspects.all, @contacts, :limit => 8
|
||||
@aspect = :all
|
||||
if params[:a_ids]
|
||||
@aspects = current_user.aspects_from_ids(params[:a_ids])
|
||||
else
|
||||
@aspects = current_user.aspects
|
||||
end
|
||||
|
||||
@contact_hashes = hashes_for_contacts @contacts
|
||||
|
||||
if current_user.getting_started == true
|
||||
# redirect to signup
|
||||
if current_user.getting_started == true || @aspects.blank?
|
||||
redirect_to getting_started_path
|
||||
else
|
||||
|
||||
@aspect_ids = @aspects.map{|a| a.id}
|
||||
post_ids = @aspects.map{|a| a.post_ids}.flatten!
|
||||
|
||||
@posts = Post.where(:id => post_ids, :type => "StatusMessage").paginate(
|
||||
:page => params[:page], :per_page => 15, :order => 'created_at DESC')
|
||||
@post_hashes = hashes_for_posts @posts
|
||||
|
||||
@contacts = Contact.joins(:aspect_memberships).where(
|
||||
:aspect_memberships => {:aspect_id => @aspect_ids}, :user_id => current_user.id, :pending => false)
|
||||
@contact_hashes = hashes_for_contacts @contacts
|
||||
@aspect_hashes = hashes_for_aspects @aspects, @contacts, :limit => 16
|
||||
|
||||
@aspect = :all unless params[:a_ids]
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -50,7 +65,7 @@ class AspectsController < ApplicationController
|
|||
begin
|
||||
current_user.drop_aspect @aspect
|
||||
flash[:notice] = I18n.t 'aspects.destroy.success',:name => @aspect.name
|
||||
redirect_to root_url
|
||||
redirect_to :back
|
||||
rescue RuntimeError => e
|
||||
flash[:error] = e.message
|
||||
redirect_to :back
|
||||
|
|
@ -59,23 +74,22 @@ class AspectsController < ApplicationController
|
|||
|
||||
def show
|
||||
@aspect = current_user.aspects.where(:id => params[:id]).first
|
||||
redirect_to aspects_path('a_ids[]' => @aspect.id)
|
||||
end
|
||||
|
||||
def edit
|
||||
@aspect = current_user.aspect_by_id params[:id]
|
||||
@contacts = current_user.contacts.where(:pending => false)
|
||||
unless @aspect
|
||||
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
|
||||
else
|
||||
@aspect_contacts = hashes_for_contacts Contact.joins(:aspect_memberships).where(
|
||||
:user_id => current_user.id,
|
||||
:pending => false,
|
||||
:aspect_memberships => {:aspect_id => @aspect.id})
|
||||
@aspect_ids = [@aspect.id]
|
||||
@aspect_contacts = hashes_for_contacts Contact.all(:user_id => current_user.id, :aspect_ids.in => [@aspect.id], :pending => false)
|
||||
@aspect_contacts_count = @aspect_contacts.count
|
||||
|
||||
@all_contacts = hashes_for_contacts @contacts
|
||||
|
||||
@posts = @aspect.posts.where(:type => "StatusMessage").order('created_at desc').paginate :page => params[:page], :per_page => 15
|
||||
@post_hashes = hashes_for_posts @posts
|
||||
@post_count = @posts.count
|
||||
|
||||
respond_with @aspect
|
||||
render :layout => false
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -83,7 +97,7 @@ class AspectsController < ApplicationController
|
|||
@aspect = :manage
|
||||
@contacts = current_user.contacts.where(:pending => false)
|
||||
@remote_requests = Request.hashes_for_person(current_user.person)
|
||||
@aspect_hashes = hashes_for_aspects @aspects, @contacts
|
||||
@aspect_hashes = hashes_for_aspects @all_aspects, @contacts
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class CommentsController < ApplicationController
|
|||
:partial => 'comments/comment',
|
||||
:locals => { :hash => {
|
||||
:comment => @comment,
|
||||
:person => current_user,
|
||||
:person => current_user.person,
|
||||
}}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class NotificationsController < ApplicationController
|
|||
end
|
||||
|
||||
def index
|
||||
@notifications = Notification.for(current_user).limit(25)
|
||||
@notifications = Notification.for(current_user).paginate :page => params[:page], :per_page => 25
|
||||
@group_days = @notifications.group_by{|note| note.created_at.strftime("%B %d") }
|
||||
respond_with @notifications
|
||||
end
|
||||
|
|
@ -27,4 +27,5 @@ class NotificationsController < ApplicationController
|
|||
Notification.where(:recipient_id => current_user.id).update_all(:unread => false)
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class PeopleController < ApplicationController
|
|||
def index
|
||||
@aspect = :search
|
||||
|
||||
@people = Person.search(params[:q]).paginate :page => params[:page], :per_page => 25, :order => 'created_at DESC'
|
||||
@people = Person.search(params[:q]).paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC'
|
||||
if @people.count == 1
|
||||
redirect_to @people.first
|
||||
else
|
||||
|
|
@ -123,7 +123,7 @@ class PeopleController < ApplicationController
|
|||
@aspects_with_person = @contact.aspects
|
||||
end
|
||||
|
||||
@aspects_without_person = @aspects.reject do |aspect|
|
||||
@aspects_without_person = @all_aspects.reject do |aspect|
|
||||
@aspects_with_person.include?(aspect)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ class PhotosController < ApplicationController
|
|||
|
||||
if params[:photo][:aspect_ids] == "all"
|
||||
params[:photo][:aspect_ids] = current_user.aspects.collect{|x| x.id}
|
||||
elsif params[:photo][:aspect_ids].is_a?(Hash)
|
||||
params[:photo][:aspect_ids] = params[:photo][:aspect_ids].values
|
||||
end
|
||||
|
||||
params[:photo][:user_file] = file_handler(params)
|
||||
|
|
@ -54,7 +56,9 @@ class PhotosController < ApplicationController
|
|||
if @photo.save
|
||||
raise 'MongoMapper failed to catch a failed save' unless @photo.id
|
||||
|
||||
current_user.add_to_streams(@photo, params[:photo][:aspect_ids])
|
||||
|
||||
aspects = current_user.aspects_from_ids(params[:photo][:aspect_ids])
|
||||
current_user.add_to_streams(@photo, aspects)
|
||||
current_user.dispatch_post(@photo, :to => params[:photo][:aspect_ids]) unless @photo.pending
|
||||
|
||||
if params[:photo][:set_profile_photo]
|
||||
|
|
@ -148,6 +152,11 @@ class PhotosController < ApplicationController
|
|||
@parent = @photo
|
||||
end
|
||||
|
||||
@object_aspect_ids = []
|
||||
if @parent.aspects
|
||||
@object_aspect_ids = @parent.aspects.map{|a| a.id}
|
||||
end
|
||||
|
||||
comments_hash = Comment.hash_from_post_ids [@parent.id]
|
||||
person_hash = Person.from_post_comment_hash comments_hash
|
||||
@comment_hashes = comments_hash[@parent.id].map do |comment|
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class PublicsController < ApplicationController
|
|||
skip_before_filter :set_locale
|
||||
|
||||
layout false
|
||||
caches_page :host_meta
|
||||
|
||||
def hcard
|
||||
@person = Person.find_by_id params[:id]
|
||||
|
|
@ -56,7 +57,7 @@ class PublicsController < ApplicationController
|
|||
end
|
||||
|
||||
@user = person.owner
|
||||
Resque.enqueue(Jobs::ReceiveSalmon, @user.id, params[:xml])
|
||||
Resque.enqueue(Jobs::ReceiveSalmon, @user.id, CGI::unescape(params[:xml]))
|
||||
|
||||
render :nothing => true, :status => 200
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ class RequestsController < ApplicationController
|
|||
respond_to :html
|
||||
|
||||
def destroy
|
||||
if notification = Notification.where(:recipient_id => current_user.id, :target_id=> params[:id]).first
|
||||
notification.update_attributes(:unread=>false)
|
||||
end
|
||||
|
||||
if params[:accept]
|
||||
if params[:aspect_id]
|
||||
@contact = current_user.accept_and_respond( params[:id], params[:aspect_id])
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ class SocketsController < ApplicationController
|
|||
Rails.logger.info("Socket received connection to: #{msg}")
|
||||
end
|
||||
|
||||
def outgoing(uid,object,opts={})
|
||||
def outgoing(user, object, opts={})
|
||||
@_request = ActionDispatch::Request.new({})
|
||||
Diaspora::WebSocket.queue_to_user(uid, action_hash(uid, object, opts))
|
||||
Diaspora::WebSocket.queue_to_user(user.id, action_hash(user, object, opts))
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,9 +9,7 @@ class StatusMessagesController < ApplicationController
|
|||
respond_to :json, :only => :show
|
||||
|
||||
def create
|
||||
if params[:status_message][:aspect_ids] == "all"
|
||||
params[:status_message][:aspect_ids] = current_user.aspects.collect { |x| x.id }
|
||||
end
|
||||
params[:status_message][:aspect_ids] = params[:aspect_ids]
|
||||
|
||||
photos = Photo.where(:id => [*params[:photos]], :diaspora_handle => current_user.person.diaspora_handle)
|
||||
|
||||
|
|
@ -20,19 +18,18 @@ class StatusMessagesController < ApplicationController
|
|||
params[:status_message][:public] = public_flag
|
||||
|
||||
@status_message = current_user.build_post(:status_message, params[:status_message])
|
||||
aspects = current_user.aspects_from_ids(params[:aspect_ids])
|
||||
|
||||
if @status_message.save
|
||||
current_user.add_to_streams(@status_message, params[:status_message][:aspect_ids])
|
||||
current_user.dispatch_post(@status_message,
|
||||
:to => params[:status_message][:aspect_ids],
|
||||
:url => post_url(@status_message))
|
||||
current_user.add_to_streams(@status_message, aspects)
|
||||
current_user.dispatch_post(@status_message, :url => post_url(@status_message))
|
||||
if !photos.empty?
|
||||
@status_message.photos += photos
|
||||
for photo in photos
|
||||
photo.public = public_flag
|
||||
photo.save
|
||||
current_user.add_to_streams(photo, params[:status_message][:aspect_ids])
|
||||
current_user.dispatch_post(photo, :to => params[:status_message][:aspect_ids])
|
||||
current_user.add_to_streams(photo, aspects)
|
||||
current_user.dispatch_post(photo)
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
|
|
@ -44,7 +41,7 @@ class StatusMessagesController < ApplicationController
|
|||
:person => @status_message.person,
|
||||
:photos => @status_message.photos,
|
||||
:comments => [],
|
||||
:aspects => current_user.aspects,
|
||||
:all_aspects => current_user.aspects,
|
||||
:current_user => current_user
|
||||
}
|
||||
)
|
||||
|
|
@ -79,6 +76,9 @@ class StatusMessagesController < ApplicationController
|
|||
:person => person_hash[comment.person_id]
|
||||
}
|
||||
end
|
||||
|
||||
@object_aspect_ids = @status_message.aspects.map{|a| a.id}
|
||||
|
||||
respond_with @status_message
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@
|
|||
module ApplicationHelper
|
||||
@@youtube_title_cache = Hash.new("no-title")
|
||||
|
||||
def timeago(time, options = {})
|
||||
options[:class] ||= "timeago"
|
||||
content_tag(:abbr, time.to_s, options.merge(:title => time.iso8601)) if time
|
||||
end
|
||||
|
||||
def modern_browser?
|
||||
false
|
||||
end
|
||||
|
|
@ -31,21 +36,26 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def aspect_badge aspects
|
||||
def aspect_badges aspects
|
||||
str = ''
|
||||
if aspects.count > 1
|
||||
str = "<span class='aspect_badge all'>#{I18n.t('application.helper.aspect_badge.all_aspects')}</span>"
|
||||
elsif aspects.count == 1
|
||||
aspect = aspects.first
|
||||
str = "<span class='aspect_badge single'><a href=#{aspect_path(aspect)}>#{aspect.name}</a></span>"
|
||||
aspects.each do |aspect|
|
||||
str << aspect_badge(aspect)
|
||||
end
|
||||
str.html_safe
|
||||
end
|
||||
|
||||
def aspect_badge aspect
|
||||
str = "<span class='aspect_badge single'>"
|
||||
str << link_for_aspect(aspect, 'data-guid' => aspect.id, :class => 'hard_aspect_link').html_safe
|
||||
str << "</span>"
|
||||
end
|
||||
|
||||
def aspect_links aspects, opts={}
|
||||
str = ""
|
||||
aspects.each do |a|
|
||||
str << aspect_li(a, opts)
|
||||
aspects.each do |aspect|
|
||||
str << '<li>'
|
||||
str << link_for_aspect(aspect, :params => opts, 'data-guid' => aspect.id, :class => 'hard_aspect_link').html_safe
|
||||
str << '</li>'
|
||||
end
|
||||
str.html_safe
|
||||
end
|
||||
|
|
@ -97,7 +107,8 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def how_long_ago(obj)
|
||||
I18n.t('ago', :time => time_ago_in_words(obj.created_at, true))
|
||||
timeago(obj.created_at)
|
||||
#I18n.t('ago', :time => time_ago_in_words(obj.created_at, true))
|
||||
end
|
||||
|
||||
def person_url(person)
|
||||
|
|
|
|||
|
|
@ -3,11 +3,14 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
module AspectsHelper
|
||||
def link_for_aspect( aspect )
|
||||
link_to aspect.name, aspect
|
||||
def link_for_aspect(aspect, opts={})
|
||||
opts[:params] ||= {}
|
||||
opts[:params] = opts[:params].merge("a_ids[]" => aspect.id)
|
||||
|
||||
link_to aspect.name, aspects_path( opts[:params] ), opts
|
||||
end
|
||||
|
||||
def remove_link( aspect )
|
||||
def remove_link(aspect)
|
||||
if aspect.contacts.size == 0
|
||||
link_to I18n.t('aspects.helper.remove'), aspect, :method => :delete, :confirm => I18n.t('aspects.helper.are_you_sure')
|
||||
else
|
||||
|
|
@ -42,5 +45,20 @@ module AspectsHelper
|
|||
remove_from_aspect_button(aspect_id, person.id)
|
||||
end
|
||||
end
|
||||
|
||||
def publisher_description(aspect_count, aspect=nil)
|
||||
if aspect && aspect == :all
|
||||
str = t('.share_with_all')
|
||||
else
|
||||
str = "#{t('.post_a_message_to', :aspect => aspect_count)} "
|
||||
if aspect_count == 1
|
||||
str += t('_aspect').downcase
|
||||
else
|
||||
str += t('_aspects').downcase
|
||||
end
|
||||
end
|
||||
(link_to str, '#', :id => 'expand_publisher').html_safe
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,13 @@ module NotificationsHelper
|
|||
else
|
||||
"#{translation} #{t('notifications.deleted')} #{t('notifications.post')}"
|
||||
end
|
||||
when 'also_commented'
|
||||
comment = Comment.first(:id => note.target_id)
|
||||
if comment
|
||||
"#{translation} #{link_to t('notifications.post'), object_path(comment.post)}".html_safe
|
||||
else
|
||||
"#{translation} #{t('notifications.deleted')} #{t('notifications.post')}"
|
||||
end
|
||||
else
|
||||
end
|
||||
end
|
||||
|
|
@ -25,4 +32,10 @@ module NotificationsHelper
|
|||
t('no_new_notifications')
|
||||
end
|
||||
end
|
||||
|
||||
def new_notification_link(count)
|
||||
if count > 0
|
||||
link_to new_notification_text(count), notifications_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ module SocketsHelper
|
|||
end
|
||||
end
|
||||
|
||||
def action_hash(uid, object, opts={})
|
||||
def action_hash(user, object, opts={})
|
||||
uid = user.id
|
||||
begin
|
||||
user = User.find_by_id uid
|
||||
unless user.nil?
|
||||
old_locale = I18n.locale
|
||||
I18n.locale = user.language.to_s
|
||||
|
|
@ -34,14 +34,14 @@ module SocketsHelper
|
|||
}
|
||||
},
|
||||
:current_user => user,
|
||||
:aspects => user.aspects,
|
||||
:all_aspects => user.aspects,
|
||||
}
|
||||
v = render_to_string(:partial => 'shared/stream_element', :locals => post_hash)
|
||||
elsif object.is_a? Person
|
||||
person_hash = {
|
||||
:single_aspect_form => opts["single_aspect_form"],
|
||||
:person => object,
|
||||
:aspects => user.aspects,
|
||||
:all_aspects => user.aspects,
|
||||
:contact => user.contact_for(object),
|
||||
:request => user.request_from(object),
|
||||
:current_user => user}
|
||||
|
|
@ -54,7 +54,7 @@ module SocketsHelper
|
|||
v = render_to_string(:partial => 'notifications/popup', :locals => {:note => object, :person => object.actor})
|
||||
|
||||
else
|
||||
v = render_to_string(:partial => type_partial(object), :locals => {:post => object, :current_user => user}) unless object.is_a? Retraction
|
||||
raise "#{object.inspect} with class #{object.class} is not actionhashable." unless object.is_a? Retraction
|
||||
end
|
||||
rescue Exception => e
|
||||
Rails.logger.error("event=socket_render status=fail user=#{user.diaspora_handle} object=#{object.id.to_s}")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
class Notifier < ActionMailer::Base
|
||||
helper :application
|
||||
|
||||
default :from => AppConfig[:smtp_sender_address]
|
||||
|
||||
|
|
@ -45,6 +46,34 @@ class Notifier < ActionMailer::Base
|
|||
:subject => I18n.t('notifier.request_accepted.subject', :name => @sender.name), :host => AppConfig[:pod_uri].host)
|
||||
end
|
||||
|
||||
def comment_on_post(recipient_id, sender_id, comment_id)
|
||||
@receiver = User.find_by_id(recipient_id)
|
||||
@sender = Person.find_by_id(sender_id)
|
||||
@comment = Comment.find_by_id(comment_id)
|
||||
|
||||
log_mail(recipient_id, sender_id, 'comment_on_post')
|
||||
|
||||
attachments.inline['diaspora_white_on_grey.png'] = ATTACHMENT
|
||||
|
||||
mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>",
|
||||
:subject => I18n.t('notifier.comment_on_post.subject', :name => @sender.name), :host => AppConfig[:pod_uri].host)
|
||||
end
|
||||
|
||||
def also_commented(recipient_id, sender_id, comment_id)
|
||||
@receiver = User.find_by_id(recipient_id)
|
||||
@sender = Person.find_by_id(sender_id)
|
||||
@comment = Comment.find_by_id(comment_id)
|
||||
@post_author_name = @comment.post.person.name
|
||||
|
||||
|
||||
log_mail(recipient_id, sender_id, 'comment_on_post')
|
||||
|
||||
attachments.inline['diaspora_white_on_grey.png'] = ATTACHMENT
|
||||
|
||||
mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>",
|
||||
:subject => I18n.t('notifier.also_commented.subject', :name => @sender.name, :post_author => @post_author_name ), :host => AppConfig[:pod_uri].host)
|
||||
end
|
||||
|
||||
private
|
||||
def log_mail recipient_id, sender_id, type
|
||||
log_string = "event=mail mail_type=#{type} recipient_id=#{recipient_id} sender_id=#{sender_id}"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ class Comment < ActiveRecord::Base
|
|||
belongs_to :person
|
||||
|
||||
validates_presence_of :text, :post
|
||||
validates_length_of :text, :maximum => 500
|
||||
|
||||
serialize :youtube_titles, Hash
|
||||
before_save do
|
||||
|
|
@ -43,11 +44,45 @@ class Comment < ActiveRecord::Base
|
|||
def notification_type(user, person)
|
||||
if self.post.person == user.person
|
||||
return "comment_on_post"
|
||||
elsif self.post.comments.where(:person_id => user.person.id) != [] && self.person_id != user.person.id
|
||||
return "also_commented"
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def subscribers(user)
|
||||
if user.owns?(self.post)
|
||||
p = self.post.subscribers(user)
|
||||
elsif user.owns?(self)
|
||||
p = [self.post.person]
|
||||
end
|
||||
p
|
||||
end
|
||||
|
||||
def receive(user, person)
|
||||
commenter = self.person
|
||||
unless self.post.person == user.person || self.verify_post_creator_signature
|
||||
Rails.logger.info("event=receive status=abort reason='comment signature not valid' recipient=#{user.diaspora_handle} sender=#{self.post.person.diaspora_handle} payload_type=#{self.class} post_id=#{self.post_id}")
|
||||
return
|
||||
end
|
||||
|
||||
#sign comment as the post creator if you've been hit UPSTREAM
|
||||
if user.owns? self.post
|
||||
self.post_creator_signature = self.sign_with_key(user.encryption_key)
|
||||
self.save
|
||||
end
|
||||
|
||||
#dispatch comment DOWNSTREAM, received it via UPSTREAM
|
||||
unless user.owns?(self)
|
||||
self.save
|
||||
user.dispatch_comment(self)
|
||||
end
|
||||
|
||||
self.socket_to_user(user, :aspect_ids => self.post.aspect_ids)
|
||||
self
|
||||
end
|
||||
|
||||
#ENCRYPTION
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class Contact < ActiveRecord::Base
|
|||
|
||||
def dispatch_request
|
||||
request = self.generate_request
|
||||
self.user.push_to_people(request, [self.person])
|
||||
Postzord::Dispatch.new(self.user, request).post
|
||||
request
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,17 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
|
||||
module Jobs
|
||||
class HttpPost
|
||||
extend ResqueJobLogging
|
||||
@queue = :http
|
||||
NUM_TRIES = 3
|
||||
|
||||
def self.perform(url, body, tries_remaining)
|
||||
def self.perform(url, body, tries_remaining = NUM_TRIES)
|
||||
begin
|
||||
body = CGI::escape(body)
|
||||
RestClient.post(url, :xml => body){ |response, request, result, &block|
|
||||
if [301, 302, 307].include? response.code
|
||||
response.follow_redirection(request, result, &block)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
|
||||
module Jobs
|
||||
class InviteUser
|
||||
extend ResqueJobLogging
|
||||
|
|
|
|||
10
app/models/jobs/mail_also_commented.rb
Normal file
10
app/models/jobs/mail_also_commented.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
module Jobs
|
||||
class MailAlsoCommented
|
||||
extend ResqueJobLogging
|
||||
@queue = :mail
|
||||
def self.perform(recipient_id, sender_id, comment_id)
|
||||
Notifier.also_commented(recipient_id, sender_id, comment_id).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
10
app/models/jobs/mail_comment_on_post.rb
Normal file
10
app/models/jobs/mail_comment_on_post.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
module Jobs
|
||||
class MailCommentOnPost
|
||||
extend ResqueJobLogging
|
||||
@queue = :mail
|
||||
def self.perform(recipient_id, sender_id, comment_id)
|
||||
Notifier.comment_on_post(recipient_id, sender_id, comment_id).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
|
||||
module Jobs
|
||||
class MailRequestAcceptance
|
||||
extend ResqueJobLogging
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
|
||||
module Jobs
|
||||
class MailRequestReceived
|
||||
extend ResqueJobLogging
|
||||
|
|
|
|||
20
app/models/jobs/notify_local_users.rb
Normal file
20
app/models/jobs/notify_local_users.rb
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
module Jobs
|
||||
class NotifyLocalUsers
|
||||
extend ResqueJobLogging
|
||||
@queue = :receive_local
|
||||
|
||||
require File.join(Rails.root, 'app/models/notification')
|
||||
|
||||
def self.perform(user_id, object_klass, object_id, person_id)
|
||||
user = User.find_by_id(user_id)
|
||||
object = object_klass.constantize.find_by_id(object_id)
|
||||
person = Person.find_by_id(person_id)
|
||||
|
||||
Notification.notify(user, object, person)
|
||||
end
|
||||
end
|
||||
end
|
||||
16
app/models/jobs/post_to_service.rb
Normal file
16
app/models/jobs/post_to_service.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
#
|
||||
module Jobs
|
||||
class PostToService
|
||||
extend ResqueJobLogging
|
||||
@queue = :http_service
|
||||
|
||||
def self.perform(service_id, post_id, url)
|
||||
service = Service.find_by_id(service_id)
|
||||
post = Post.find_by_id(post_id)
|
||||
service.post(post, url)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
|
||||
module Jobs
|
||||
class PostToServices
|
||||
extend ResqueJobLogging
|
||||
|
|
@ -5,8 +10,9 @@ module Jobs
|
|||
def self.perform(user_id, post_id, url)
|
||||
user = User.find_by_id(user_id)
|
||||
post = Post.find_by_id(post_id)
|
||||
user.post_to_services(post, url)
|
||||
user.services.each do |s|
|
||||
s.post(post, url)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
15
app/models/jobs/publish_to_hub.rb
Normal file
15
app/models/jobs/publish_to_hub.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
module Jobs
|
||||
class PublishToHub
|
||||
extend ResqueJobLogging
|
||||
@queue = :http_service
|
||||
|
||||
def self.perform(sender_public_url)
|
||||
require File.join(Rails.root, 'lib/pubsubhubbub')
|
||||
Pubsubhubbub.new(AppConfig[:pubsub_server]).publish(sender_public_url)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
|
||||
module Jobs
|
||||
class Receive
|
||||
extend ResqueJobLogging
|
||||
|
|
@ -5,7 +10,8 @@ module Jobs
|
|||
def self.perform(user_id, xml, salmon_author_id)
|
||||
user = User.find(user_id)
|
||||
salmon_author = Person.find(salmon_author_id)
|
||||
user.receive(xml, salmon_author)
|
||||
zord = Postzord::Receiver.new(user, :person => salmon_author)
|
||||
zord.parse_and_receive(xml)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
|
||||
module Jobs
|
||||
class ReceiveLocal
|
||||
require File.join(Rails.root, 'lib/postzord/receiver')
|
||||
|
||||
extend ResqueJobLogging
|
||||
@queue = :receive_local
|
||||
def self.perform(user_id, person_id, object_type, object_id)
|
||||
|
|
@ -7,7 +14,8 @@ module Jobs
|
|||
person = Person.find(person_id)
|
||||
object = object_type.constantize.where(:id => object_id).first
|
||||
|
||||
user.receive_object(object, person)
|
||||
z = Postzord::Receiver.new(user, :person => person, :object => object)
|
||||
z.receive_object
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,10 +1,17 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
|
||||
require File.join(Rails.root, 'lib/postzord/receiver')
|
||||
module Jobs
|
||||
class ReceiveSalmon
|
||||
extend ResqueJobLogging
|
||||
@queue = :receive_salmon
|
||||
def self.perform(user_id, xml)
|
||||
user = User.find(user_id)
|
||||
user.receive_salmon(xml)
|
||||
zord = Postzord::Receiver.new(user, :salmon_xml => xml)
|
||||
zord.perform
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
|
||||
module Jobs
|
||||
class SocketWebfinger
|
||||
extend ResqueJobLogging
|
||||
|
|
@ -5,8 +10,9 @@ module Jobs
|
|||
def self.perform(user_id, account, opts={})
|
||||
finger = Webfinger.new(account)
|
||||
begin
|
||||
user = User.find_by_id(user_id)
|
||||
result = finger.fetch
|
||||
result.socket_to_uid(user_id, opts)
|
||||
result.socket_to_user(user, opts)
|
||||
rescue
|
||||
Diaspora::WebSocket.queue_to_user(user_id,
|
||||
{:class => 'people',
|
||||
|
|
|
|||
|
|
@ -21,9 +21,23 @@ class Notification < ActiveRecord::Base
|
|||
:action => action,
|
||||
:actor => actor,
|
||||
:recipient => recipient)
|
||||
n.socket_to_uid(recipient.id) if n
|
||||
n.email_the_user if n
|
||||
n.socket_to_user(recipient) if n
|
||||
n
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def email_the_user
|
||||
case self.action
|
||||
when "new_request"
|
||||
self.recipient.mail(Jobs::MailRequestReceived, self.recipient_id, self.actor_id)
|
||||
when "request_accepted"
|
||||
self.recipient.mail(Jobs::MailRequestAcceptance, self.recipient_id, self.actor_id)
|
||||
when "comment_on_post"
|
||||
self.recipient.mail(Jobs::MailCommentOnPost, self.recipient_id, self.actor_id, target.id)
|
||||
when "also_commented"
|
||||
self.recipient.mail(Jobs::MailAlsoCommented, self.recipient_id, self.actor_id, target.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ class Person < ActiveRecord::Base
|
|||
(person.nil? || person.remote?) ? nil : person
|
||||
end
|
||||
|
||||
def self.build_from_webfinger(profile, hcard)
|
||||
def self.create_from_webfinger(profile, hcard)
|
||||
return nil if profile.nil? || !profile.valid_diaspora_profile?
|
||||
new_person = Person.new
|
||||
new_person.serialized_public_key = profile.public_key
|
||||
|
|
@ -173,5 +173,7 @@ class Person < ActiveRecord::Base
|
|||
private
|
||||
def remove_all_traces
|
||||
Post.where(:person_id => id).delete_all
|
||||
Contact.where(:person_id => id).delete_all
|
||||
Notification.where(:actor_id => id).delete_all
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -71,6 +71,11 @@ class Photo < Post
|
|||
true
|
||||
end
|
||||
|
||||
def save_update updated_post
|
||||
self.caption = updated_post.caption
|
||||
self.save
|
||||
end
|
||||
|
||||
def absolute_url *args
|
||||
pod_url = AppConfig[:pod_url].dup
|
||||
pod_url.chop! if AppConfig[:pod_url][-1,1] == '/'
|
||||
|
|
|
|||
|
|
@ -58,6 +58,42 @@ class Post < ActiveRecord::Base
|
|||
false
|
||||
end
|
||||
|
||||
def subscribers(user)
|
||||
user.people_in_aspects(user.aspects_with_post(self.id))
|
||||
end
|
||||
|
||||
def receive(user, person)
|
||||
#exists locally, but you dont know about it
|
||||
#does not exsist locally, and you dont know about it
|
||||
|
||||
#exists_locally?
|
||||
#you know about it, and it is mutable
|
||||
#you know about it, and it is not mutable
|
||||
|
||||
local_post = Post.where(:guid => self.guid).first
|
||||
if local_post && local_post.person_id == self.person_id
|
||||
known_post = user.visible_posts(:guid => self.guid).first
|
||||
if known_post
|
||||
if known_post.mutable?
|
||||
known_post.save_update(self)
|
||||
else
|
||||
Rails.logger.info("event=receive payload_type=#{self.class} update=true status=abort sender=#{self.diaspora_handle} reason=immutable existing_post=#{known_post.id}")
|
||||
end
|
||||
else
|
||||
user.add_post_to_aspects(local_post)
|
||||
Rails.logger.info("event=receive payload_type=#{self.class} update=true status=complete sender=#{self.diaspora_handle} existing_post=#{local_post.id}")
|
||||
self
|
||||
end
|
||||
elsif !local_post
|
||||
self.save
|
||||
user.add_post_to_aspects(self)
|
||||
Rails.logger.info("event=receive payload_type=#{self.class} update=false status=complete sender=#{self.diaspora_handle}")
|
||||
self
|
||||
else
|
||||
Rails.logger.info("event=receive payload_type=#{self.class} update=true status=abort sender=#{self.diaspora_handle} reason='update not from post owner' existing_post=#{self.id}")
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
def propogate_retraction
|
||||
self.person.owner.retract(self) if self.person.owner
|
||||
|
|
|
|||
|
|
@ -29,7 +29,16 @@ class Profile < ActiveRecord::Base
|
|||
|
||||
belongs_to :person
|
||||
|
||||
# TODO: this should always delegate to the person
|
||||
def subscribers(user)
|
||||
Person.joins(:contacts).where(:contacts => {:user_id => user.id, :pending => false})
|
||||
end
|
||||
|
||||
def receive(user, person)
|
||||
person.profile = self
|
||||
person.save
|
||||
self
|
||||
end
|
||||
|
||||
def diaspora_handle
|
||||
#get the parent diaspora handle, unless we want to access a profile without a person
|
||||
(self.person) ? self.person.diaspora_handle : self[:diaspora_handle]
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
class Request < ActiveRecord::Base
|
||||
require File.join(Rails.root, 'lib/diaspora/webhooks')
|
||||
|
||||
require File.join(Rails.root, 'lib/postzord/dispatch')
|
||||
include Diaspora::Webhooks
|
||||
include ROXML
|
||||
|
||||
|
|
@ -70,6 +71,17 @@ class Request < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def subscribers(user)
|
||||
[self.recipient]
|
||||
end
|
||||
|
||||
def receive(user, person)
|
||||
Rails.logger.info("event=receive payload_type=request sender=#{self.sender} to=#{self.recipient}")
|
||||
user.receive_contact_request(self)
|
||||
self.save
|
||||
self
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def not_already_connected
|
||||
|
|
|
|||
|
|
@ -10,7 +10,16 @@ class Retraction
|
|||
xml_accessor :diaspora_handle
|
||||
xml_accessor :type
|
||||
|
||||
attr_accessor :person
|
||||
attr_accessor :person, :object, :subscribers
|
||||
|
||||
def subscribers(user)
|
||||
unless self.type == 'Person'
|
||||
@subscribers ||= self.object.subscribers(user)
|
||||
else
|
||||
raise 'HAX: you must set the subscribers manaully before unfriending' if @subscribers.nil?
|
||||
@subscribers
|
||||
end
|
||||
end
|
||||
|
||||
def self.for(object)
|
||||
retraction = self.new
|
||||
|
|
@ -20,6 +29,7 @@ class Retraction
|
|||
else
|
||||
retraction.post_guid = object.guid
|
||||
retraction.type = object.class.to_s
|
||||
retraction.object = object
|
||||
end
|
||||
retraction.diaspora_handle = object.diaspora_handle
|
||||
retraction
|
||||
|
|
@ -29,17 +39,26 @@ class Retraction
|
|||
@target ||= self.type.constantize.where(:guid => post_guid).first
|
||||
end
|
||||
|
||||
def perform receiving_user_id
|
||||
def perform receiving_user
|
||||
Rails.logger.debug "Performing retraction for #{post_guid}"
|
||||
if self.target
|
||||
if self.target.person != self.person
|
||||
Rails.logger.info("event=retraction status=abort reason='no post found authored by retractor' sender=#{person.diaspora_handle} post_id=#{post_guid}")
|
||||
self.target.unsocket_from_user receiving_user if target.respond_to? :unsocket_from_user
|
||||
self.target.delete
|
||||
target.post_visibilities.delete_all
|
||||
Rails.logger.info("event=retraction status=complete type=#{self.type} guid=#{self.post_guid}")
|
||||
end
|
||||
|
||||
def receive(user, person)
|
||||
if self.type == 'Person'
|
||||
unless self.person.guid.to_s == self.post_guid.to_s
|
||||
Rails.logger.info("event=receive status=abort reason='sender is not the person he is trying to retract' recipient=#{self.diaspora_handle} sender=#{self.person.diaspora_handle} payload_type=#{self.class} retraction_type=person")
|
||||
return
|
||||
else
|
||||
Rails.logger.info("event=retraction status=complete type=#{self.type} guid=#{self.post_guid}")
|
||||
self.target.unsocket_from_uid receiving_user_id if target.respond_to? :unsocket_from_uid
|
||||
self.target.delete
|
||||
end
|
||||
user.disconnected_by(self.target)
|
||||
elsif self.target.nil? || self.target.person != self.person
|
||||
Rails.logger.info("event=retraction status=abort reason='no post found authored by retractor' sender=#{person.diaspora_handle} post_guid=#{post_guid}")
|
||||
else
|
||||
self.perform(user)
|
||||
end
|
||||
self
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
require File.join(Rails.root, 'lib/diaspora/user')
|
||||
require File.join(Rails.root, 'lib/salmon/salmon')
|
||||
require File.join(Rails.root, 'lib/postzord/dispatch')
|
||||
require 'rest-client'
|
||||
|
||||
class User < ActiveRecord::Base
|
||||
|
|
@ -81,6 +82,11 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def salmon(post)
|
||||
created_salmon = Salmon::SalmonSlap.create(self, post.to_diaspora_xml)
|
||||
created_salmon
|
||||
end
|
||||
|
||||
def add_contact_to_aspect(contact, aspect)
|
||||
return true if contact.aspect_memberships.where(:aspect_id => aspect.id).count > 0
|
||||
contact.aspect_memberships.create!(:aspect => aspect)
|
||||
|
|
@ -108,40 +114,27 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def dispatch_post(post, opts = {})
|
||||
aspect_ids = opts.delete(:to)
|
||||
|
||||
Rails.logger.info("event=dispatch user=#{diaspora_handle} post=#{post.id.to_s}")
|
||||
push_to_aspects(post, aspects_from_ids(aspect_ids))
|
||||
Resque.enqueue(Jobs::PostToServices, self.id, post.id, opts[:url]) if post.public
|
||||
end
|
||||
|
||||
def post_to_services(post, url)
|
||||
if post.respond_to?(:message)
|
||||
self.services.each do |service|
|
||||
service.post(post, url)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def post_to_hub(post)
|
||||
Rails.logger.debug("event=post_to_service type=pubsub sender_handle=#{self.diaspora_handle}")
|
||||
EventMachine::PubSubHubbub.new(AppConfig[:pubsub_server]).publish self.public_url
|
||||
mailman = Postzord::Dispatch.new(self, post)
|
||||
mailman.post(opts)
|
||||
end
|
||||
|
||||
def update_post(post, post_hash = {})
|
||||
if self.owns? post
|
||||
post.update_attributes(post_hash)
|
||||
aspects = self.aspects.joins(:posts).where(:posts => {:id => post.id})
|
||||
self.push_to_aspects(post, aspects)
|
||||
Postzord::Dispatch.new(self, post).post
|
||||
end
|
||||
end
|
||||
|
||||
def add_to_streams(post, aspect_ids)
|
||||
post.socket_to_uid(id, :aspect_ids => aspect_ids) if post.respond_to? :socket_to_uid
|
||||
target_aspects = aspects_from_ids(aspect_ids)
|
||||
target_aspects.each do |aspect|
|
||||
def add_post_to_aspects(post)
|
||||
Rails.logger.debug("event=add_post_to_aspects user_id=#{self.id} post_id=#{post.id}")
|
||||
add_to_streams(post, self.aspects_with_person(post.person))
|
||||
post
|
||||
end
|
||||
|
||||
def add_to_streams(post, aspects_to_insert)
|
||||
post.socket_to_user(self, :aspect_ids => aspects_to_insert.map{|x| x.id}) if post.respond_to? :socket_to_user
|
||||
aspects_to_insert.each do |aspect|
|
||||
aspect.posts << post
|
||||
aspect.save
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -153,50 +146,6 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def push_to_aspects(post, aspects)
|
||||
#send to the aspects
|
||||
target_aspect_ids = aspects.map {|a| a.id}
|
||||
|
||||
target_people = Person.joins(
|
||||
:contacts => :aspect_memberships
|
||||
).where(:aspect_memberships => {:aspect_id => target_aspect_ids}
|
||||
).select("DISTINCT `people`.*")
|
||||
|
||||
post_to_hub(post) if post.respond_to?(:public) && post.public
|
||||
push_to_people(post, target_people)
|
||||
end
|
||||
|
||||
def push_to_people(post, people)
|
||||
salmon = salmon(post)
|
||||
people.each do |person|
|
||||
push_to_person(salmon, post, person)
|
||||
end
|
||||
end
|
||||
|
||||
def push_to_person(salmon, post, person)
|
||||
person.reload # Sadly, we need this for Ruby 1.9.
|
||||
# person.owner will always return a ProxyObject.
|
||||
# calling nil? performs a necessary evaluation.
|
||||
if person.owner_id
|
||||
Rails.logger.info("event=push_to_person route=local sender=#{self.diaspora_handle} recipient=#{person.diaspora_handle} payload_type=#{post.class}")
|
||||
|
||||
if post.is_a?(Post) || post.is_a?(Comment)
|
||||
Resque.enqueue(Jobs::ReceiveLocal, person.owner_id, self.person.id, post.class.to_s, post.id)
|
||||
else
|
||||
Resque.enqueue(Jobs::Receive, person.owner_id, post.to_diaspora_xml, self.person.id)
|
||||
end
|
||||
else
|
||||
xml = salmon.xml_for person
|
||||
Rails.logger.info("event=push_to_person route=remote sender=#{self.diaspora_handle} recipient=#{person.diaspora_handle} payload_type=#{post.class}")
|
||||
MessageHandler.add_post_request(person.receive_url, xml)
|
||||
end
|
||||
end
|
||||
|
||||
def salmon(post)
|
||||
created_salmon = Salmon::SalmonSlap.create(self, post.to_diaspora_xml)
|
||||
created_salmon
|
||||
end
|
||||
|
||||
######## Commenting ########
|
||||
def build_comment(text, options = {})
|
||||
comment = Comment.new(:person_id => self.person.id,
|
||||
|
|
@ -215,28 +164,8 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def dispatch_comment(comment)
|
||||
if person.owns? comment.post
|
||||
#push DOWNSTREAM (to original audience)
|
||||
Rails.logger.info "event=dispatch_comment direction=downstream user=#{self.person.diaspora_handle} comment=#{comment.id}"
|
||||
aspects = comment.post.aspects
|
||||
|
||||
#just socket to local users, as the comment has already
|
||||
#been associated and saved by post owner
|
||||
# (we'll push to all of their aspects for now, the comment won't
|
||||
# show up via js where corresponding posts are not present)
|
||||
|
||||
people_in_aspects(aspects, :type => 'local').each do |person|
|
||||
comment.socket_to_uid(person.owner_id, :aspect_ids => 'all')
|
||||
end
|
||||
|
||||
#push to remote people
|
||||
push_to_people(comment, people_in_aspects(aspects, :type => 'remote'))
|
||||
|
||||
elsif owns? comment
|
||||
#push UPSTREAM (to poster)
|
||||
Rails.logger.info "event=dispatch_comment direction=upstream user=#{self.diaspora_handle} comment=#{comment.id}"
|
||||
push_to_people comment, [comment.post.person]
|
||||
end
|
||||
mailman = Postzord::Dispatch.new(self, comment)
|
||||
mailman.post
|
||||
end
|
||||
|
||||
######### Mailer #######################
|
||||
|
|
@ -250,9 +179,11 @@ class User < ActiveRecord::Base
|
|||
def retract(post)
|
||||
aspects = post.aspects
|
||||
|
||||
post.unsocket_from_uid(self.id, :aspect_ids => aspects.map { |a| a.id.to_s }) if post.respond_to? :unsocket_from_uid
|
||||
retraction = Retraction.for(post)
|
||||
push_to_people retraction, people_in_aspects(aspects)
|
||||
post.unsocket_from_user(self, :aspect_ids => aspects.map { |a| a.id.to_s }) if post.respond_to? :unsocket_from_user
|
||||
mailman = Postzord::Dispatch.new(self, retraction)
|
||||
mailman.post
|
||||
|
||||
retraction
|
||||
end
|
||||
|
||||
|
|
@ -265,7 +196,7 @@ class User < ActiveRecord::Base
|
|||
params[:image_url_small] = photo.url(:thumb_small)
|
||||
end
|
||||
if self.person.profile.update_attributes(params)
|
||||
push_to_people profile, self.contacts.where(:pending => false).includes(:person).map{|c| c.person}
|
||||
Postzord::Dispatch.new(self, profile).post
|
||||
true
|
||||
else
|
||||
false
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
- if @request_count > 0
|
||||
#new_request_pane{:class => "everyone"}
|
||||
%h1.new_request{:style => 'text-align:center'}
|
||||
= new_request_link(@request_count)
|
||||
|
||||
#left_pane.everyone
|
||||
|
||||
.section.aspect_listings
|
||||
%h3
|
||||
= t('.aspects')
|
||||
.right{:style=>"font-size:12px;top:5px;"}
|
||||
= link_to t('.manage_aspects'), aspects_manage_path
|
||||
|
||||
%ul
|
||||
- for a_hash in @aspect_hashes
|
||||
= render :partial => 'aspects/aspect', :locals => a_hash
|
||||
|
||||
.section.contact_pictures
|
||||
%h3
|
||||
.right.description{:style => "top:-4px"}
|
||||
= @contact_hashes.count
|
||||
= t('.all_contacts')
|
||||
|
||||
- for contact in @contact_hashes
|
||||
= person_image_link(contact[:person])
|
||||
|
||||
- if @contacts.count == 0
|
||||
%h4
|
||||
= t('.no_contacts')
|
||||
= form_tag(people_path, :method => 'get') do
|
||||
= text_field_tag 'q', nil, :placeholder => t('search'), :type => 'search', :results => 5
|
||||
|
||||
.section
|
||||
%h3= t('shared.invitations.invites')
|
||||
= render "shared/invitations", :invites => @invites
|
||||
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
%li
|
||||
%h4
|
||||
= link_to aspect, aspect
|
||||
%span
|
||||
= t('contacts', :count => contact_count)
|
||||
%li{:data=>{:guid=>aspect.id}, :class => ("dull" if contacts.length == 0)}
|
||||
.right
|
||||
%b
|
||||
= link_to t('contacts', :count => contact_count), edit_aspect_path(aspect), :rel => 'facebox'
|
||||
%b
|
||||
= aspect.name
|
||||
%br
|
||||
|
||||
- if contact_count > 0
|
||||
- for hash in contacts
|
||||
= person_image_link(hash[:person])
|
||||
- if contacts.length > 0
|
||||
.contacts
|
||||
- for hash in contacts
|
||||
= person_image_link(hash[:person])
|
||||
|
|
|
|||
18
app/views/aspects/_aspect_listings.haml
Normal file
18
app/views/aspects/_aspect_listings.haml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
|
||||
%h4
|
||||
.right
|
||||
= link_to t('contacts', :count => @contacts.count), aspects_manage_path, :title => t('aspects.manage.manage_aspects')
|
||||
|
||||
= @aspect_hashes.count
|
||||
- if @aspect_hashes.count == 1
|
||||
= t('_aspect')
|
||||
- else
|
||||
= t('_aspects')
|
||||
|
||||
%ul
|
||||
- for a_hash in aspect_hashes
|
||||
= render :partial => 'aspects/aspect', :locals => a_hash
|
||||
9
app/views/aspects/_aspect_stream.haml
Normal file
9
app/views/aspects/_aspect_stream.haml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
|
||||
= render 'shared/publisher', :aspect => aspect, :aspect_ids => aspect_ids
|
||||
#main_stream.stream{:data => {:guids => aspect_ids.join(',')}}
|
||||
= render 'shared/stream', :posts => post_hashes
|
||||
= will_paginate @posts
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#edit_aspect_pane
|
||||
- if @contacts.count > 0
|
||||
%h4= t('.add_existing')
|
||||
%h4= t('aspects.edit.add_existing')
|
||||
= render 'shared/contact_list', :aspect_id => aspect.id, :contact_hashes => contacts, :manage => defined?(manage)
|
||||
|
||||
= render 'shared/add_contact', :aspect_id => aspect.id
|
||||
|
|
@ -15,9 +15,9 @@
|
|||
%hr
|
||||
= form_for aspect do |asp|
|
||||
= asp.text_field :name, :value => aspect.name
|
||||
= asp.submit "Rename Aspect"
|
||||
= asp.submit t('aspects.edit.rename_aspect')
|
||||
|
||||
%hr
|
||||
.big_buttons
|
||||
= button_to t('.remove_aspect'), aspect, :method => "delete", :confirm => t('.confirm_remove_aspect')
|
||||
= button_to t('aspects.edit.remove_aspect'), aspect, :method => "delete", :confirm => t('aspects.edit.confirm_remove_aspect')
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
-# the COPYRIGHT file.
|
||||
|
||||
.span-12.last
|
||||
.modal_title_bar
|
||||
%h4= t('aspects.manage.add_a_new_aspect')
|
||||
#facebox_header
|
||||
%h4
|
||||
= t('aspects.manage.add_a_new_aspect')
|
||||
|
||||
= form_for Aspect.new do |aspect|
|
||||
= aspect.error_messages
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
-# the COPYRIGHT file.
|
||||
|
||||
#no_contacts.floating.empty_message{:style => ("display:none" unless contact_count == 0)}
|
||||
- if aspect == :all
|
||||
%h3=t('.nobody')
|
||||
%h3=t('.nobody')
|
||||
- if current_user.invites > 0
|
||||
%h4= link_to t('.invite'), new_user_invitation_path
|
||||
- else
|
||||
%h3=t('.nobody_in_aspect', :aspect_name => aspect.name)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
#no_posts.floating.empty_message{:style => ("display:none" unless post_count == 0 && contact_count > 0)}
|
||||
#no_posts.floating.empty_message{:class => ("hidden" unless post_count == 0)}
|
||||
.null_arrow ⇧
|
||||
%h3=t('.start_talking')
|
||||
|
||||
|
|
|
|||
41
app/views/aspects/edit.html.haml
Normal file
41
app/views/aspects/edit.html.haml
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
- content_for :head do
|
||||
= include_javascripts :aspects
|
||||
|
||||
#aspect_edit_pane
|
||||
#facebox_header
|
||||
%h4
|
||||
= @aspect
|
||||
.description
|
||||
= t('contacts', :count =>@aspect_contacts.count)
|
||||
|
||||
.person_tiles{:style => "display:none;"}
|
||||
- for contact in @aspect.contacts
|
||||
.tile
|
||||
= person_image_link contact.person
|
||||
= link_to contact.person.name, contact.person
|
||||
%hr
|
||||
|
||||
= form_for @aspect do |asp|
|
||||
= asp.text_field :name, :value => @aspect.name
|
||||
= asp.submit t('.rename_aspect'), :class => 'button'
|
||||
|
||||
= button_to t('.remove_aspect'), @aspect, :method => "delete", :confirm => t('.confirm_remove_aspect'), :class => 'button'
|
||||
|
||||
- if @contacts.count > 0
|
||||
= render 'shared/contact_list', :aspect_id => @aspect.id, :contact_hashes => @all_contacts
|
||||
|
||||
#aspect_edit_controls
|
||||
= link_to t('.rename'), '#'
|
||||
\/
|
||||
= link_to t('delete'), @aspect, :method => "delete", :confirm => t('.confirm_remove_aspect')
|
||||
|
||||
|
||||
#rename_aspect
|
||||
= form_for @aspect do |asp|
|
||||
= asp.text_field :name, :value => @aspect.name
|
||||
= asp.submit t('.rename_aspect')
|
||||
|
||||
|
|
@ -2,23 +2,45 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
.span-24.last
|
||||
%h2{:style => "position:relative;"}
|
||||
= current_user.name
|
||||
.right{:style=>"top:0"}
|
||||
%span.description
|
||||
= link_to current_user.diaspora_handle, person_path(current_user.person)
|
||||
= info_text(t('.handle_explanation'))
|
||||
|
||||
.span-15.append-1
|
||||
= render 'shared/publisher', :aspect => @aspect
|
||||
- content_for :head do
|
||||
= include_javascripts :home
|
||||
|
||||
.span-15.append-2
|
||||
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count
|
||||
= render 'aspects/no_posts_message', :post_count => @post_hashes.length, :contact_count => @contacts.count
|
||||
|
||||
%ul{:class => 'stream', :id => 'main_stream'}
|
||||
= render 'shared/stream', :posts => @post_hashes
|
||||
= will_paginate @posts
|
||||
#aspect_stream_container
|
||||
= render 'aspect_stream',
|
||||
:aspect => @aspect,
|
||||
:aspect_ids => @aspect_ids,
|
||||
:post_hashes => @post_hashes
|
||||
|
||||
.span-8.last
|
||||
= render 'aspects/all_aspects_contacts'
|
||||
.span-7.last
|
||||
#home_user_badge
|
||||
= owner_image_link
|
||||
%h3{:style => "position:relative;"}
|
||||
= current_user.name
|
||||
.description
|
||||
= link_to current_user.diaspora_handle, person_path(current_user.person)
|
||||
/= info_text(t('.handle_explanation'))
|
||||
|
||||
- if @notification_count > 0 || @request_count > 0
|
||||
#new_requests
|
||||
- if @request_count > 0
|
||||
%h4
|
||||
= new_request_link(@request_count)
|
||||
|
||||
#new_notifications
|
||||
- if @notification_count > 0
|
||||
= image_tag 'icons/mail_big.png', :height => 20, :width => 20, :style=>"margin-top:3px;"
|
||||
%h4
|
||||
= new_notification_link(@notification_count)
|
||||
%hr
|
||||
|
||||
#aspect_listings.section
|
||||
= render 'aspects/aspect_listings', :aspect_hashes => @aspect_hashes
|
||||
|
||||
.section
|
||||
%h4= t('shared.invitations.invites')
|
||||
= render "shared/invitations", :invites => @invites
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1,19 @@
|
|||
$('#main_stream').html("<%= escape_javascript(render('shared/stream', :posts => @post_hashes)) %>");
|
||||
$('#aspect_stream_container').html("<%= escape_javascript(render('aspects/aspect_stream', :aspect => @aspect, :aspect_ids => @aspect_ids, :post_hashes => @post_hashes)) %>");
|
||||
$('#aspect_listings').html("<%= escape_javascript(render('aspects/aspect_listings', :aspect_hashes => @aspect_hashes)) %>");
|
||||
$('a[rel*=facebox]').facebox();
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#main_stream').infinitescroll({
|
||||
navSelector : "div.pagination",
|
||||
// selector for the paged navigation (it will be hidden)
|
||||
nextSelector : ".pagination a.next_page",
|
||||
// selector for the NEXT link (to page 2)
|
||||
itemSelector : "#main_stream .stream_element",
|
||||
// selector for all items you'll retrieve
|
||||
bufferPx: 300,
|
||||
donetext: "no more.",
|
||||
loadingText: "",
|
||||
loadingImg: '/images/ajax-loader.gif'
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,10 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
%div
|
||||
%h1
|
||||
= person_image_tag (current_user.person)
|
||||
= current_user.name
|
||||
= select_tag "aspect_picker", aspect_select_options(@aspects, @aspect)
|
||||
|
||||
%div{:data => {:role => 'content'}}
|
||||
%div{:data => {:role => 'fieldcontain'}}
|
||||
=render 'shared/publisher', :aspect => @aspect
|
||||
|
||||
= render 'shared/stream', :posts => @posts
|
||||
= render 'shared/stream', :posts => @post_hashes
|
||||
|
|
|
|||
|
|
@ -9,16 +9,16 @@
|
|||
= t('.manage_aspects')
|
||||
|
||||
#section_header
|
||||
%h2=t('.manage_aspects')
|
||||
.right{:style=>"top:0;"}
|
||||
= link_to("+ #{t('.add_a_new_aspect')}", "#add_aspect_pane", :class => "new_aspect add_aspect_button button", :title => t('.add_a_new_aspect'))
|
||||
.right
|
||||
= link_to("+ #{t('.add_a_new_aspect')}", "#add_aspect_pane", :class => "new_aspect button", :title => t('.add_a_new_aspect'), :rel => 'facebox')
|
||||
|
||||
%h2
|
||||
=t('.manage_aspects')
|
||||
|
||||
#manage_aspect_zones
|
||||
.span-4.append-1.last
|
||||
.requests
|
||||
%h3=t('.requests')
|
||||
%i
|
||||
%p= "#{t('.drag_to_add')} =>"
|
||||
|
||||
%ul.dropzone
|
||||
- if @remote_requests.size < 1
|
||||
|
|
@ -32,6 +32,10 @@
|
|||
.circle
|
||||
= link_to person_image_tag(hash[:sender]), hash[:sender]
|
||||
|
||||
- if @remote_requests.size > 0
|
||||
%p
|
||||
%i= "#{t('.drag_to_add')} =>"
|
||||
|
||||
= render 'shared/invitations', :invites => @invites
|
||||
|
||||
%div{:style=>"color:rgb(252,252,252);"}
|
||||
|
|
@ -47,7 +51,7 @@
|
|||
%span.tip click to edit
|
||||
|
||||
%ul.tools
|
||||
%li= link_to t('.add_a_new_contact'), "#manage_aspect_contacts_pane_#{hash[:aspect].id}", :class => 'manage_aspect_contacts_button'
|
||||
%li= link_to t('.add_a_new_contact'), "#manage_aspect_contacts_pane_#{hash[:aspect].id}", :class => 'manage_aspect_contacts_button', :rel => "facebox"
|
||||
%li!= remove_link(hash[:aspect])
|
||||
|
||||
%ul.dropzone{:data=>{:aspect_id=>hash[:aspect].id}}
|
||||
|
|
@ -61,7 +65,7 @@
|
|||
.draggable_info
|
||||
=t('.drag_to_add')
|
||||
|
||||
.fancybox_content
|
||||
.facebox_content
|
||||
%div{:id => "manage_aspect_contacts_pane_#{hash[:aspect].id}"}
|
||||
= render "requests/manage_aspect_contacts", :aspect => hash[:aspect], :manage => true, :contact_hashes => hash[:contacts]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
|
||||
- content_for :head do
|
||||
= include_javascripts :aspects
|
||||
|
||||
- content_for :page_title do
|
||||
= @aspect.name.html_safe
|
||||
|
||||
|
|
@ -17,12 +21,9 @@
|
|||
= render 'aspects/aspect_contacts', :contacts => @aspect_contacts, :aspect => @aspect
|
||||
= render 'aspects/edit_aspect_pane', :contacts => @all_contacts, :aspect => @aspect
|
||||
|
||||
|
||||
.span-15.last
|
||||
= render 'shared/publisher', :aspect => @aspect
|
||||
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @aspect_contacts_count, :options => false
|
||||
= render 'aspects/no_posts_message', :post_count => @post_count, :contact_count=> @aspect_contacts_count
|
||||
|
||||
%ul{:class => 'stream', :id => 'main_stream'}
|
||||
#main_stream.stream{:data => {:guids => @aspect.id}}
|
||||
= render 'shared/stream', :posts => @post_hashes
|
||||
=will_paginate @posts
|
||||
|
|
|
|||
14
app/views/comments/_comment.haml
Normal file
14
app/views/comments/_comment.haml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
%li.comment{:data=>{:guid=>hash[:comment].id}, :class => ("hidden" if(defined? hidden))}
|
||||
= person_image_link(hash[:person])
|
||||
.content
|
||||
.from
|
||||
= person_link(hash[:person])
|
||||
= markdownify(hash[:comment].text, :youtube_maps => hash[:comment][:youtube_titles])
|
||||
|
||||
.info
|
||||
%span.time
|
||||
= hash[:comment].created_at ? timeago(hash[:comment].created_at) : timeago(Time.now)
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
- comment = hash[:comment]
|
||||
- person = hash[:person]
|
||||
%li.comment{:data=>{:guid=>comment.id}, :class => ("hidden" if(defined? hidden))}
|
||||
=person_image_link(person)
|
||||
.content
|
||||
.from
|
||||
=person_link(person)
|
||||
= markdownify(comment.text, :youtube_maps => comment[:youtube_titles])
|
||||
%div.time
|
||||
= comment.created_at ? t('ago', :time => time_ago_in_words(comment.created_at)) : time_ago_in_words(Time.now)
|
||||
|
||||
|
|
@ -38,10 +38,11 @@
|
|||
%p
|
||||
= invite.submit t('.send_an_invitation')
|
||||
|
||||
.span-4.last
|
||||
#already_invited_pane
|
||||
%h4
|
||||
= t('.already_invited')
|
||||
- for email in @emails_delivered
|
||||
= email
|
||||
- if !@emails_delivered.empty?
|
||||
.span-4.last
|
||||
#already_invited_pane
|
||||
%h4
|
||||
= t('.already_invited')
|
||||
- for email in @emails_delivered
|
||||
= email
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
.container#head{:style => "position:relative;"}
|
||||
|
||||
.container{:style => "position:relative;"}
|
||||
- if current_user
|
||||
= link_to image_tag('logo_small.png', :height => "16px", :width => "161px", :class => "diaspora_header_logo"), root_path
|
||||
- else
|
||||
|
|
@ -22,11 +21,12 @@
|
|||
= form_tag(people_path, :method => 'get', :id => "global_search_form") do
|
||||
= text_field_tag 'q', nil, :placeholder => t('search'), :type => 'search', :results => 5
|
||||
|
||||
#notification_badge
|
||||
= link_to "", notifications_path, :title => new_notification_text(@notification_count)
|
||||
= image_tag 'icons/mail_grey.png'
|
||||
#notification_badge_number{:class => ("hidden" if @notification_count == 0)}
|
||||
= @notification_count
|
||||
- if @notification_count
|
||||
#notification_badge
|
||||
= link_to "", notifications_path, :title => new_notification_text(@notification_count)
|
||||
= image_tag 'icons/mail_grey.png'
|
||||
#notification_badge_number{:class => ("hidden" if @notification_count == 0)}
|
||||
= @notification_count
|
||||
|
||||
%ul#user_menu
|
||||
.right
|
||||
|
|
@ -40,18 +40,18 @@
|
|||
%li= link_to t('.logout'), destroy_user_session_path
|
||||
|
||||
-unless @landing_page
|
||||
#aspect_nav
|
||||
%ul
|
||||
%li{:class => ("selected" if @aspect == :all)}
|
||||
= link_to t('_home'), root_path
|
||||
%ul#aspect_nav
|
||||
%li{:class => ('selected' if @aspect == :all)}
|
||||
= link_to t('_home'), root_path, :class => 'home_selector'
|
||||
|
||||
- for aspect in @aspects
|
||||
%li{:class => ("selected" if current_aspect?(aspect))}
|
||||
= link_for_aspect aspect
|
||||
%li
|
||||
= link_to '+', '#add_aspect_pane', :class => "add_aspect_button", :title => t('aspects.manage.add_a_new_aspect')
|
||||
- for aspect in @all_aspects
|
||||
%li{:data=>{:guid=>aspect.id}, :class => ("selected" if @object_aspect_ids.include?(aspect.id))}
|
||||
= link_for_aspect(aspect, :class => 'aspect_selector', :title => "#{aspect.contacts.count} contacts")
|
||||
|
||||
.fancybox_content
|
||||
#add_aspect_pane
|
||||
= render "aspects/new_aspect"
|
||||
%li
|
||||
= link_to '+', '#add_aspect_pane', :class => "add_aspect_button", :title => t('aspects.manage.add_a_new_aspect'), :rel => 'facebox'
|
||||
|
||||
.facebox_content
|
||||
#add_aspect_pane
|
||||
= render "aspects/new_aspect"
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,10 @@
|
|||
= stylesheet_link_tag "blueprint/print", :media => 'print'
|
||||
= include_stylesheets :default, :media => 'all'
|
||||
|
||||
|
||||
= javascript_include_tag "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"
|
||||
<!--[if IE]>
|
||||
= javascript_include_tag "/javascripts/ie.js"
|
||||
<![endif]-->
|
||||
= javascript_include_tag AppConfig[:pod_uri].scheme.to_s + "://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"
|
||||
|
||||
:javascript
|
||||
!window.jQuery && document.write(unescape('%3Cscript src="/javascripts/vendor/jquery144.min.js"%3E%3C/script%3E'))
|
||||
|
|
@ -33,7 +35,7 @@
|
|||
= include_javascripts :main
|
||||
|
||||
- if current_user
|
||||
= include_javascripts :flash_socket unless modern_browser?
|
||||
= include_javascripts :flash_socket #unless modern_browser?
|
||||
= javascript_include_tag 'web-socket-receiver'
|
||||
= render 'js/websocket_js'
|
||||
|
||||
|
|
@ -83,7 +85,7 @@
|
|||
= yield
|
||||
|
||||
.clearfix
|
||||
|
||||
/=render :partial => 'layouts/debug.haml'
|
||||
%footer
|
||||
.container
|
||||
= image_tag 'powered_by_diaspora.png', :height => "11px", :width => "145px"
|
||||
|
|
@ -91,7 +93,7 @@
|
|||
%li= link_to '@joindiaspora', "http://twitter.com/joindiaspora"
|
||||
%li= link_to 'github', "https://github.com/diaspora/diaspora"
|
||||
%li= link_to t('layouts.header.blog'), "http://blog.joindiaspora.com"
|
||||
%li= link_to t('layouts.header.code'), "#{root_url}source.tar.gz"
|
||||
%li= link_to t('layouts.header.code'), "#{root_url.chomp('/')}/source.tar.gz" unless request.url.match(/joindiaspora.com/)
|
||||
%li= link_to t('.whats_new'), 'https://github.com/diaspora/diaspora/wiki/Changelog'
|
||||
|
||||
-if !@landing_page && request.url.match(/joindiaspora.com/)
|
||||
|
|
|
|||
|
|
@ -10,17 +10,19 @@
|
|||
|
||||
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
|
||||
|
||||
= include_javascripts :mobile
|
||||
= include_javascripts :mobile
|
||||
= stylesheet_link_tag 'vendor/jquery_mobile.min', 'mobile'
|
||||
= csrf_meta_tag
|
||||
|
||||
|
||||
:javascript
|
||||
$(document).ready(Mobile.initialize);
|
||||
|
||||
= yield(:head)
|
||||
|
||||
%body
|
||||
%div{:data => {:role => 'header', :nobackbtn => 'true'}}
|
||||
= link_to image_tag('logo_large.png', :height => "32px", :width => "321px", :class => "diaspora_header_logo"), root_path
|
||||
#content{:data => {:role => 'page', :theme => "b"}}
|
||||
#content{:data => {:role => 'page'}}
|
||||
%div{:data => {:role => 'header', :nobackbtn => 'true'}}
|
||||
%h4
|
||||
DIASPORA*
|
||||
/= link_to image_tag('logo_large.png', :height => "32px", :width => "321px", :class => "diaspora_header_logo"), root_path
|
||||
= yield
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
:javascript
|
||||
$('.mark_all_read').live('click', function(){
|
||||
$.ajax({
|
||||
url: 'notifications/read_all',
|
||||
url: 'notifications/read_all',
|
||||
success: function(data, status, xhr) {
|
||||
$('.message').removeClass('unread');
|
||||
$('.stream_element').removeClass('unread');
|
||||
$("#notification_badge_number").addClass("hidden");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.message').live('click', function(evt){
|
||||
var note = $(this).closest('.message'),
|
||||
$('.stream_element').live('click', function(evt){
|
||||
var note = $(this).closest('.stream_element'),
|
||||
note_id = note.attr('data-guid'),
|
||||
nBadge = $("#notification_badge_number");
|
||||
|
||||
|
|
@ -47,9 +47,10 @@
|
|||
%h4= day
|
||||
%ul.notifications_for_day
|
||||
- notes.each do |note|
|
||||
%li.message{:data=>{:guid => note.id}, :class => "#{note.unread ? 'unread' : ''}"}
|
||||
.stream_element{:data=>{:guid => note.id}, :class => "#{note.unread ? 'unread' : ''}"}
|
||||
%span.from
|
||||
= link_to "#{note.actor.name.titleize}", person_path(note.actor)
|
||||
= object_link(note)
|
||||
|
||||
%span.time= "#{t('ago', :time => time_ago_in_words(note.created_at))}"
|
||||
%span.time= timeago(note.created_at)
|
||||
= will_paginate @notifications
|
||||
|
|
|
|||
17
app/views/notifier/also_commented.html.haml
Normal file
17
app/views/notifier/also_commented.html.haml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
%p
|
||||
= t('notifier.hello', :name => @receiver.profile.first_name)
|
||||
%p
|
||||
= "#{@sender.name} (#{@sender.diaspora_handle})"
|
||||
= t('.commented', :post_author => @post_author_name)
|
||||
%br
|
||||
%br
|
||||
= @comment.text
|
||||
|
||||
%br
|
||||
%br
|
||||
= link_to t('.sign_in'), status_message_url(@comment.post)
|
||||
|
||||
%br
|
||||
= t('notifier.love')
|
||||
%br
|
||||
= t('notifier.diaspora')
|
||||
9
app/views/notifier/also_commented.text.haml
Normal file
9
app/views/notifier/also_commented.text.haml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
= t('notifier.hello', :name => @receiver.profile.first_name)
|
||||
= "#{@sender.name} (#{@sender.diaspora_handle})"
|
||||
= t('notifier.also_commented.commented')
|
||||
|
||||
|
||||
= @comment.text
|
||||
|
||||
= "#{t('notifier.love')} \n"
|
||||
= t('notifier.diaspora')
|
||||
13
app/views/notifier/comment_on_post.html.haml
Normal file
13
app/views/notifier/comment_on_post.html.haml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
%p
|
||||
= t('notifier.hello', :name => @receiver.profile.first_name)
|
||||
%p
|
||||
= "#{@sender.name} (#{@sender.diaspora_handle})"
|
||||
= t('.commented')
|
||||
|
||||
%br
|
||||
= link_to t('.sign_in'), status_message_url(@comment.post)
|
||||
|
||||
%br
|
||||
= t('notifier.love')
|
||||
%br
|
||||
= t('notifier.diaspora')
|
||||
7
app/views/notifier/comment_on_post.text.haml
Normal file
7
app/views/notifier/comment_on_post.text.haml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
= t('notifier.hello', :name => @receiver.profile.first_name)
|
||||
= "#{@sender.name} (#{@sender.diaspora_handle})"
|
||||
= t('notifier.comment_on_post.commented')
|
||||
|
||||
|
||||
= "#{t('notifier.love')} \n"
|
||||
= t('notifier.diaspora')
|
||||
|
|
@ -4,6 +4,8 @@
|
|||
= "#{@sender.name} (#{@sender.diaspora_handle})"
|
||||
= t('.accepted')
|
||||
|
||||
%br
|
||||
= link_to t('.sign_in'), new_user_session_url
|
||||
%br
|
||||
= t('notifier.love')
|
||||
%br
|
||||
|
|
|
|||
|
|
@ -31,18 +31,17 @@
|
|||
= t('people.person.pending_request')
|
||||
|
||||
.badges{:class => ("hidden" if !contact)}
|
||||
- for aspect in aspects_with_person
|
||||
= render :partial => 'aspects/aspect_badge', :locals => {:aspect => aspect}
|
||||
= aspect_badges(aspects_with_person)
|
||||
.right
|
||||
= link_to t('.edit_membership'), "#", :id=> "edit_contact_aspects"
|
||||
|
||||
.edit{:class => ("hidden" if contact)}
|
||||
|
||||
.edit.hidden
|
||||
= render :partial => 'people/share_with_pane',
|
||||
:locals => {:person => person,
|
||||
:contact => contact,
|
||||
:aspects_with_person => aspects_with_person,
|
||||
:aspects_without_person => aspects_without_person}
|
||||
%br
|
||||
|
||||
- if contact
|
||||
.right
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
%li.message{:id => person.id}
|
||||
.stream_element{:id => person.id}
|
||||
|
||||
.right{:style=>"display:inline;"}
|
||||
- if person.owner_id == current_user.id
|
||||
|
|
@ -12,12 +12,12 @@
|
|||
- elsif (contact && contact.pending) || request
|
||||
= t('.pending_request')
|
||||
- else
|
||||
- single_aspect_form ||= nil
|
||||
= link_to "start sharing",
|
||||
{:controller => "people",
|
||||
:action => "share_with",
|
||||
:id => person.id},
|
||||
:class => 'button share_with_button'
|
||||
:class => 'button',
|
||||
:rel => 'facebox'
|
||||
|
||||
= person_image_link(person)
|
||||
|
||||
|
|
@ -25,7 +25,6 @@
|
|||
%span.from
|
||||
=person_link(person)
|
||||
|
||||
|
||||
.info
|
||||
= person.diaspora_handle
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
:locals => {:person => person,
|
||||
:contact => contact,
|
||||
:aspects_with_person => @aspects_with_person,
|
||||
:aspects_without_person => @aspects.reject{ |aspect| @aspects_with_person.include?(aspect)}}
|
||||
:aspects_without_person => @all_aspects.reject{ |aspect| @aspects_with_person.include?(aspect)}}
|
||||
%br
|
||||
%hr{:style=>"width:300px;"}
|
||||
|
||||
|
|
@ -39,19 +39,19 @@
|
|||
%ul#profile_information
|
||||
%li
|
||||
- unless person.profile.bio.blank?
|
||||
%h3
|
||||
%h4
|
||||
=t('.bio')
|
||||
= markdownify(person.profile.bio, :newlines => true)
|
||||
|
||||
%li.span-8.last
|
||||
.span-4
|
||||
- unless person.profile.gender.blank?
|
||||
%h3
|
||||
%h4
|
||||
=t('.gender')
|
||||
= person.profile.gender
|
||||
|
||||
.span-4.last
|
||||
- unless person.profile.birthday.blank?
|
||||
%h3
|
||||
%h4
|
||||
=t('.born')
|
||||
= birthday_format(person.profile.birthday)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
.contact_list#aspects_list
|
||||
.aspect_list#aspects_list
|
||||
%ul
|
||||
- for aspect in aspects_with_person
|
||||
%li{:data=>{:guid=>aspect.id}}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
=t('.no_one_found')
|
||||
|
||||
- else
|
||||
%ul{:class => 'stream people', :id => 'people_stream'}
|
||||
#people_stream.stream
|
||||
- for hash in @hashes
|
||||
= render :partial => 'people/person', :locals => hash
|
||||
|
||||
|
|
|
|||
|
|
@ -3,12 +3,13 @@
|
|||
-# the COPYRIGHT file.
|
||||
|
||||
#share_with
|
||||
.share_with_header
|
||||
= person_image_link(@person, :size => :thumb_medium)
|
||||
%h3
|
||||
#facebox_header
|
||||
= person_image_link(@person, :size => :thumb_small)
|
||||
%h4
|
||||
= t('.share_with', :name => @person.name)
|
||||
%p
|
||||
= t('.accepts', :name => @person.first_name)
|
||||
|
||||
.description
|
||||
= t('.accepts', :name => @person.first_name)
|
||||
|
||||
= render :partial => 'share_with_pane',
|
||||
:locals => {:person => @person,
|
||||
|
|
|
|||
|
|
@ -5,19 +5,6 @@
|
|||
- content_for :page_title do
|
||||
= @person.name
|
||||
|
||||
.span-24.last
|
||||
#author_info
|
||||
.from{:style=>"padding-left:0;display:block;"}
|
||||
%h2{:style=>"display:block;"}
|
||||
= @person.name
|
||||
.right{:style => "top:0;"}
|
||||
%span.description
|
||||
= @person.diaspora_handle
|
||||
|
||||
#person_nav_links
|
||||
= link_to t('layouts.header.view_profile'), person_path(@person)
|
||||
= link_to t('_photos'), person_photos_path(@person)
|
||||
|
||||
.span-8.append-1.last
|
||||
= render :partial => 'people/profile_sidebar', :locals => {:person => @person, :contact => @contact }
|
||||
|
||||
|
|
@ -31,6 +18,29 @@
|
|||
= person_image_link person
|
||||
|
||||
.span-15.last
|
||||
#author_info
|
||||
- unless @contact || current_user.person == @person
|
||||
.right
|
||||
= link_to "start sharing",
|
||||
{:controller => "people",
|
||||
:action => "share_with",
|
||||
:id => @person.id},
|
||||
:class => 'share_with button',
|
||||
:rel => 'facebox'
|
||||
|
||||
- else
|
||||
.right
|
||||
- if @post_type == :photos
|
||||
= link_to t('layouts.header.view_profile'), person_path(@person)
|
||||
- else
|
||||
= link_to t('_photos'), person_photos_path(@person)
|
||||
|
||||
%h3
|
||||
= @person.name
|
||||
.description
|
||||
= @person.diaspora_handle
|
||||
%hr
|
||||
|
||||
- unless @contact || current_user.person == @person
|
||||
- if @incoming_request
|
||||
.floating
|
||||
|
|
@ -42,22 +52,15 @@
|
|||
|
||||
- if @posts.count > 0
|
||||
-if @post_type == :photos
|
||||
%h4
|
||||
= t('_photos')
|
||||
= render 'photos/index', :photos => @posts
|
||||
- else
|
||||
%h4
|
||||
- if @contact
|
||||
= t('.recent_posts')
|
||||
- else
|
||||
= t('.recent_public_posts')
|
||||
|
||||
%ul{:class => 'stream', :id => 'main_stream'}
|
||||
#main_stream.stream
|
||||
= render 'shared/stream', :posts => @post_hashes
|
||||
|
||||
= will_paginate @posts
|
||||
|
||||
- else
|
||||
%ul#stream
|
||||
%li
|
||||
%h3= t('.no_posts')
|
||||
#stream
|
||||
%li{:style=>"text-align:center;"}
|
||||
.dull= t('.no_posts')
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
|
||||
- content_for :head do
|
||||
|
||||
:javascript
|
||||
$(document).ready(function(){
|
||||
$("#thumbnails").find("img").bind("mouseenter",function(){
|
||||
|
|
|
|||
|
|
@ -4,9 +4,12 @@
|
|||
|
||||
:javascript
|
||||
function createUploader(){
|
||||
|
||||
var aspectIds = "#{aspect_ids}".split(',');
|
||||
|
||||
var uploader = new qq.FileUploaderBasic({
|
||||
element: document.getElementById('file-upload'),
|
||||
params: {'photo' : {'pending' : 'true', 'aspect_ids' : "#{aspect_id}"}, 'set_profile_image' : "#{set_profile_image if defined?(set_profile_image)}"},
|
||||
params: {'photo' : {'pending' : 'true', 'aspect_ids' : aspectIds}, 'set_profile_image' : "#{set_profile_image if defined?(set_profile_image)}"},
|
||||
allowedExtensions: ['jpg', 'jpeg', 'png'],
|
||||
action: "#{photos_path}",
|
||||
debug: true,
|
||||
|
|
@ -52,4 +55,4 @@
|
|||
});
|
||||
}
|
||||
|
||||
window.onload = createUploader;
|
||||
createUploader();
|
||||
|
|
|
|||
|
|
@ -7,10 +7,11 @@
|
|||
|
||||
.span-15.append-1.last
|
||||
#photo_controls
|
||||
.right
|
||||
=link_to "← #{t('previous')}", @prev_photo, :rel => 'prefetch', :id => 'photo_show_left'
|
||||
\/
|
||||
=link_to "#{t('next')} →", @next_photo, :rel => 'prefetch', :id => 'photo_show_right'
|
||||
-if @additional_photos && @additional_photos.length > 1
|
||||
.right
|
||||
=link_to "← #{t('previous')}", @prev_photo, :rel => 'prefetch', :id => 'photo_show_left'
|
||||
\/
|
||||
=link_to "#{t('next')} →", @next_photo, :rel => 'prefetch', :id => 'photo_show_right'
|
||||
|
||||
- if @photo.status_message_id
|
||||
=link_to "← #{t('.view_original_post')}", @photo.status_message
|
||||
|
|
@ -60,6 +61,6 @@
|
|||
|
||||
%h4= t('_comments')
|
||||
|
||||
%ul{:id => 'photo_stream', :class => 'stream show'}
|
||||
%li.message{:data=>{:guid=>@parent.id}}
|
||||
#photo_stream.stream.show
|
||||
%div{:data=>{:guid=>@parent.id}}
|
||||
= render "comments/comments", :post_id => @parent.id, :comment_hashes => @comment_hashes, :always_expanded => true
|
||||
|
|
|
|||
50
app/views/publics/hcard.html.haml
Normal file
50
app/views/publics/hcard.html.haml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#content
|
||||
%h1= @person.name
|
||||
#content_inner
|
||||
#i.entity_profile.vcard.author
|
||||
%h2 User profile
|
||||
|
||||
%dl.entity_nickname
|
||||
%dt Nickname
|
||||
%dd
|
||||
%a.nickname.url.uid{:href=>@person.url, :rel=>'me'}= @person.name
|
||||
|
||||
%dl.entity_given_name
|
||||
%dt First name
|
||||
%dd
|
||||
%span.given_name= @person.profile.first_name
|
||||
|
||||
%dl.entity_family_name
|
||||
%dt Family name
|
||||
%dd
|
||||
%span.family_name= @person.profile.last_name
|
||||
|
||||
%dl.entity_fn
|
||||
%dt Full name
|
||||
%dd
|
||||
%span.fn= @person.name
|
||||
|
||||
%dl.entity_url
|
||||
%dt URL
|
||||
%dd
|
||||
%a#pod_location.url{:href=>@person.url, :rel=>'me'}= @person.url
|
||||
|
||||
%dl.entity_photo
|
||||
%dt Photo
|
||||
%dd
|
||||
%img.photo.avatar{:src=>image_or_default(@person), :width=>'300px', :height=>'300px'}
|
||||
|
||||
%dl.entity_photo_medium
|
||||
%dt Photo
|
||||
%dd
|
||||
%img.photo.avatar{:src=>image_or_default(@person, :thumb_medium), :width=>'100px', :height=>'100px'}
|
||||
|
||||
%dl.entity_photo_small
|
||||
%dt Photo
|
||||
%dd
|
||||
%img.photo.avatar{:src=>image_or_default(@person, :thumb_small), :width=>'50px', :height=>'50px'}
|
||||
|
||||
%dl.entity_searchable
|
||||
%dt Searchable
|
||||
%dd
|
||||
%span.searchable= @person.profile.searchable
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
xmlns:hm='http://host-meta.net/xrd/1.0'>
|
||||
<hm:Host><%= AppConfig[:pod_uri].host %></hm:Host>
|
||||
<Link rel='lrdd'
|
||||
template='<%= AppConfig[:pod_url] %>webfinger?q={uri}'>
|
||||
template='<%= AppConfig[:pod_url].chomp("/") %>/webfinger?q={uri}'>
|
||||
<Title>Resource Descriptor</Title>
|
||||
</Link>
|
||||
</XRD>
|
||||
|
|
|
|||
9
app/views/publics/host_meta.html.erb
Normal file
9
app/views/publics/host_meta.html.erb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'
|
||||
xmlns:hm='http://host-meta.net/xrd/1.0'>
|
||||
<hm:Host><%= AppConfig[:pod_uri].host %></hm:Host>
|
||||
<Link rel='lrdd'
|
||||
template='<%= AppConfig[:pod_url] %>webfinger?q={uri}'>
|
||||
<Title>Resource Descriptor</Title>
|
||||
</Link>
|
||||
</XRD>
|
||||
12
app/views/publics/webfinger.html.erb
Normal file
12
app/views/publics/webfinger.html.erb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
|
||||
<Subject>acct:<%=@person.diaspora_handle%></Subject>
|
||||
<Alias>"<%= @person.url %>"</Alias>
|
||||
<Link rel="http://microformats.org/profile/hcard" type="text/html" href="<%=@person.url%>hcard/users/<%=@person.id%>"/>
|
||||
<Link rel="http://joindiaspora.com/seed_location" type = 'text/html' href="<%=@person.url%>"/>
|
||||
<Link rel="http://joindiaspora.com/guid" type = 'text/html' href="<%=@person.id%>"/>
|
||||
|
||||
<Link rel="http://schemas.google.com/g/2010#updates-from" type="application/atom+xml" href="<%=@person.public_url%>.atom"/>
|
||||
|
||||
<Link rel="diaspora-public-key" type = 'RSA' href="<%=Base64.encode64(@person.exported_key)%>"/>
|
||||
</XRD>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
-# the COPYRIGHT file.
|
||||
|
||||
|
||||
%h4
|
||||
%h5
|
||||
= t('aspects.manage.add_a_new_contact')
|
||||
= info_text(t('.enter_a_diaspora_username'))
|
||||
|
||||
|
|
|
|||
|
|
@ -4,15 +4,6 @@
|
|||
%h4
|
||||
= person.name
|
||||
|
||||
- if post.public?
|
||||
%span.arrow ➔
|
||||
%span.aspect_badge.public
|
||||
=t('the_world')
|
||||
|
||||
- elsif current_user.owns?(post)
|
||||
%span.arrow ➔
|
||||
=aspect_badge(aspects_with_post(post.aspects, post))
|
||||
|
||||
#person_nav_links
|
||||
= link_to t('layouts.header.view_profile'), person_path(person)
|
||||
= link_to t('_photos'), person_photos_path(person)
|
||||
|
|
|
|||
|
|
@ -8,8 +8,11 @@
|
|||
%ul
|
||||
- for hash in contact_hashes
|
||||
%li
|
||||
%span.name
|
||||
= person_image_tag hash[:person]
|
||||
%h4.name
|
||||
= link_to hash[:person].name, hash[:person]
|
||||
.description
|
||||
= hash[:person].diaspora_handle
|
||||
.right
|
||||
= aspect_membership_button(aspect_id, hash[:contact], hash[:person])
|
||||
|
||||
|
|
|
|||
|
|
@ -3,40 +3,11 @@
|
|||
-# the COPYRIGHT file.
|
||||
|
||||
|
||||
- content_for :head do
|
||||
:javascript
|
||||
$(document).ready(function(){
|
||||
$("div.public_toggle input").bind("click", function(evt){
|
||||
$("#publisher_service_icons").toggleClass("dim");
|
||||
if($(this).attr('checked') == true){
|
||||
$(".question_mark").click();
|
||||
};
|
||||
});
|
||||
|
||||
if($("textarea#status_message_message").val() != ""){
|
||||
$("#publisher").removeClass("closed");
|
||||
$("#publisher").find("textarea").focus();
|
||||
$("#publisher .options_and_submit").show();
|
||||
}
|
||||
|
||||
$("#publisher textarea, #publisher input").bind("focus", function(evt){
|
||||
$("#publisher .options_and_submit").show();
|
||||
});
|
||||
|
||||
$("#click_to_share").find("a").bind("click", function(evt){
|
||||
$("#publisher").removeClass("closed");
|
||||
$("#publisher").find("textarea").focus();
|
||||
});
|
||||
});
|
||||
|
||||
#publisher{:class=>"closed"}
|
||||
#publisher{:class => ("closed" unless params[:op] || params[:prefill])}
|
||||
|
||||
#click_to_share
|
||||
= image_tag 'icons/doc_edit.png'
|
||||
- if aspect == :all
|
||||
= link_to t('.share_with_all'), '#', :id => 'expand_publisher'
|
||||
- else
|
||||
= link_to t('.post_a_message_to', :aspect => aspect), '#', :id => 'expand_publisher'
|
||||
= publisher_description(@aspect_ids.count, aspect)
|
||||
|
||||
.content_creation
|
||||
= form_for(StatusMessage.new, :remote => true) do |status|
|
||||
|
|
@ -50,19 +21,19 @@
|
|||
%params
|
||||
#publisher_textarea_wrapper
|
||||
%ul#photodropzone
|
||||
= status.text_area :message, :rows => 2, :value => params[:prefill]
|
||||
= status.text_area :message, :rows => 2, :value => h(params[:prefill])
|
||||
|
||||
= status.hidden_field :aspect_ids, :value => (aspect == :all ? aspect : aspect.id)
|
||||
- for aspect_id in @aspect_ids
|
||||
= hidden_field_tag 'aspect_ids[]', aspect_id.to_s
|
||||
|
||||
.options_and_submit
|
||||
|
||||
.right
|
||||
#fileInfo
|
||||
= image_tag 'ajax-loader.gif', :class => 'hidden', :id => "publisher_spinner"
|
||||
- if aspect == :all
|
||||
= status.submit t('.share'), :title => t('.share_with_all'), :disable_with => t('.posting')
|
||||
= status.submit t('.share'), :title => t('.share_with_all'), :disable_with => t('.posting'), :class => 'button'
|
||||
- else
|
||||
= status.submit t('.share'), :title => t('.share_with', :aspect => aspect), :disable_with => t('.posting')
|
||||
= status.submit t('.share'), :disable_with => t('.posting'), :class => 'button'
|
||||
|
||||
- if aspect == :all
|
||||
.public_toggle
|
||||
|
|
@ -75,12 +46,12 @@
|
|||
- for service in current_user.services
|
||||
= image_tag "social_media_logos/#{service.provider}-16x16.png", :title => service.provider
|
||||
|
||||
= link_to '(?)', "#question_mark_pane", :class => 'question_mark', :style=>"display:none;"
|
||||
= link_to '(?)', "#question_mark_pane", :class => 'question_mark', :style=>"display:none;", :rel => 'facebox'
|
||||
|
||||
.fancybox_content
|
||||
.facebox_content
|
||||
#question_mark_pane
|
||||
= render 'shared/public_explain'
|
||||
|
||||
#publisher_photo_upload
|
||||
= render 'photos/new_photo', :aspect_id => (aspect == :all ? aspect : aspect.id)
|
||||
= render 'photos/new_photo', :aspect_ids => @aspect_ids.join(',')
|
||||
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@
|
|||
= link_to t('.reshare'), "#"
|
||||
|
||||
%ul.reshare_box
|
||||
= aspect_links(aspects, :prefill => CGI::escape(post.message))
|
||||
= aspect_links(aspects, :prefill => post.message)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
- for post_hash in posts
|
||||
= render 'shared/stream_element', post_hash.merge(:aspects => @aspects, :commenting_disabled => defined?(@commenting_disabled))
|
||||
|
||||
|
||||
- if posts.length > 0
|
||||
- for post_hash in posts
|
||||
= render 'shared/stream_element', post_hash.merge(:all_aspects => @all_aspects, :commenting_disabled => defined?(@commenting_disabled))
|
||||
|
||||
- else
|
||||
= render 'aspects/no_posts_message', :post_count => posts.length
|
||||
|
|
|
|||
|
|
@ -2,30 +2,31 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
%li.message{:data=>{:guid=>post.id}}
|
||||
.stream_element{:data=>{:guid=>post.id}}
|
||||
- if person.owner_id == current_user.id
|
||||
.right.controls
|
||||
- reshare_aspects = aspects_without_post(aspects, post)
|
||||
.right.hidden.controls
|
||||
- reshare_aspects = aspects_without_post(all_aspects, post)
|
||||
- unless reshare_aspects.empty?
|
||||
= render 'shared/reshare', :aspects => reshare_aspects, :post => post
|
||||
= link_to t('delete'), status_message_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
|
||||
= link_to image_tag('deletelabel.png'), status_message_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete", :title => t('delete')
|
||||
|
||||
= person_image_link(person, :size => :thumb_small)
|
||||
|
||||
.content
|
||||
.from
|
||||
%h4
|
||||
%h5
|
||||
=person_link(person)
|
||||
|
||||
- if post.public?
|
||||
%span.arrow ➔
|
||||
%span.aspect_badge.public
|
||||
= t('the_world')
|
||||
%span.aspect_badges
|
||||
%span.aspect_badge.public
|
||||
= t('the_world')
|
||||
|
||||
- elsif person.owner_id == current_user.id
|
||||
%span.arrow ➔
|
||||
= aspect_badge(aspects_with_post(aspects, post))
|
||||
|
||||
%span.aspect_badges
|
||||
= aspect_badges(aspects_with_post(all_aspects, post))
|
||||
|
||||
= render 'status_messages/status_message', :post => post, :photos => photos
|
||||
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
%li.message{:data=>{:guid=>post.id}}
|
||||
= person_image_link(post.person)
|
||||
|
||||
.content
|
||||
.from
|
||||
= link_to post.person.name, post.person
|
||||
.aspect
|
||||
➔
|
||||
- if post.public?
|
||||
= t('the_world')
|
||||
- else
|
||||
= current_user.aspects_with_post( post.id ).join(', ')
|
||||
|
||||
= render type_partial(post), :post => post
|
||||
|
||||
.info
|
||||
%span.time= link_to(how_long_ago(post), object_path(post))
|
||||
/= link_to "#{t('.show_comments')} (#{post.comments.count})", '#', :class => "show_post_comments"
|
||||
|
||||
- if current_user.owns?(post)
|
||||
.right
|
||||
= link_to t('delete'), photo_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
|
||||
/= render "comments/comments", :post => post
|
||||
|
||||
|
|
@ -25,7 +25,8 @@
|
|||
#original_post_info
|
||||
= render 'shared/author_info', :person => @status_message.person, :post => @status_message
|
||||
|
||||
%h4{:style=>"margin-bottom:5px;"}= t('_comments')
|
||||
%ul{:class => 'stream show', :id => 'status_message_stream'}
|
||||
%li.message{:data=>{:guid=>@status_message.id}}
|
||||
%h4= t('_comments')
|
||||
|
||||
#status_message_stream.stream.show
|
||||
%div{:data=>{:guid=>@status_message.id}}
|
||||
= render "comments/comments", :post_id => @status_message.id, :comment_hashes => @comment_hashes, :always_expanded => true
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
|
||||
%ul#aspect_list
|
||||
- for aspect in @aspects
|
||||
- for aspect in @all_aspects
|
||||
%li.aspect{:data=>{:guid=>aspect.id}}
|
||||
|
||||
.aspect_name
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
.description
|
||||
= t('.ready_to_share')
|
||||
%ul.inline_aspect_listing
|
||||
- for aspect in @aspects
|
||||
- for aspect in @all_aspects
|
||||
%li= aspect
|
||||
|
||||
%br
|
||||
|
|
|
|||
|
|
@ -1,6 +1,15 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
require 'autotest/growl'
|
||||
Autotest.add_discovery { "rails" }
|
||||
Autotest.add_discovery { "rspec2" }
|
||||
Autotest.add_hook :initialize do |at|
|
||||
at.add_mapping(%r%^spec/(intergration|mailers|config)/.*rb$%) { |filename, _|
|
||||
filename
|
||||
}
|
||||
|
||||
at.add_mapping(%r%^spec/misc_spec.rb$%) { |filename, _|
|
||||
filename
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,2 +1,5 @@
|
|||
42 * * * * cd /usr/local/app/diaspora && exec /usr/local/bin/ruby /usr/local/bin/bundle exec rake backup:mongo 2>> /usr/local/app/diaspora/log/rake_mongo.log
|
||||
42 15 * * * cd /usr/local/app/diaspora && exec /usr/local/bin/ruby /usr/local/bin/bundle exec rake backup:photos 2>> /usr/local/app/diaspora/log/rake_photos.log
|
||||
42 * * * * cd /usr/local/app/diaspora && exec /usr/local/bin/ruby /usr/local/bin/bundle exec rake --trace backup:mongo &> /usr/local/app/diaspora/log/rake_mongo.log
|
||||
42 15 * * * cd /usr/local/app/diaspora && exec /usr/local/bin/ruby /usr/local/bin/bundle exec rake --trace backup:photos &> /usr/local/app/diaspora/log/rake_photos.log
|
||||
#statistics
|
||||
42 15 * * * cd /usr/local/app/diaspora && exec /usr/local/bin/ruby /usr/local/bin/bundle exec rake --trace statistics:users_splunk &> /usr/local/app/diaspora/log/stats.log
|
||||
42 15 * * * cd /usr/local/app/diaspora && exec /usr/local/bin/ruby /usr/local/bin/bundle exec rake --trace statistics:content_splunk &> /usr/local/app/diaspora/log/stats.log
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
require ::File.expand_path('../config/environment', __FILE__)
|
||||
#use Rack::FiberPool
|
||||
require ::File.expand_path('../lib/chrome_frame', __FILE__)
|
||||
|
||||
use Rack::ChromeFrame, :minimum => 8
|
||||
run Diaspora::Application
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ default:
|
|||
# ActionMailer class.
|
||||
mailer_on: false
|
||||
|
||||
# This chooses which mailer should be used. 'smtp' for a smtp
|
||||
# connection or 'sendmail' to use the sendmail binary.
|
||||
mailer_method: 'smtp'
|
||||
|
||||
# Address/port to smtp server handing outgoing mail.
|
||||
smtp_address: 'smtp.example.com'
|
||||
smtp_port: '587'
|
||||
|
|
@ -66,6 +70,9 @@ default:
|
|||
smtp_username: 'smtp_username'
|
||||
smtp_password: 'secret'
|
||||
|
||||
# The path to the sendmail binary.
|
||||
sendmail_location: '/usr/sbin/sendmail'
|
||||
|
||||
#google analytics key, if false, it won't include the javascript
|
||||
google_a_site: false
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ require 'rails/all'
|
|||
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
||||
|
||||
require File.expand_path('../../lib/log_overrider', __FILE__)
|
||||
require File.expand_path('../../lib/message_handler', __FILE__)
|
||||
module Diaspora
|
||||
class Application < Rails::Application
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
|
|
@ -52,5 +51,6 @@ module Diaspora
|
|||
config.filter_parameters += [:text]
|
||||
config.filter_parameters += [:caption]
|
||||
config.filter_parameters += [:bio]
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue