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

This commit is contained in:
ilya 2010-10-15 17:20:19 -07:00
commit d4702aefa3
5 changed files with 48 additions and 5 deletions

View file

@ -52,4 +52,8 @@ class ApplicationController < ActionController::Base
end
end
def logged_into_fb?
@logged_in
end
end

View file

@ -12,8 +12,9 @@ class StatusMessagesController < ApplicationController
params[:status_message][:to] = params[:aspect_ids]
data = clean_hash params[:status_message]
if @logged_in && params[:status_message][:public] == 'true'
if logged_into_fb? && params[:status_message][:public] == '1'
id = 'me'
type = 'feed'

View file

@ -14,10 +14,11 @@
= stylesheet_link_tag "blueprint/print", :media => 'print'
= stylesheet_link_tag "application", "ui"
= stylesheet_link_tag "/../javascripts/fancybox/jquery.fancybox-1.3.1"
= stylesheet_link_tag "fileuploader"
- if current_user
%link{:rel => "alternate", :href => "#{current_user.public_url}", :type => "application/atom+xml", :title => "Public Diaspora Feed for #{current_user.real_name}"}
/= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
= javascript_include_tag 'jquery-1.4.2.min', 'rails'
= javascript_include_tag 'jquery.infieldlabel', 'jquery.cycle/jquery.cycle.min.js'

View file

@ -1,12 +1,12 @@
%h3 You are about to post a public message!
%p
Public messages will be available for others outside of Diaspora to see.
%br
%br
- if @logged_in
= connected_fb_as(@access_token)
- else
= link_to "Connect to Facebook", @fb_access_url
%br
%br
= link_to "OK", '#', :class => "button", :onClick => '$.fancybox.close();'

View file

@ -0,0 +1,37 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe StatusMessagesController do
render_views
before do
@user = Factory.create(:user)
@aspect = @user.aspect(:name => "lame-os")
@album = @user.post :album, :to => @aspect.id, :name => 'things on fire'
sign_in :user, @user
end
describe '#create' do
let(:status_message_hash) {{"aspect_ids" =>"#{@aspect.id.to_s}", "status_message"=>{"public"=>"1", "message"=>"facebook, is that you?"}}}
before do
@controller.stub!(:logged_into_fb?).and_return(true)
end
it 'should post to facebook when public is set' do
my_mock = mock("http")
my_mock.stub!(:post)
EventMachine::HttpRequest.should_receive(:new).and_return(my_mock)
post :create, status_message_hash
end
it 'should not post to facebook when public in not set' do
status_message_hash['status_message']['public'] = '0'
EventMachine::HttpRequest.should_not_receive(:new)
post :create, status_message_hash
end
end
end