Skip to content
Extraits de code Groupes Projets
Valider 2ac47590 rédigé par ilya's avatar ilya
Parcourir les fichiers

Merge branch 'master' of github.com:diaspora/diaspora_rails

parents 2b42ef21 b6c63168
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -4,6 +4,9 @@ class CommentsController < ApplicationController
def create
target = Post.first(:id => params[:comment][:post_id])
text = params[:comment][:text]
puts params.inspect
if current_user.comment text, :on => target
render :text => "Woo!"
else
......
%div.comments
= render "comments/new_comment", :post => post
/= render "comments/new_comment", :post => post
%ul.comment_set
- for comment in post.comments
= render "comments/comment", :comment => comment
......
= form_for Comment.new, :remote => true do |f|
= f.error_messages
= form_tag("/comments",:remote => true, :class =>"new_comment", :id => "new_comment") do
%p
= f.text_field :text, :value => "dislike!"
= f.hidden_field :post_id, :value => post.id
= f.submit 'comment', :class => 'button'
= text_field_tag "comment_text", 'dislike!', :size => 30, :name => 'comment[text]'
= hidden_field_tag "comment_post_id", "#{post.id}", :name => "comment[post_id]"
= submit_tag 'comment', :id => "comment_submit", :name => "commit"
......@@ -3,7 +3,7 @@
= link_to_person post.person
= post.message
%div.time
= link_to "#{time_ago_in_words(post.updated_at)} ago", status_message_path(post)
= link_to(how_long_ago(post), status_message_path(post))
= render "comments/comments", :post => post
- if mine?(post)
= link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete
......
......@@ -10,6 +10,7 @@ module WebSocket
class << @view
include ApplicationHelper
include Rails.application.routes.url_helpers
include ActionView::Helpers::FormTagHelper
end
end
......@@ -29,8 +30,15 @@ module WebSocket
end
def self.view_hash(object)
v = WebSocket.view_for(object)
puts v
begin
puts "I be working hard"
v = WebSocket.view_for(object)
puts v.inspect
rescue
puts "in failzord " + v .inspect
raise "i suck"
end
{:class =>object.class.to_s.underscore.pluralize, :html => v}
end
......
# require 'addressable/uri'
# require 'eventmachine'
# require 'em-http'
class MessageHandler
NUM_TRIES = 3
......@@ -17,6 +13,9 @@ class MessageHandler
def add_post_request(destinations, body)
puts "yay"
puts destinations.inspect
puts body.inspect
destinations.each{|dest| @queue.push(Message.new(:post, dest, body))}
end
......@@ -25,7 +24,7 @@ class MessageHandler
case query.type
when :post
http = EventMachine::HttpRequest.new(query.destination).post :timeout => TIMEOUT, :body =>{:xml => query.body}
http.callback {puts query.inspect; process}
http.callback {puts query.body; process}
when :get
http = EventMachine::HttpRequest.new(query.destination).get :timeout => TIMEOUT
http.callback {send_to_seed(query, http.response); process}
......@@ -34,6 +33,7 @@ class MessageHandler
end
http.errback {
puts query.destination + " failed!"
query.try_count +=1
@queue.push query unless query.try_count >= NUM_TRIES
process
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter