diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a2a4ee3b5..c525ad1cd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,10 +1,9 @@ class ApplicationController < ActionController::Base - require 'lib/diaspora/ostatus_generator' protect_from_forgery :except => :receive layout 'application' - before_filter :set_friends_authors_and_status, :count_requests + before_filter :set_friends_and_status, :count_requests layout :layout_by_resource @@ -16,9 +15,8 @@ class ApplicationController < ActionController::Base end end - def set_friends_authors_and_status + def set_friends_and_status @friends = Person.friends.all if current_user - @subscribed_persons = Author.all if current_user @latest_status_message = StatusMessage.newest(current_user) if current_user end diff --git a/app/controllers/authors_controller.rb b/app/controllers/authors_controller.rb deleted file mode 100644 index bf88844b8..000000000 --- a/app/controllers/authors_controller.rb +++ /dev/null @@ -1,16 +0,0 @@ -class AuthorsController < ApplicationController - before_filter :authenticate_user! - - def show - @author= Author.where(:id => params[:id]).first - @author_ostatus_posts = @author.ostatus_posts.paginate :page => params[:page], :order => 'published_at DESC' - end - - - def destroy - current_user.unsubscribe_from_pubsub(params[:id]) - flash[:notice] = "unsubscribed person." - redirect_to ostatus_path - end - -end diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index 21e25d8c5..a74b12e43 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb @@ -6,7 +6,6 @@ class BlogsController < ApplicationController respond_to do |format| format.html - format.atom {render :xml => Diaspora::OStatus::generate(:current_url => request.url, :objects => @blogs)} end diff --git a/app/controllers/bookmarks_controller.rb b/app/controllers/bookmarks_controller.rb index 523cda326..79bf76d12 100644 --- a/app/controllers/bookmarks_controller.rb +++ b/app/controllers/bookmarks_controller.rb @@ -8,7 +8,6 @@ class BookmarksController < ApplicationController respond_to do |format| format.html - format.atom {render :xml => Diaspora::OStatus::generate(:current_url => request.url, :objects => @bookmarks)} end end diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index 5c64011ed..438163fff 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -6,9 +6,4 @@ class DashboardsController < ApplicationController @posts = Post.paginate :page => params[:page], :order => 'created_at DESC' end - def ostatus - @posts = OstatusPost.paginate :page => params[:page], :order => 'published_at DESC' - render :index - end - end diff --git a/app/controllers/publics_controller.rb b/app/controllers/publics_controller.rb index 96dd3b3e0..128999d09 100644 --- a/app/controllers/publics_controller.rb +++ b/app/controllers/publics_controller.rb @@ -1,7 +1,6 @@ class PublicsController < ApplicationController require 'lib/diaspora/parser' include Diaspora::Parser - include Diaspora::OStatusParser def hcard @user = User.owner @@ -18,14 +17,6 @@ class PublicsController < ApplicationController render 'webfinger', :layout => false, :content_type => 'application/xrd+xml' end - def hubbub - if params['hub.mode'] == 'subscribe' || params['hub.mode'] == 'unsubscribe' - render :text => params['hub.challenge'], :status => 202, :layout => false - else - Diaspora::OStatusParser::process(request.body.read) - end - end - def receive puts "SOMEONE JUST SENT ME: #{params[:xml]}" store_objects_from_xml params[:xml] diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index cf5ee7f63..f499492e8 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -7,7 +7,6 @@ class StatusMessagesController < ApplicationController respond_to do |format| format.html - format.atom {render :xml => Diaspora::OStatus::generate(:current_url => request.url, :objects => @status_messages)} end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 88a54e4c6..2e2895fbb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -17,11 +17,7 @@ module ApplicationHelper end def how_long_ago(obj) - if obj.is_a? OstatusPost - "#{time_ago_in_words(obj.published_at)} ago" - else - "#{time_ago_in_words(obj.created_at)} ago." - end + "#{time_ago_in_words(obj.created_at)} ago." end def person_url(person) diff --git a/app/helpers/dashboards_helper.rb b/app/helpers/dashboards_helper.rb index 457e9d522..3117b77ff 100644 --- a/app/helpers/dashboards_helper.rb +++ b/app/helpers/dashboards_helper.rb @@ -1,10 +1,6 @@ module DashboardsHelper def title_for_page - if params[:action] =='ostatus' - 'OStatus home' - else 'home' - end end end diff --git a/app/helpers/requests_helper.rb b/app/helpers/requests_helper.rb index 258d87e47..4404ec223 100644 --- a/app/helpers/requests_helper.rb +++ b/app/helpers/requests_helper.rb @@ -3,10 +3,8 @@ module RequestsHelper def subscription_mode(profile) if diaspora?(profile) :friend - elsif ostatus?(profile) - :subscribe else - :subscribe + :none end end @@ -14,19 +12,13 @@ module RequestsHelper profile_contains(profile, 'http://joindiaspora.com/seed_location') end - def ostatus?(profile) - profile_contains(profile, 'http://ostatus.org/schema/1.0/subscribe') - end - def profile_contains(profile, rel) profile.links.each{|x| return true if x.rel == rel} false end def subscription_url(action, profile) - if action == :subscribe - profile.links.select{|x| x.rel == 'http://schemas.google.com/g/2010#updates-from'}.first.href - elsif action == :friend + if action == :friend profile.links.select{|x| x.rel == 'http://joindiaspora.com/seed_location'}.first.href else nil @@ -34,14 +26,6 @@ module RequestsHelper end def relationship_flow(identifier) - if identifier.include?('.atom') - return {:subscribe => identifier} - end - - unless identifier.include?( '@' ) - return {:friend => identifier} - end - f = Redfinger.finger(identifier) action = subscription_mode(f) url = subscription_url(action, f) diff --git a/app/models/author.rb b/app/models/author.rb deleted file mode 100644 index 1547e67fa..000000000 --- a/app/models/author.rb +++ /dev/null @@ -1,30 +0,0 @@ -class Author - include MongoMapper::Document - - key :service, String - key :feed_url, String - key :avatar_thumbnail, String - key :username, String - key :profile_url, String - key :hub, String - - many :ostatus_posts, :class_name => 'OstatusPost', :foreign_key => :author_id - before_save :set_defaults - before_destroy :delete_posts - - def self.instantiate(opts) - author = Author.first(:feed_url => opts[:feed_url]) - author ||= Author.create(opts) - end - - private - - def set_defaults - self.avatar_thumbnail = nil if self.avatar_thumbnail == 0 - self.service = self.url if self.service == 0 - end - - def delete_posts - self.ostatus_posts.delete_all - end - end diff --git a/app/models/ostatus_post.rb b/app/models/ostatus_post.rb deleted file mode 100644 index d8d51a955..000000000 --- a/app/models/ostatus_post.rb +++ /dev/null @@ -1,17 +0,0 @@ -class OstatusPost - include MongoMapper::Document - - key :author_id, ObjectId - key :message, String - key :permalink, String - key :published_at, DateTime - - belongs_to :author, :class_name => 'Author' - - cattr_reader :per_page - @@per_page = 10 - - timestamps! - -end - diff --git a/app/models/user.rb b/app/models/user.rb index 0f97022d7..ba06815a8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,6 +1,4 @@ class User < Person - require 'lib/diaspora/ostatus_parser' - include Diaspora::OStatusParser devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable @@ -95,27 +93,9 @@ class User < Person end end - ####ostatus###### - # - def subscribe_to_pubsub(feed_url) - r = Request.instantiate(:to => feed_url, :from => self) - r.subscribe_to_ostatus(feed_url) - r - end - - def unsubscribe_from_pubsub(author_id) - bad_author = Author.first(:id => author_id) - r = Request.instantiate(:to => bad_author.hub, :from => self) - r.unsubscribe_from_ostatus(bad_author.feed_url) - bad_author.destroy - end - - def send_request(rel_hash) if rel_hash[:friend] self.send_friend_request_to(rel_hash[:friend]) - elsif rel_hash[:subscribe] - self.subscribe_to_pubsub(rel_hash[:subscribe]) else raise "you can't do anything to that url" end diff --git a/app/views/authors/show.html.haml b/app/views/authors/show.html.haml deleted file mode 100644 index 89b6cd165..000000000 --- a/app/views/authors/show.html.haml +++ /dev/null @@ -1,21 +0,0 @@ -%h1.big_text - .back - = link_to '⇧ ostatus', ostatus_path - = "#{@author.username}'s stream" - -.sub_header - = @author.profile_url - -- if @author_ostatus_posts - %ul#stream - - for post in @author_ostatus_posts - = render type_partial(post), :post => post - = will_paginate @author_ostatus_posts -- else - %h3 no posts to display! - -#content_bottom - .back - = link_to "⇧ ostatus", ostatus_path - .button.right - = link_to 'Unsubscribe', @author, :confirm => 'Are you sure?', :method => :delete diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 35298bdaf..7d069eeec 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -57,7 +57,6 @@ %ul.nav %li= link_to "home", root_path %li= link_to "photos", albums_path - %li= link_to "ostatus", ostatus_path %li= "|" %li= link_to "edit profile", edit_user_path(current_user) diff --git a/app/views/ostatus_posts/_ostatus_post.html.haml b/app/views/ostatus_posts/_ostatus_post.html.haml deleted file mode 100644 index b4eb09f11..000000000 --- a/app/views/ostatus_posts/_ostatus_post.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -%li.message{:id => post.id} - - = image_tag post.author.avatar_thumbnail, :class => "person_picture" unless post.author.avatar_thumbnail.nil? - - %span.from - = link_to post.author.username, author_path(post.author) - = auto_link post.message - - %div.time - = link_to(how_long_ago(post), object_path(post)) - from - = link_to post.author.service, post.author.profile_url diff --git a/app/views/ostatus_posts/index.html.haml b/app/views/ostatus_posts/index.html.haml deleted file mode 100644 index 28cf8be85..000000000 --- a/app/views/ostatus_posts/index.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%h1.big_text status messages -= render "status_messages/new_status_message", :status_message => @status_message -%ul#stream - - - for status_message in @status_messages - = render "status_message", :post => status_message -#pagination - = will_paginate @status_messages - diff --git a/app/views/ostatus_posts/show.html.haml b/app/views/ostatus_posts/show.html.haml deleted file mode 100644 index f40a47884..000000000 --- a/app/views/ostatus_posts/show.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -- title "Status Message" - -%p - %strong Message: - = @status_message.message - -%p - %strong Owner: - = @status_message.person.real_name - -%h4= "comments (#{@status_message.comments.count})" -= render "comments/comments", :post => @status_message - -%p - = link_to "Destroy", @status_message, :confirm => 'Are you sure?', :method => :delete - | - = link_to "View All", status_messages_path diff --git a/app/views/people/_sidebar.html.haml b/app/views/people/_sidebar.html.haml index 278b5f80b..79d2d0c41 100644 --- a/app/views/people/_sidebar.html.haml +++ b/app/views/people/_sidebar.html.haml @@ -8,9 +8,4 @@ %br %br - %h3 following - - - for author in @subscribed_persons - %li= link_to author.username, author_path(author) - = link_to "add a new person", requests_path diff --git a/config/routes.rb b/config/routes.rb index 044e53069..3726f5bf4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,11 +9,6 @@ Diaspora::Application.routes.draw do |map| resources :photos resources :albums - resources :authors - resources :ostatus_posts - - match 'ostatus', :to => "dashboards#ostatus" - match "/images/files/*path" => "gridfs#serve" match 'warzombie', :to => "dev_utilities#warzombie" @@ -31,7 +26,6 @@ Diaspora::Application.routes.draw do |map| #public routes match 'receive', :to => 'publics#receive' - match 'hubbub', :to => 'publics#hubbub' match '.well-known/host-meta',:to => 'publics#host_meta' match 'webfinger', :to => 'publics#webfinger' match 'hcard', :to => 'publics#hcard' diff --git a/gpg/diaspora-test/trustdb.gpg b/gpg/diaspora-test/trustdb.gpg index 6df22b2fd..1a5e3988f 100644 Binary files a/gpg/diaspora-test/trustdb.gpg and b/gpg/diaspora-test/trustdb.gpg differ diff --git a/lib/diaspora.rb b/lib/diaspora.rb index 265d0689a..8b6314488 100644 --- a/lib/diaspora.rb +++ b/lib/diaspora.rb @@ -3,7 +3,4 @@ module Diaspora autoload :Parser autoload :Webhooks - autoload :OStatusParser - autoload :OStatusGenerator - end diff --git a/lib/diaspora/ostatus_generator.rb b/lib/diaspora/ostatus_generator.rb deleted file mode 100644 index de0cb244f..000000000 --- a/lib/diaspora/ostatus_generator.rb +++ /dev/null @@ -1,70 +0,0 @@ -module Diaspora - module OStatusGenerator - def self.generate(opts= {}) - xml = Generate::headers(opts[:current_url]) - xml << Generate::author - xml << Generate::endpoints - xml << Generate::subject - xml << Generate::entries(opts[:objects]) - xml << Generate::footer - end - - module Generate - def self.headers(current_url) - #this is retarded - @@user = User.owner - <<-XML - - - Diaspora - #{current_url} - Stream - its a stream - #{Time.now.xmlschema} - XML - end - - def self.author - <<-XML - - #{@@user.real_name} - #{@@user.url} - - XML - end - - def self.endpoints - <<-XML - - XML - end - - def self.subject - <<-XML - - http://activitystrea.ms/schema/1.0/person - #{@@user.url} - #{@@user.real_name} - - - XML - end - - def self.entries(objects) - xml = "" - if objects.respond_to? :each - objects.each {|x| xml << x.to_activity} - else - xml << objects.to_activity - end - xml - end - - def self.footer - <<-XML.strip - - XML - end - end - end -end diff --git a/lib/diaspora/ostatus_parser.rb b/lib/diaspora/ostatus_parser.rb deleted file mode 100644 index 5cf126f8f..000000000 --- a/lib/diaspora/ostatus_parser.rb +++ /dev/null @@ -1,87 +0,0 @@ -module Diaspora - module OStatusParser - - def self.process(xml) - doc = Nokogiri::HTML(xml) - - hash = {} - hash[:author] = self.author(doc) - hash[:author][:hub] = self.hub(doc) - - hash[:entry] = self.entry(doc) - - author = Author.instantiate(hash[:author]) - author.ostatus_posts.create(hash[:entry]) if hash[:entry][:message] - end - - - def self.author(doc) - return { - :service => self.service(doc), - :feed_url => self.feed_url(doc), - :avatar_thumbnail => self.avatar_thumbnail(doc), - :username => self.username(doc), - :profile_url => self.profile_url(doc) - } - end - - def self.entry(doc) - return { - :message => self.message(doc), - :permalink => self.permalink(doc), - :published_at => self.published_at(doc), - :updated_at => self.updated_at(doc) - } - end - - - def self.hub(xml) - xml = Nokogiri::HTML(xml) if xml.is_a? String - xml.xpath('//link[@rel="hub"]').first.attribute("href").value - end - - # Author ######################### - def self.service(doc) - self.contents(doc.xpath('//generator')) - end - - def self.feed_url(doc) - self.contents(doc.xpath('//id')) - end - - def self.avatar_thumbnail(doc) - self.contents(doc.xpath('//logo')) - end - - def self.username(doc) - self.contents(doc.xpath('//author/name')) - end - - def self.profile_url(doc) - self.contents(doc.xpath('//author/uri')) - end - - # Entry ########################## - def self.message(doc) - self.contents(doc.xpath('//entry/title')) - end - - def self.permalink(doc) - self.contents(doc.xpath('//entry/id')) - end - - def self.published_at(doc) - self.contents(doc.xpath('//entry/published')) - end - - def self.updated_at(doc) - self.contents(doc.xpath('//entry/updated')) - end - - - def self.contents(xpath) - xpath.each{|x| return x.inner_html} - end - - end -end diff --git a/lib/diaspora/webhooks.rb b/lib/diaspora/webhooks.rb index 084939e8a..c6003e957 100644 --- a/lib/diaspora/webhooks.rb +++ b/lib/diaspora/webhooks.rb @@ -2,66 +2,55 @@ module Diaspora module Webhooks def self.included(klass) klass.class_eval do - require 'message_handler' - - @@queue = MessageHandler.new + require 'message_handler' - def notify_people - if self.person_id == User.owner.id - push_to(people_with_permissions) - end - end - - def notify_people! + @@queue = MessageHandler.new + + def notify_people + if self.person_id == User.owner.id push_to(people_with_permissions) end - - def subscribe_to_ostatus(feed_url) - @@queue.add_subscription_request(feed_url) - @@queue.process - end - - def unsubscribe_from_ostatus(feed_url) - @@queue.add_hub_unsubscribe_request(self.destination_url, self.callback_url+'hubbub', feed_url) - @@queue.process - end - - def push_to(recipients) - @@queue.add_hub_notification(APP_CONFIG[:pubsub_server], User.owner.url + self.class.to_s.pluralize.underscore + '.atom') - unless recipients.empty? - recipients.map!{|x| x = x.url + "receive/"} - xml = Post.build_xml_for(self) - Rails.logger.info("Adding xml for #{self} to message queue to #{recipients}") - @@queue.add_post_request( recipients, xml ) - end - @@queue.process - end - - def push_to_url(url) - hook_url = url + "receive/" - xml = self.class.build_xml_for(self) - Rails.logger.info("Adding xml for #{self} to message queue to #{url}") - @@queue.add_post_request( hook_url, xml ) - @@queue.process - end - - def to_diaspora_xml - "#{self.to_xml.to_s}" - end - - def people_with_permissions - Person.friends.all - end - - def self.build_xml_for(posts) - xml = "" - xml += "\n " - [*posts].each {|x| xml << x.to_diaspora_xml} - xml += "" - xml += "" - - end end + + def notify_people! + push_to(people_with_permissions) + end + + def push_to(recipients) + unless recipients.empty? + recipients.map!{|x| x = x.url + "receive/"} + xml = Post.build_xml_for(self) + Rails.logger.info("Adding xml for #{self} to message queue to #{recipients}") + @@queue.add_post_request( recipients, xml ) + end + @@queue.process + end + + def push_to_url(url) + hook_url = url + "receive/" + xml = self.class.build_xml_for(self) + Rails.logger.info("Adding xml for #{self} to message queue to #{url}") + @@queue.add_post_request( hook_url, xml ) + @@queue.process + end + + def to_diaspora_xml + "#{self.to_xml.to_s}" + end + + def people_with_permissions + Person.friends.all + end + + def self.build_xml_for(posts) + xml = "" + xml += "\n " + [*posts].each {|x| xml << x.to_diaspora_xml} + xml += "" + xml += "" + + end + end end end -end \ No newline at end of file +end diff --git a/lib/message_handler.rb b/lib/message_handler.rb index 06c32e841..4bc54b4c9 100644 --- a/lib/message_handler.rb +++ b/lib/message_handler.rb @@ -12,35 +12,11 @@ class MessageHandler [*destinations].each{ |dest| @queue.push(Message.new(:get, dest))} end - def add_subscription_request(feed_url) - @queue.push(Message.new(:ostatus_subscribe, feed_url)) - end - def add_post_request(destinations, body) b = CGI::escape( body ) [*destinations].each{|dest| @queue.push(Message.new(:post, dest, :body => b))} end - # pubsubhubbub - def add_hub_notification(hub_url, feed_url) - @queue.push(Message.new(:hub_publish, hub_url, :body => feed_url)) - end - - def add_hub_subscription_request(hub_url, feed_url) - @queue.push(Message.new(:hub_subscribe, hub_url, :body => feed_url)) - end - - def add_hub_unsubscribe_request(hub, from, feed_url) - @queue.push(Message.new(:hub_unsubscribe, hub, :body => feed_url, :owner_url => from)) - end - - def process_ostatus_subscription(query_object, http) - hub = Diaspora::OStatusParser::hub(http.response) - add_hub_subscription_request(hub, query_object.destination) - Diaspora::OStatusParser::process(http.response) - end - - def process @queue.pop{ |query| case query.type @@ -50,22 +26,6 @@ class MessageHandler when :get http = EventMachine::HttpRequest.new(query.destination).get :timeout => TIMEOUT http.callback {send_to_seed(query, http.response); process} - - when :ostatus_subscribe - puts query.destination - http = EventMachine::HttpRequest.new(query.destination).get :timeout => TIMEOUT - http.callback { process_ostatus_subscription(query, http); process} - - when :hub_publish - http = EventMachine::PubSubHubbub.new(query.destination).publish query.body, :timeout => TIMEOUT - http.callback { process} - - when :hub_subscribe - http = EventMachine::PubSubHubbub.new(query.destination).subscribe query.body, User.owner.url + 'hubbub', :timeout => TIMEOUT - http.callback { process} - when :hub_unsubscribe - http = EventMachine::PubSubHubbub.new(query.destination).unsubscribe query.body, query.owner_url, :timeout => TIMEOUT - http.callback {process} else raise "message is not a type I know!" end diff --git a/spec/controllers/dashboards_controller_spec.rb b/spec/controllers/dashboards_controller_spec.rb index 215fd09d4..b05603fb6 100644 --- a/spec/controllers/dashboards_controller_spec.rb +++ b/spec/controllers/dashboards_controller_spec.rb @@ -12,7 +12,6 @@ describe DashboardsController do Factory.create :person get :index assigns[:friends].should == Person.friends.all - assigns[:subscribed_persons] == Author.all end end diff --git a/spec/controllers/publics_controller_spec.rb b/spec/controllers/publics_controller_spec.rb index bffb0d8b3..132210e66 100644 --- a/spec/controllers/publics_controller_spec.rb +++ b/spec/controllers/publics_controller_spec.rb @@ -20,19 +20,4 @@ describe PublicsController do end end - describe 'PubSubHubBuB intergration' do - - describe 'incoming subscriptions' do - it 'should respond to a incoming subscription request' do - - get :hubbub, {'hub.callback' => "http://example.com/", - 'hub.mode' => 'subscribe', - 'hub.topic' => '/status_messages', - 'hub.verify' => 'sync', - 'hub.challenge' => 'foobar'} - response.status.should == 202 - response.body.should == 'foobar' - end - end - end end diff --git a/spec/controllers/requests_controller_spec.rb b/spec/controllers/requests_controller_spec.rb deleted file mode 100644 index 3cc8f7c41..000000000 --- a/spec/controllers/requests_controller_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require File.dirname(__FILE__) + '/../spec_helper' - -describe RequestsController do - describe "profile" do - it 'should fetch the public webfinger profile on request' do - pending "Duplicate test" - #post :create {:request => {:destination_url => 'tom@tom.joindiaspora.com'} - - url = RequestsController.diaspora_url('http://tom.joindiaspora.com/') - url.should == 'http://tom.joindiaspora.com/' - - - url = RequestsController.diaspora_url('tom@tom.joindiaspora.com') - url.should == 'http://tom.joindiaspora.com/' - end - end -end diff --git a/spec/factories.rb b/spec/factories.rb index b72769800..076ce1782 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -49,10 +49,4 @@ Factory.define :photo do |p| end -Factory.define :author do |p| - p.hub "http://pubsubhubub.appspot.com/" - p.service "StatusNet" - p.username "danielgrippi" - p.feed_url "http://google.com" -end Factory.define(:comment) {} diff --git a/spec/fixtures/identica_feed.atom b/spec/fixtures/identica_feed.atom deleted file mode 100644 index d590fc1f4..000000000 --- a/spec/fixtures/identica_feed.atom +++ /dev/null @@ -1,166 +0,0 @@ - - - StatusNet - http://identi.ca/api/statuses/user_timeline/169966.atom - joindiaspora timeline - Updates from joindiaspora on Identi.ca! - http://avatar.identi.ca/169966-96-20100426170852.png - 2010-07-22T01:00:38+00:00 - - joindiaspora - http://identi.ca/user/169966 - - - - - - - - - http://activitystrea.ms/schema/1.0/person - http://identi.ca/user/169966 - Diaspora - - - - - -joindiaspora -Diaspora -Diaspora is an awesome, distributed, open source social network in the making from some young hackers at NYU - - homepage - http://joindiaspora.com - true - - - - A month of Diaspora in action. First screenshots/video! http://bit.ly/clOFXx - - http://identi.ca/notice/39231942 - 2010-07-02T06:13:11+00:00 - 2010-07-02T06:13:11+00:00 - - - A month of Diaspora in action. First screenshots/video! <a href="http://bit.ly/clOFXx" title="http://www.joindiaspora.com/2010/07/01/one-month-in.html" rel="external">http://bit.ly/clOFXx</a> - - - http://www.reclaimprivacy.org/ check your FB privacy settings, automagically! !whyisntthisbuiltintofacebook :) - - http://identi.ca/notice/32556574 - 2010-05-17T18:18:28+00:00 - 2010-05-17T18:18:28+00:00 - - - <a href="http://www.reclaimprivacy.org/" title="http://www.reclaimprivacy.org/" rel="external">http://www.reclaimprivacy.org/</a> check your FB privacy settings, automagically! !whyisntthisbuiltintofacebook :) - - - @cacheson, should already be there, at http://joindiaspora.com/atom.xml... hopefully that will do the trick... - - http://identi.ca/notice/31824813 - 2010-05-11T14:29:38+00:00 - 2010-05-11T14:29:38+00:00 - - - - @<span class="vcard"><a href="http://identi.ca/user/47185" class="url" title="Chris Acheson"><span class="fn nickname">cacheson</span></a></span>, should already be there, at <a href="http://joindiaspora.com/atom.xml" title="http://joindiaspora.com/atom.xml" rel="external" class="attachment" id="attachment-15490501">http://joindiaspora.com/atom.xml</a>... hopefully that will do the trick... - - - - @elmom, thanks for your support. we are excited to get started. helsinki is awesome, I hope to go back one day! good luck w/hackerspace! - - http://identi.ca/notice/30760606 - 2010-05-02T07:06:02+00:00 - 2010-05-02T07:06:02+00:00 - - - - @<span class="vcard"><a href="http://identi.ca/user/101533" class="url" title="Elmo M&#xE4;ntynen"><span class="fn nickname">elmom</span></a></span>, thanks for your support. we are excited to get started. helsinki is awesome, I hope to go back one day! good luck w/hackerspace! - - - @tieguy, thanks for the great feedback, here is our response: http://bit.ly/aF2Fpl - - http://identi.ca/notice/30549323 - 2010-04-30T06:29:28+00:00 - 2010-04-30T06:29:28+00:00 - - - - @<span class="vcard"><a href="http://identi.ca/user/11" class="url" title="Luis Villa"><span class="fn nickname">tieguy</span></a></span>, thanks for the great feedback, here is our response: <a href="http://bit.ly/aF2Fpl" title="http://joindiaspora.com/2010/04/30/a-response-to-mr-villa.html" rel="external">http://bit.ly/aF2Fpl</a> - - - RT @tieguy @joindiaspora hopefully constructive questions for you: http://ur1.ca/xbvq cc: @mlinksva @rejon @biella@brainbird.net - - http://identi.ca/notice/30154486 - 2010-04-27T06:22:14+00:00 - 2010-04-27T06:22:14+00:00 - - - - RT @<span class="vcard"><a href="http://identi.ca/user/11" class="url" title="Luis Villa"><span class="fn nickname">tieguy</span></a></span> @<span class="vcard"><a href="http://identi.ca/user/169966" class="url" title="Diaspora"><span class="fn nickname">joindiaspora</span></a></span> hopefully constructive questions for you: <a href="http://ur1.ca/xbvq" title="http://tieguy.org/blog/2010/04/27/questions-for-the-diaspora/" rel="external">http://ur1.ca/xbvq</a> cc: @<span class="vcard"><a href="http://identi.ca/user/8" class="url" title="Mike Linksvayer"><span class="fn nickname">mlinksva</span></a></span> @<span class="vcard"><a href="http://identi.ca/user/37" class="url" title="Jon Phillips"><span class="fn nickname">rejon</span></a></span> @<span class="vcard"><a href="http://brainbird.net/biella" class="url"><span class="fn nickname">biella@brainbird.net</span></a></span> - - - @tieguy it's on! ;) we have already thought about much of your comments, but give us a day or two to give you a good response. - - http://identi.ca/notice/30152694 - 2010-04-27T06:04:30+00:00 - 2010-04-27T06:04:30+00:00 - - - - @<span class="vcard"><a href="http://identi.ca/user/11" class="url" title="Luis Villa"><span class="fn nickname">tieguy</span></a></span> it's on! ;) we have already thought about much of your comments, but give us a day or two to give you a good response. - - - @mattkatz00 we really appreciate your kickstarter backing! - - http://identi.ca/notice/30089749 - 2010-04-26T19:32:19+00:00 - 2010-04-26T19:32:19+00:00 - - - @mattkatz00 we really appreciate your kickstarter backing! - - - @danlatorre many thanks for your backing and support! - - http://identi.ca/notice/30089410 - 2010-04-26T19:29:27+00:00 - 2010-04-26T19:29:27+00:00 - - - - @<span class="vcard"><a href="http://identi.ca/user/16365" class="url" title="Daniel Latorre"><span class="fn nickname">danlatorre</span></a></span> many thanks for your backing and support! - - - @adwilliamson thanks for backing diaspora! - - http://identi.ca/notice/30089220 - 2010-04-26T19:27:36+00:00 - 2010-04-26T19:27:36+00:00 - - - @adwilliamson thanks for backing diaspora! - - - @thisisparker many thanks for your kickstarter backing! - - http://identi.ca/notice/30088868 - 2010-04-26T19:23:51+00:00 - 2010-04-26T19:23:51+00:00 - - - - @<span class="vcard"><a href="http://identi.ca/user/27657" class="url" title="Parker Higgins"><span class="fn nickname">thisisparker</span></a></span> many thanks for your kickstarter backing! - - - We'll be building the interface for Diaspora to StatusNet, but for now, this will be from the web! - - http://identi.ca/notice/30074166 - 2010-04-26T17:07:49+00:00 - 2010-04-26T17:07:49+00:00 - - - We'll be building the interface for Diaspora to StatusNet, but for now, this will be from the web! - - - diff --git a/spec/fixtures/ostatus_update.xml b/spec/fixtures/ostatus_update.xml deleted file mode 100644 index 342ec80c2..000000000 --- a/spec/fixtures/ostatus_update.xml +++ /dev/null @@ -1,2 +0,0 @@ -"\n\n StatusNet\n http://identi.ca/api/statuses/user_timeline/217769.atom\n danielgrippi timeline\n Updates from danielgrippi on Identi.ca!\n http://theme.status.net/0.9.3/identica/default-avatar-profile.png\n 2010-07-22T22:15:31+00:00\n\n danielgrippi\n http://identi.ca/user/217769\n\n \n \n \n \n \n \n\n http://activitystrea.ms/schema/1.0/person\n http://identi.ca/user/217769\n Daniel Grippi\n \n \n \n \n 0 0\ndanielgrippi\nDaniel Grippi\nhey there kids!\n\n earth\n\n\n homepage\n http://danielgrippi.com/\n true\n\n\n\n SOAP!\n \n http://identi.ca/notice/43074747\n 2010-07-22T22:15:31+00:00\n 2010-07-22T22:15:31+00:00\n \n \n SOAP!\n 37.7912 -122.401\n\n\n" - diff --git a/spec/helpers/requests_helper_spec.rb b/spec/helpers/requests_helper_spec.rb index 248f5876d..6f5b37442 100644 --- a/spec/helpers/requests_helper_spec.rb +++ b/spec/helpers/requests_helper_spec.rb @@ -5,35 +5,22 @@ include RequestsHelper describe RequestsHelper do before do - #@tom = Redfinger.finger('tom@tom.joindiaspora.com') - #@evan = Redfinger.finger('evan@status.net') - #@max = Redfinger.finger('mbs348@gmail.com') + @tom = Redfinger.finger('tom@tom.joindiaspora.com') + @evan = Redfinger.finger('evan@status.net') + @max = Redfinger.finger('mbs348@gmail.com') end describe "profile" do - it 'should fetch the public webfinger profile on request' do - pending - #post :create {:request => {:destination_url => 'tom@tom.joindiaspora.com'} - url = diaspora_url('http://tom.joindiaspora.com/') - url.should == 'http://tom.joindiaspora.com/' - - url = diaspora_url('tom@tom.joindiaspora.com') - url.should == 'http://tom.joindiaspora.com/' - end - - it 'should detect how to subscribe to a diaspora or ostatus webfinger profile' do - pending + it 'should detect how to subscribe to a diaspora or webfinger profile' do subscription_mode(@tom).should == :friend - subscription_mode(@evan).should == :subscribe + subscription_mode(@evan).should == :none subscription_mode(@max).should == :none end it 'should return the correct tag and url for a given address' do - pending relationship_flow('tom@tom.joindiaspora.com')[:friend].should == 'http://tom.joindiaspora.com/' - relationship_flow('evan@status.net')[:subscribe].should == 'http://evan.status.net/api/statuses/user_timeline/1.atom' end end diff --git a/spec/lib/diaspora_ostatus_generator_spec.rb b/spec/lib/diaspora_ostatus_generator_spec.rb deleted file mode 100644 index c1fadc2e1..000000000 --- a/spec/lib/diaspora_ostatus_generator_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -require File.dirname(__FILE__) + '/../spec_helper' - -require 'lib/diaspora/ostatus_generator' - -describe Diaspora::OStatusGenerator do - before do - @user = Factory.create(:user) - Diaspora::OStatusGenerator::OWNER = @user - end - - describe Diaspora::OStatusGenerator::Generate do - - describe "header" do - it 'should generate an OStatus compliant header' do - Diaspora::OStatusGenerator::Generate::headers(:current_url => @user.url).should include @user.url - end - end - - describe "status message entry" do - before do - @status_message = Factory.create(:status_message, :message => "feed me") - end - - it "should encode to activity stream xml" do - sm_entry = Diaspora::OStatusGenerator::generate(:objects => @status_message, :current_url => "http://diaspora.com/") - sm_entry.should include(@status_message.message) - sm_entry.should include('title') - end - end - end -end diff --git a/spec/lib/message_handler_spec.rb b/spec/lib/message_handler_spec.rb index d71dc2142..553135b96 100644 --- a/spec/lib/message_handler_spec.rb +++ b/spec/lib/message_handler_spec.rb @@ -131,83 +131,6 @@ describe MessageHandler do end end - - describe 'ostatus_subscribe' do - it 'should be able to add a GET query to the queue with required destinations' do - request = FakeHttpRequest.new(:success) - request.should_receive(:get).exactly(1).times.and_return(request) - request.stub!(:callback).and_return(true) - - EventMachine::HttpRequest.stub!(:new).and_return(request) - - EventMachine.run{ - @handler.add_subscription_request("http://evan.status.net/") - @handler.size.should == 1 - - @handler.process - EventMachine.stop - } - end - - end - - describe 'hub_publish' do - it 'should correctly queue up a pubsubhub publish request' do - destination = "http://identi.ca/hub/" - feed_location = "http://google.com/" - - EventMachine.run { - @handler.add_hub_notification(destination, feed_location) - q = @handler.instance_variable_get(:@queue) - - message = "" - q.pop{|m| message = m} - - message.destination.should == destination - message.body.should == feed_location - - EventMachine.stop - } - end - - it 'should notify the hub about new content' do - request = FakeHttpRequest.new(:success) - request.should_receive(:publish).exactly(1).times.and_return(request) - EventMachine::PubSubHubbub.stub!(:new).and_return(request) - - EventMachine.run { - @handler.add_hub_notification("http://identi.ca/hub", "http://google.com/feed") - @handler.size.should == 1 - @handler.process - @handler.size.should == 0 - EventMachine.stop - } - end - - end - - describe 'hub_subscribe' do - - it 'should process an ostatus subscription' do - request = FakeHttpRequest.new(:success) - - Diaspora::OStatusParser.stub!(:find_hub).and_return("http://hub.google.com") - MessageHandler.stub!(:add_hub_subscription_request).and_return(true) - - Diaspora::OStatusParser.stub!(:process) - Diaspora::OStatusParser.should_receive(:find_hub) - @handler.should_receive(:add_hub_subscription_request) - Diaspora::OStatusParser.should_receive(:process) - - g = mock("Message") - g.stub!(:destination).and_return("google") - - @handler.process_ostatus_subscription(g, request) - end - - - end - end class FakeHttpRequest diff --git a/spec/lib/ostatus_parser_spec.rb b/spec/lib/ostatus_parser_spec.rb deleted file mode 100644 index 8a431db9d..000000000 --- a/spec/lib/ostatus_parser_spec.rb +++ /dev/null @@ -1,68 +0,0 @@ -require File.dirname(__FILE__) + '/../spec_helper' - -describe Diaspora::OStatusParser do - it 'should be able to get the hub of an ostatus feed' do - xml_path = File.dirname(__FILE__) + '/../fixtures/identica_feed.atom' - xml = File.open(xml_path).read - - Diaspora::OStatusParser::hub(xml).should == 'http://identi.ca/main/push/hub' - end - - - describe 'subscriber info' do - before do - #load file - xml_path = File.dirname(__FILE__) + '/../fixtures/ostatus_update.xml' - @xml = File.open(xml_path).read - @xml = Nokogiri::HTML(@xml) - end - - - it 'should parse the users service' do - Diaspora::OStatusParser::service(@xml).should == 'StatusNet' - end - - it 'should parse the feed_url' do - Diaspora::OStatusParser::feed_url(@xml).should == 'http://identi.ca/api/statuses/user_timeline/217769.atom' - end - - it 'should parse the avatar thumbnail' do - Diaspora::OStatusParser::avatar_thumbnail(@xml).should == 'http://theme.status.net/0.9.3/identica/default-avatar-profile.png' - end - - it 'should parse the username' do - Diaspora::OStatusParser::username(@xml).should == 'danielgrippi' - end - - it 'should parse the profile_url' do - Diaspora::OStatusParser::profile_url(@xml).should == 'http://identi.ca/user/217769' - end - - end - - describe 'entry' do - before do - #load file - xml_path = File.dirname(__FILE__) + '/../fixtures/ostatus_update.xml' - @xml = File.open(xml_path).read - @xml = Nokogiri::HTML(@xml) - end - - it 'should parse the message' do - Diaspora::OStatusParser::message(@xml).should == 'SOAP!' - end - - it 'should parse the permalink' do - Diaspora::OStatusParser::permalink(@xml).should == 'http://identi.ca/notice/43074747' - end - - it 'should parse published at date' do - Diaspora::OStatusParser::published_at(@xml).should == '2010-07-22T22:15:31+00:00' - - end - - it 'should parse the updated at date' do - Diaspora::OStatusParser::updated_at(@xml).should == '2010-07-22T22:15:31+00:00' - end - end -end diff --git a/spec/models/author_spec.rb b/spec/models/author_spec.rb deleted file mode 100644 index 475c60df3..000000000 --- a/spec/models/author_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require File.dirname(__FILE__) + '/../spec_helper' - -include Diaspora::OStatusParser - -describe Author do - - it 'should create from ostatus compliant xml from the parser' do - xml_path = File.dirname(__FILE__) + '/../fixtures/identica_feed.atom' - xml = File.open(xml_path).read - - Author.count.should == 0 - Diaspora::OStatusParser.process(xml) - Author.count.should == 1 - end - -end diff --git a/spec/models/ostatus_post_spec.rb b/spec/models/ostatus_post_spec.rb deleted file mode 100644 index ab71e3790..000000000 --- a/spec/models/ostatus_post_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require File.dirname(__FILE__) + '/../spec_helper' - -describe OstatusPost do - -end diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index 1b516bfc1..721dc840a 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -13,7 +13,7 @@ describe Photo do it 'should have a constructor' do image = File.open(@fixture_name) photo = Photo.instantiate(:person => @user, :album => @album, :user_file => [image]) - photo.save.should be true + photo.created_at.nil?.should be false photo.image.read.nil?.should be false end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 01b0365be..1431b1cd5 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -47,17 +47,6 @@ describe User do @user.terse_url.should == 'example.com' end - it 'should be able to unsubscribe from a status.net user' do - author = Factory.create(:author) - Author.all.count.should == 1 - q = Request.send :class_variable_get, :@@queue - q.stub!(:add_hub_unsubscribe_request) - q.should_receive(:add_hub_unsubscribe_request) - - @user.unsubscribe_from_pubsub(author.id) - Author.all.count.should == 0 - end - it 'should be able to update their profile and send it to their friends' do Factory.create(:person)