Merge branch 'master' of github.com:diaspora/diaspora
This commit is contained in:
commit
eb7244e07c
47 changed files with 514 additions and 118 deletions
1
Gemfile
1
Gemfile
|
|
@ -19,6 +19,7 @@ gem 'will_paginate', '3.0.pre2'
|
|||
gem 'roxml', :git => 'git://github.com/Empact/roxml.git'
|
||||
gem 'addressable', :require => 'addressable/uri'
|
||||
gem 'json'
|
||||
gem 'mini_fb'
|
||||
|
||||
#Standards
|
||||
gem 'pubsubhubbub'
|
||||
|
|
|
|||
|
|
@ -158,6 +158,9 @@ GEM
|
|||
mime-types
|
||||
treetop (>= 1.4.5)
|
||||
mime-types (1.16)
|
||||
mini_fb (1.1.3)
|
||||
hashie
|
||||
rest-client
|
||||
mini_magick (2.1)
|
||||
subexec (~> 0.0.4)
|
||||
mocha (0.9.8)
|
||||
|
|
@ -267,6 +270,7 @@ DEPENDENCIES
|
|||
haml
|
||||
json
|
||||
magent!
|
||||
mini_fb
|
||||
mini_magick
|
||||
mocha
|
||||
mongo_mapper!
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
before_filter :set_friends_and_status, :except => [:create, :update]
|
||||
before_filter :count_requests
|
||||
before_filter :fb_user_info
|
||||
|
||||
layout :layout_by_resource
|
||||
|
||||
|
|
@ -21,7 +22,9 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
def set_friends_and_status
|
||||
if current_user
|
||||
if params[:aspect] == nil || params[:aspect] == 'all'
|
||||
if params[:action] == 'public'
|
||||
@aspect = :public
|
||||
elsif params[:aspect] == nil || params[:aspect] == 'all'
|
||||
@aspect = :all
|
||||
else
|
||||
@aspect = current_user.aspect_by_id( params[:aspect])
|
||||
|
|
@ -36,4 +39,11 @@ class ApplicationController < ActionController::Base
|
|||
@request_count = Request.for_user(current_user).size if current_user
|
||||
end
|
||||
|
||||
def fb_user_info
|
||||
if current_user
|
||||
@access_token = warden.session[:access_token]
|
||||
@logged_in = @access_token.present?
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -48,6 +48,15 @@ class AspectsController < ApplicationController
|
|||
respond_with @aspect
|
||||
end
|
||||
|
||||
def public
|
||||
@fb_access_url = MiniFB.oauth_url(FB_APP_ID, APP_CONFIG[:pod_url] + "services/create",
|
||||
:scope=>MiniFB.scopes.join(","))
|
||||
|
||||
@posts = current_user.visible_posts(:public => true).paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC'
|
||||
|
||||
respond_with @aspect
|
||||
end
|
||||
|
||||
def manage
|
||||
@aspect = :manage
|
||||
@remote_requests = Request.for_user(current_user).all
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class PeopleController < ApplicationController
|
|||
@profile = @person.profile
|
||||
@aspects_with_person = current_user.aspects_with_person(@person)
|
||||
@aspects_dropdown_array = current_user.aspects.collect{|x| [x.to_s, x.id]}
|
||||
@posts = current_user.visible_posts(:from => @person).paginate :page => params[:page], :order => 'created_at DESC'
|
||||
@posts = current_user.visible_posts(:person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC'
|
||||
@latest_status_message = current_user.raw_visible_posts.find_all_by__type_and_person_id("StatusMessage", params[:id]).last
|
||||
@post_count = @posts.count
|
||||
respond_with @person
|
||||
|
|
|
|||
40
app/controllers/services_controller.rb
Normal file
40
app/controllers/services_controller.rb
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
|
||||
class ServicesController < ApplicationController
|
||||
|
||||
def create
|
||||
puts 'services/create'
|
||||
p params
|
||||
|
||||
code = params['code'] # Facebooks verification string
|
||||
if code
|
||||
access_token_hash = MiniFB.oauth_access_token(FB_APP_ID, APP_CONFIG[:pod_url] + "services/create", FB_SECRET, code)
|
||||
p access_token_hash
|
||||
@access_token = access_token_hash["access_token"]
|
||||
|
||||
# TODO: This is where you'd want to store the token in your database
|
||||
# but for now, we'll just keep it in the session so we don't need a database
|
||||
warden.session[:access_token] = @access_token
|
||||
flash[:success] = "Authentication successful."
|
||||
end
|
||||
redirect_to edit_user_url current_user
|
||||
end
|
||||
|
||||
def destroy
|
||||
warden.session[:access_token] = nil
|
||||
warden.session[:user_id] = nil
|
||||
redirect_to edit_user_url current_user
|
||||
end
|
||||
|
||||
def fb_post
|
||||
id = 'me'
|
||||
type = 'feed'
|
||||
|
||||
@res = MiniFB.post(@access_token, id, :type=>type, :metadata=>true, :params=>params)
|
||||
redirect_to edit_user_url current_user
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -12,6 +12,15 @@ class StatusMessagesController < ApplicationController
|
|||
params[:status_message][:to] = params[:aspect_ids]
|
||||
|
||||
data = clean_hash params[:status_message]
|
||||
|
||||
if @logged_in && params[:status_message][:public] == 'true'
|
||||
id = 'me'
|
||||
type = 'feed'
|
||||
|
||||
Rails.logger.info("Sending a message: #{params[:status_message][:message]} to Facebook")
|
||||
@res = MiniFB.post(@access_token, id, :type=>type,
|
||||
:metadata=>true, :params=>{:message => params[:status_message][:message]})
|
||||
end
|
||||
|
||||
@status_message = current_user.post(:status_message, data)
|
||||
respond_with @status_message
|
||||
|
|
@ -32,7 +41,8 @@ class StatusMessagesController < ApplicationController
|
|||
def clean_hash(params)
|
||||
return {
|
||||
:message => params[:message],
|
||||
:to => params[:to]
|
||||
:to => params[:to],
|
||||
:public => params[:public]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ class UsersController < ApplicationController
|
|||
@person = @user.person
|
||||
@profile = @user.person.profile
|
||||
@photos = Photo.find_all_by_person_id(@person.id).paginate :page => params[:page], :order => 'created_at DESC'
|
||||
|
||||
@fb_access_url = MiniFB.oauth_url(FB_APP_ID, APP_CONFIG[:pod_url] + "services/create",
|
||||
:scope=>MiniFB.scopes.join(","))
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
|||
|
|
@ -66,4 +66,9 @@ module ApplicationHelper
|
|||
def post_yield_tag(post)
|
||||
(':' + post.id.to_s).to_sym
|
||||
end
|
||||
|
||||
def connected_fb_as token
|
||||
response_hash = MiniFB.get(token, 'me')
|
||||
"Connected to facebook as #{response_hash[:name]}"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
31
app/models/fb_status.rb
Normal file
31
app/models/fb_status.rb
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
|
||||
class FbStatus
|
||||
include MongoMapper::Document
|
||||
|
||||
key :graph_id, String
|
||||
key :author_id, String
|
||||
key :author_name, String
|
||||
key :message, String
|
||||
key :updated_time, Time
|
||||
|
||||
timestamps!
|
||||
|
||||
validates_presence_of :graph_id,:author_id,:author_name,:message,:updated_time
|
||||
|
||||
def self.from_api(hash)
|
||||
#just keeping them in memory for now
|
||||
self.new(
|
||||
:graph_id => hash['id'],
|
||||
:author_id => hash['from']['id'],
|
||||
:author_name => hash['from']['name'],
|
||||
:message => hash['message'],
|
||||
:updated_time => Time.parse(hash['updated_time'])
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -13,6 +13,9 @@ class Post
|
|||
|
||||
xml_accessor :_id
|
||||
xml_accessor :person, :as => Person
|
||||
xml_reader :public
|
||||
|
||||
key :public , Boolean, :default => false
|
||||
|
||||
key :person_id, ObjectId
|
||||
key :user_refs, Integer, :default => 0
|
||||
|
|
|
|||
|
|
@ -114,12 +114,6 @@ class User
|
|||
post
|
||||
end
|
||||
|
||||
def repost( post, options = {} )
|
||||
aspect_ids = validate_aspect_permissions(options[:to])
|
||||
push_to_aspects(post, aspect_ids)
|
||||
post
|
||||
end
|
||||
|
||||
def update_post( post, post_hash = {} )
|
||||
if self.owns? post
|
||||
post.update_attributes(post_hash)
|
||||
|
|
|
|||
24
app/views/aspects/public.html.haml
Normal file
24
app/views/aspects/public.html.haml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
|
||||
- content_for :page_title do
|
||||
= link_to "photos", albums_path(:aspect => @aspect)
|
||||
|
||||
- content_for :left_pane do
|
||||
= render "shared/aspect_friends"
|
||||
|
||||
- content_for :publish do
|
||||
- if @logged_in
|
||||
= render "shared/publisher", :aspect_ids => :public
|
||||
- else
|
||||
= render "shared/publisher", :aspect_ids => :all
|
||||
|
||||
%ul#stream
|
||||
- for post in @posts
|
||||
= render type_partial(post), :post => post unless post.class == Album
|
||||
|
||||
#pagination
|
||||
= will_paginate @posts
|
||||
|
||||
|
|
@ -6,8 +6,12 @@
|
|||
= owner_image_link
|
||||
- for friend in @friends
|
||||
= person_image_link(friend)
|
||||
|
||||
-unless @aspect == :all
|
||||
- if @logged_in && (@aspect == :public)
|
||||
%h3 Facebook Friends
|
||||
- @fb_friends = MiniFB.get(@access_token, 'me', :type => "friends")
|
||||
- @fb_friends[:data].each do |friend|
|
||||
= image_tag( "http://graph.facebook.com/#{friend[:id]}/picture" )
|
||||
-unless (@aspect == :all) || (@aspect == :public)
|
||||
= link_to (image_tag('add_friend_button.png', :height => "50px", :width => "50px")), "#add_request_pane", :id => 'add_request_button'
|
||||
|
||||
.yo{:style => 'display:none'}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@
|
|||
- for aspect in @aspects
|
||||
%li{:class => ("selected" if current_aspect?(aspect))}
|
||||
= link_for_aspect aspect
|
||||
|
||||
%ul{ :style => "position:absolute;right:0;bottom:0.01em;"}
|
||||
%li{:class => ("selected" if @aspect == :all)}
|
||||
= link_to t('.all_aspects'), root_url
|
||||
|
||||
%ul{ :style => "position:absolute;right:0;bottom:0.01em;"}
|
||||
%li{:class => ("selected" if @aspect == :public)}
|
||||
= link_to "Public", aspects_public_path
|
||||
|
||||
%li{ :style => "margin-right:0;", :class => ("selected" if @aspect == :manage)}
|
||||
= link_to ( (@request_count == 0)? t('.manage') : "#{t('.manage')} (#{@request_count})"), {:controller => :aspects, :action => :manage}, :class => "edit_aspect_button", :class => new_request(@request_count), :title => t('.manage_your_aspects')
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,13 @@
|
|||
%p
|
||||
%label{:for => "status_message_message"} Message
|
||||
= f.text_area :message, :rows => 2, :value => params[:prefill]
|
||||
= connected_fb_as(@access_token) if @logged_in && @aspect == :public
|
||||
= f.hidden_field( :public, :value => (params[:action] == 'public') )
|
||||
|
||||
%ul.aspect_selector{ :style => "display:none;"}
|
||||
going to...
|
||||
- for aspect in @aspects
|
||||
%li
|
||||
= check_box_tag("aspect_ids[]", aspect.id, @aspect == :all || current_aspect?(aspect) )
|
||||
= check_box_tag("aspect_ids[]", aspect.id, @aspect == :public || @aspect == :all || current_aspect?(aspect) )
|
||||
= aspect.name
|
||||
|
||||
= f.submit t('.share')
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
%h1
|
||||
- if @aspect == :all
|
||||
= link_to t('.all_aspects'), root_path
|
||||
- elsif @aspect == :public
|
||||
= "Public"
|
||||
- elsif @aspect == :manage
|
||||
= link_to t('.manage_aspects'), root_path
|
||||
- else
|
||||
|
|
|
|||
59
app/views/users/_profile.haml
Normal file
59
app/views/users/_profile.haml
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
|
||||
%h2 Profile
|
||||
|
||||
= form_for @user do |f|
|
||||
= f.error_messages
|
||||
|
||||
= f.fields_for :profile do |p|
|
||||
|
||||
%h3="#{t('.picture')}"
|
||||
%div#image_picker
|
||||
= p.hidden_field :image_url, :value => (@profile.image_url if @profile.image_url), :id => 'image_url_field'
|
||||
|
||||
- unless @photos.nil? || @photos.empty?
|
||||
- for photo in @photos
|
||||
- if @profile.image_url && @profile.image_url.include?(photo.url(:thumb_medium))
|
||||
%div.small_photo{:id => photo.url(:thumb_medium), :class=>'selected'}
|
||||
= check_box_tag 'checked_photo', true, true
|
||||
= link_to image_tag(photo.url(:thumb_medium)), "#"
|
||||
- else
|
||||
%div.small_photo{:id => photo.url(:thumb_medium)}
|
||||
= check_box_tag 'checked_photo'
|
||||
= link_to image_tag(photo.url(:thumb_medium)), "#"
|
||||
|
||||
- else
|
||||
=t('.you_dont_have_any_photos')
|
||||
= link_to t('.albums'), albums_path(:aspect => 'all')
|
||||
=t('.page_to_upload_some')
|
||||
|
||||
=will_paginate @photos
|
||||
|
||||
%br
|
||||
|
||||
%h3="#{t('.info')}"
|
||||
|
||||
%p
|
||||
%b
|
||||
="#{t('.diaspora_username')}:"
|
||||
= @user.diaspora_handle
|
||||
|
||||
%p
|
||||
= p.label :first_name
|
||||
= p.text_field :first_name, :value => @profile.first_name
|
||||
%p
|
||||
= p.label :last_name
|
||||
= p.text_field :last_name, :value => @profile.last_name
|
||||
|
||||
#submit_block
|
||||
= link_to t('.cancel'), root_path
|
||||
or
|
||||
= f.submit t('.update_profile')
|
||||
|
||||
#content_bottom
|
||||
.back
|
||||
= link_to "⇧ #{t('.home')}", root_path
|
||||
|
||||
24
app/views/users/_services.haml
Normal file
24
app/views/users/_services.haml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
|
||||
%h2 Services
|
||||
|
||||
%h3 Facebook
|
||||
%p
|
||||
- if @logged_in
|
||||
= connected_fb_as(@access_token)
|
||||
|
||||
%p
|
||||
- @fb_friends = MiniFB.get(@access_token, 'me', :type => "friends")
|
||||
- @fb_friends[:data].each do |friend|
|
||||
= image_tag( "http://graph.facebook.com/#{friend[:id]}/picture" )
|
||||
|
||||
= link_to "Disconnect from Facebook", services_destroy_path
|
||||
- else
|
||||
= link_to "Connect to Facebook (DO NOT USE WITH A REAL ACCOUNT)", @fb_access_url
|
||||
|
||||
#content_bottom
|
||||
.back
|
||||
= link_to "⇧ home", root_path
|
||||
|
|
@ -2,60 +2,29 @@
|
|||
-# licensed under the Affero General Public License version 3. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
:javascript
|
||||
$("#settings_nav li > a").click( function() {
|
||||
var target = "#"+$(this).attr('class');
|
||||
if( !$(target).is(":visible") ) {
|
||||
$(".settings_pane").fadeOut(200, function() {
|
||||
$(target).delay(200).fadeIn(200);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
- content_for :publish do
|
||||
%h1="#{t('.editing_profile')}"
|
||||
|
||||
- content_for :left_pane do
|
||||
\.
|
||||
%ul#settings_nav
|
||||
%li=link_to 'Profile', '#', :class => 'profile'
|
||||
%li=link_to 'Services', '#', :class => 'services'
|
||||
|
||||
= form_for @user do |f|
|
||||
= f.error_messages
|
||||
#profile.settings_pane{:style=>"display:block;"}
|
||||
= render 'users/profile'
|
||||
|
||||
= f.fields_for :profile do |p|
|
||||
#services.settings_pane
|
||||
= render 'users/services'
|
||||
|
||||
|
||||
%h3="#{t('.picture')}"
|
||||
%div#image_picker
|
||||
= p.hidden_field :image_url, :value => (@profile.image_url if @profile.image_url), :id => 'image_url_field'
|
||||
|
||||
- unless @photos.nil? || @photos.empty?
|
||||
- for photo in @photos
|
||||
- if @profile.image_url && @profile.image_url.include?(photo.url(:thumb_medium))
|
||||
%div.small_photo{:id => photo.url(:thumb_medium), :class=>'selected'}
|
||||
= check_box_tag 'checked_photo', true, true
|
||||
= link_to image_tag(photo.url(:thumb_medium)), "#"
|
||||
- else
|
||||
%div.small_photo{:id => photo.url(:thumb_medium)}
|
||||
= check_box_tag 'checked_photo'
|
||||
= link_to image_tag(photo.url(:thumb_medium)), "#"
|
||||
|
||||
- else
|
||||
=t('.you_dont_have_any_photos')
|
||||
= link_to t('.albums'), albums_path(:aspect => 'all')
|
||||
=t('.page_to_upload_some')
|
||||
|
||||
=will_paginate @photos
|
||||
|
||||
%br
|
||||
|
||||
%h3="#{t('.info')}"
|
||||
|
||||
%p
|
||||
%b
|
||||
="#{t('.diaspora_username')}:"
|
||||
= @user.diaspora_handle
|
||||
|
||||
%p
|
||||
= p.label :first_name
|
||||
= p.text_field :first_name, :value => @profile.first_name
|
||||
%p
|
||||
= p.label :last_name
|
||||
= p.text_field :last_name, :value => @profile.last_name
|
||||
|
||||
#submit_block
|
||||
= link_to t('.cancel'), root_path
|
||||
or
|
||||
= f.submit t('.update_profile')
|
||||
|
||||
#content_bottom
|
||||
.back
|
||||
= link_to "⇧ #{t('.home')}", root_path
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ namespace :db do
|
|||
purge
|
||||
backer_seed
|
||||
tom_seed
|
||||
deploy::restart
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ cross_server:
|
|||
deploy_to: '/usr/local/app/diaspora'
|
||||
user: 'root'
|
||||
repo: 'git://github.com/diaspora/diaspora.git'
|
||||
branch: 'private_key_user_refactor'
|
||||
branch: 'fb'
|
||||
default_env: 'development'
|
||||
servers:
|
||||
tom:
|
||||
|
|
|
|||
|
|
@ -6,6 +6,14 @@
|
|||
require File.expand_path('../application', __FILE__)
|
||||
Haml::Template.options[:format] = :html5
|
||||
Haml::Template.options[:escape_html] = true
|
||||
|
||||
# Load facebook connection application credentials
|
||||
fb_config = YAML::load(File.open(File.expand_path("./config/fb_config.yml")))
|
||||
FB_API_KEY = fb_config['fb_api_key']
|
||||
FB_SECRET = fb_config['fb_secret']
|
||||
FB_APP_ID = fb_config['fb_app_id']
|
||||
HOST = fb_config['host']
|
||||
|
||||
# Initialize the rails application
|
||||
Diaspora::Application.initialize!
|
||||
|
||||
|
|
|
|||
4
config/fb_config.yml
Normal file
4
config/fb_config.yml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
fb_api_key: {dcf4e90df086cf6d3e531b31e043ff32}
|
||||
fb_secret: {7fe864834726f8a5e65bc93928b99a53}
|
||||
fb_app_id: {120373411325347}
|
||||
host: http://localhost:3000/
|
||||
|
|
@ -113,6 +113,8 @@ cs:
|
|||
aspect_not_empty: "Aspekt není prázdný"
|
||||
users:
|
||||
edit:
|
||||
editing_profile: "Upravit profil"
|
||||
profile:
|
||||
cancel: "Zrušit"
|
||||
update_profile: "Aktualizovat profil"
|
||||
home: "Domů"
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ cy:
|
|||
success:"Cliciwch ar y plus ar y chwith i ddweud wrth Diaspora pwy all weld eich agwedd newydd."
|
||||
users:
|
||||
edit:
|
||||
editing_profile: "Golygu proffil"
|
||||
profile:
|
||||
cancel: "Cancel"
|
||||
update_profile: "Diweddaru Proffil"
|
||||
home: "Adref"
|
||||
|
|
@ -139,4 +141,4 @@ cy:
|
|||
friends_since: "yn ffrindiau ers: %{how_long_ago}"
|
||||
save: "arbed"
|
||||
are_you_sure: "Ydych chi'n sicr?"
|
||||
remove_friend: "dileu ffrind"
|
||||
remove_friend: "dileu ffrind"
|
||||
|
|
|
|||
|
|
@ -100,6 +100,8 @@ de:
|
|||
aspect_not_empty: "Aspekt ist nicht leer"
|
||||
users:
|
||||
edit:
|
||||
editing_profile: "Profil bearbeiten"
|
||||
profile:
|
||||
cancel: "Abbrechen"
|
||||
update_profile: "Profil aktualisieren"
|
||||
home: "Startseite"
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@ en:
|
|||
aspect_not_empty: "Aspect not empty"
|
||||
users:
|
||||
edit:
|
||||
editing_profile: "Editing profile"
|
||||
profile:
|
||||
cancel: "Cancel"
|
||||
update_profile: "Update Profile"
|
||||
home: "Home"
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@ es:
|
|||
aspect_not_empty: "Aspecto no vacio"
|
||||
users:
|
||||
edit:
|
||||
editing_profile: "Editando perfil"
|
||||
profile:
|
||||
cancel: "Cancelar"
|
||||
update_profile: "Actualizar Perfil"
|
||||
home: "Home"
|
||||
|
|
|
|||
|
|
@ -100,6 +100,8 @@ fr-informal:
|
|||
aspect_not_empty: "L’aspect n’est pas vide"
|
||||
users:
|
||||
edit:
|
||||
editing_profile: "Édition du profil"
|
||||
profile:
|
||||
cancel: "Annuler"
|
||||
update_profile: "Mettre à jour le profil"
|
||||
home: "Accueil"
|
||||
|
|
|
|||
|
|
@ -87,6 +87,8 @@ fr:
|
|||
success:"Cliquez sur plus situé sur le côté gauche afin d’en informer Diaspora qui peut voir votre nouvel aspect."
|
||||
users:
|
||||
edit:
|
||||
editing_profile: "Édition du profil"
|
||||
profile:
|
||||
cancel: "Annuler"
|
||||
update_profile: "Mettre à jour le profil"
|
||||
home: "Accueil"
|
||||
|
|
|
|||
|
|
@ -102,6 +102,8 @@ he:
|
|||
aspect_not_empty: "ההיסט אינו ריק"
|
||||
users:
|
||||
edit:
|
||||
editing_profile: "עריכת הפרופיל"
|
||||
profile:
|
||||
cancel: "ביטול"
|
||||
update_profile: "עדכון הפרופיל"
|
||||
home: "בית"
|
||||
|
|
|
|||
|
|
@ -100,6 +100,8 @@ it:
|
|||
aspect_not_empty: "Aspetto non vuoto"
|
||||
users:
|
||||
edit:
|
||||
editing_profile: "Modifica del profilo"
|
||||
profile:
|
||||
cancel: "Annulla"
|
||||
update_profile: "Aggiorna profilo"
|
||||
home: "Home"
|
||||
|
|
|
|||
|
|
@ -100,6 +100,8 @@ pt-BR:
|
|||
aspect_not_empty: "Aspecto não está vazio"
|
||||
users:
|
||||
edit:
|
||||
editing_profile: "Editando perfil"
|
||||
profile:
|
||||
cancel: "Cancelar"
|
||||
update_profile: "Atualizar Perfil"
|
||||
home: "Home"
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ ro:
|
|||
success:"Click pe semnul plus în partea stângă pentru a indica cine poate accesa noul aspect."
|
||||
users:
|
||||
edit:
|
||||
editing_profile: "Editare profil"
|
||||
profile:
|
||||
cancel: "Renunță"
|
||||
update_profile: "Actualizează Profil"
|
||||
home: "Home"
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ ru:
|
|||
success:"Нажмите на плюс слева, для того, что-бы указать Diaspora тех, кто может видеть ваш новый аспект."
|
||||
users:
|
||||
edit:
|
||||
editing_profile: "Редактирование профиля"
|
||||
profile:
|
||||
cancel: "Отмена"
|
||||
update_profile: "Обновить профиль"
|
||||
home: "Домой"
|
||||
|
|
|
|||
|
|
@ -3,31 +3,35 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
Diaspora::Application.routes.draw do
|
||||
resources :people, :only => [:index, :show, :destroy]
|
||||
resources :users, :except => [:create, :new, :show]
|
||||
resources :status_messages
|
||||
resources :comments, :except => [:index]
|
||||
resources :requests, :except => [:edit, :update]
|
||||
resources :photos, :except => [:index]
|
||||
resources :people, :only => [:index, :show, :destroy]
|
||||
resources :users, :except => [:create, :new, :show]
|
||||
resources :status_messages, :only => [:create, :destroy, :show]
|
||||
resources :comments, :except => [:index]
|
||||
resources :requests, :except => [:edit, :update]
|
||||
resources :photos, :except => [:index]
|
||||
resources :albums
|
||||
|
||||
match 'aspects/move_friends', :to => 'aspects#move_friends', :as => 'move_friends'
|
||||
match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend'
|
||||
match 'aspects/manage', :to => 'aspects#manage'
|
||||
resources :aspects, :except => [:edit]
|
||||
match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend'
|
||||
match 'aspects/manage', :to => 'aspects#manage'
|
||||
match 'aspects/public', :to => 'aspects#public'
|
||||
resources :aspects, :except => [:edit]
|
||||
|
||||
match 'warzombie', :to => "dev_utilities#warzombie"
|
||||
match 'zombiefriends', :to => "dev_utilities#zombiefriends"
|
||||
match 'zombiefriendaccept', :to => "dev_utilities#zombiefriendaccept"
|
||||
match 'set_backer_number', :to => "dev_utilities#set_backer_number"
|
||||
match 'set_profile_photo', :to => "dev_utilities#set_profile_photo"
|
||||
match 'services/create', :to => "services#create"
|
||||
match 'services/destroy', :to => "services#destroy"
|
||||
match 'services/fb_post', :to => "services#fb_post"
|
||||
|
||||
match 'warzombie', :to => "dev_utilities#warzombie"
|
||||
match 'zombiefriends', :to => "dev_utilities#zombiefriends"
|
||||
match 'zombiefriendaccept', :to => "dev_utilities#zombiefriendaccept"
|
||||
match 'set_backer_number', :to => "dev_utilities#set_backer_number"
|
||||
match 'set_profile_photo', :to => "dev_utilities#set_profile_photo"
|
||||
#routes for devise, not really sure you will need to mess with this in the future, lets put default,
|
||||
#non mutable stuff in anohter file
|
||||
devise_for :users, :controllers => {:registrations => "registrations"}
|
||||
match 'login', :to => 'devise/sessions#new', :as => "new_user_session"
|
||||
match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session"
|
||||
match 'signup', :to => 'registrations#new', :as => "new_user_registration"
|
||||
match 'signup', :to => 'registrations#new', :as => "new_user_registration"
|
||||
|
||||
match 'get_to_the_choppa', :to => redirect("/signup")
|
||||
#public routes
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ end
|
|||
def set_app_config username
|
||||
current_config = YAML.load(File.read(Rails.root.join('config', 'app_config.yml.example')))
|
||||
current_config[Rails.env.to_s] ||= {}
|
||||
current_config[Rails.env.to_s]['pod_url'] = "#{username}.joindiaspora.com"
|
||||
current_config['default']['pod_url'] = "#{username}.joindiaspora.com"
|
||||
current_config[Rails.env.to_s]['pod_url'] = "http://#{username}.joindiaspora.com/"
|
||||
current_config['default']['pod_url'] = "http://#{username}.joindiaspora.com/"
|
||||
file = File.new(Rails.root.join('..','..','shared','app_config.yml'),'w')
|
||||
file.write(current_config.to_yaml)
|
||||
file.close
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ require File.join(File.dirname(__FILE__), "..", "..", "config", "environment")
|
|||
def set_app_config username
|
||||
current_config = YAML.load(File.read(Rails.root.join('config', 'app_config.yml.example')))
|
||||
current_config[Rails.env.to_s] ||= {}
|
||||
current_config[Rails.env.to_s]['pod_url'] = "#{username}.joindiaspora.com"
|
||||
current_config['default']['pod_url'] = "#{username}.joindiaspora.com"
|
||||
current_config[Rails.env.to_s]['pod_url'] = "http://#{username}.joindiaspora.com/"
|
||||
current_config['default']['pod_url'] = "http://#{username}.joindiaspora.com/"
|
||||
file = File.new(Rails.root.join('..','..','shared','app_config.yml'),'w')
|
||||
file.write(current_config.to_yaml)
|
||||
file.close
|
||||
|
|
|
|||
|
|
@ -11,12 +11,13 @@ module Diaspora
|
|||
end
|
||||
|
||||
def visible_posts( opts = {} )
|
||||
opts[:order] ||= 'created_at DESC'
|
||||
if opts[:by_members_of]
|
||||
return raw_visible_posts if opts[:by_members_of] == :all
|
||||
aspect = self.aspects.find_by_id( opts[:by_members_of].id )
|
||||
aspect.posts
|
||||
elsif opts[:from]
|
||||
self.raw_visible_posts.find_all_by_person_id(opts[:from].id, :order => 'created_at DESC')
|
||||
else
|
||||
self.raw_visible_posts.all(opts)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -659,15 +659,19 @@ h1.big_text {
|
|||
-moz-box-shadow: 0 2px 4px #333333;
|
||||
opacity: 0.9; }
|
||||
|
||||
#notification_badge {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
margin-left: 854px; }
|
||||
#notification_badge a {
|
||||
background-color: #eeeeee;
|
||||
border: 1px solid #cccccc;
|
||||
border-bottom: none;
|
||||
padding: 3px 10px; }
|
||||
ul#settings_nav {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
marign: 0;
|
||||
font-size: larger; }
|
||||
ul#settings_nav > li a {
|
||||
display: block;
|
||||
height: 100%;
|
||||
border-bottom: 1px solid #eeeeee;
|
||||
padding: 5px 0; }
|
||||
|
||||
.settings_pane {
|
||||
display: none; }
|
||||
|
||||
#fancybox-close:hover {
|
||||
background-color: transparent; }
|
||||
|
|
|
|||
|
|
@ -839,21 +839,30 @@ h1.big_text
|
|||
:-moz-box-shadow 0 2px 4px #333
|
||||
:opacity 0.9
|
||||
|
||||
#notification_badge
|
||||
:position fixed
|
||||
:bottom 0
|
||||
:margin
|
||||
:left 854px
|
||||
ul#settings_nav
|
||||
:list
|
||||
:style none
|
||||
:padding 0
|
||||
:marign 0
|
||||
|
||||
a
|
||||
:background
|
||||
:color #eee
|
||||
:font
|
||||
:size larger
|
||||
|
||||
:border 1px solid #ccc
|
||||
:bottom none
|
||||
> li
|
||||
|
||||
a
|
||||
:display block
|
||||
:height 100%
|
||||
:border
|
||||
:bottom 1px solid #eee
|
||||
:padding 5px 0
|
||||
|
||||
|
||||
.settings_pane
|
||||
:display none
|
||||
|
||||
:padding 3px 10px
|
||||
|
||||
#fancybox-close:hover
|
||||
:background
|
||||
:color transparent
|
||||
|
||||
|
|
|
|||
|
|
@ -69,3 +69,11 @@ Factory.define :photo do |p|
|
|||
end
|
||||
|
||||
Factory.define(:comment) {}
|
||||
|
||||
Factory.define :fb_status do |s|
|
||||
s.graph_id "367501354973"
|
||||
s.author_name "Bret Taylor"
|
||||
s.author_id "220439"
|
||||
s.message "Pigs run from our house in fear. Tonight, I am wrapping the pork tenderloin in bacon and putting pancetta in the corn."
|
||||
s.updated_time Time.parse "2010-03-06T02:57:48+0000"
|
||||
end
|
||||
|
|
|
|||
79
spec/fixtures/fb_status
vendored
Normal file
79
spec/fixtures/fb_status
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
{
|
||||
"id": "367501354973",
|
||||
"from": {
|
||||
"name": "Bret Taylor",
|
||||
"id": "220439"
|
||||
},
|
||||
"message": "Pigs run from our house in fear. Tonight, I am wrapping the pork tenderloin in bacon and putting pancetta in the corn.",
|
||||
"updated_time": "2010-03-06T02:57:48+0000",
|
||||
"likes": {
|
||||
"data": [
|
||||
{
|
||||
"id": "29906278",
|
||||
"name": "Ross Miller"
|
||||
}
|
||||
]
|
||||
},
|
||||
"comments": {
|
||||
"data": [
|
||||
{
|
||||
"id": "367501354973_12216733",
|
||||
"from": {
|
||||
"name": "Doug Edwards",
|
||||
"id": "628675309"
|
||||
},
|
||||
"message": "Make sure you don't, as they say, go whole hog...\nhttp://www.youtube.com/watch?v=U4wTFuaV8VQ",
|
||||
"created_time": "2010-03-06T03:24:46+0000"
|
||||
},
|
||||
{
|
||||
"id": "367501354973_12249673",
|
||||
"from": {
|
||||
"name": "Tom Taylor",
|
||||
"id": "1249191863"
|
||||
},
|
||||
"message": "Are you and Karen gonna, as they say, pig out?",
|
||||
"created_time": "2010-03-06T21:05:21+0000"
|
||||
},
|
||||
{
|
||||
"id": "367501354973_12249857",
|
||||
"from": {
|
||||
"name": "Sheila Taylor",
|
||||
"id": "1315606682"
|
||||
},
|
||||
"message": "how did it turn out? Sounds nummy!\n",
|
||||
"created_time": "2010-03-06T21:10:30+0000"
|
||||
},
|
||||
{
|
||||
"id": "367501354973_12250973",
|
||||
"from": {
|
||||
"name": "Bret Taylor",
|
||||
"id": "220439"
|
||||
},
|
||||
"message": "Mom: turned out well. Sauce was good as well: pan sauce with mustard, balsamic, onion, and maple syrup. Surprisingly good in the end, and not too sweet, which was my concern. ",
|
||||
"created_time": "2010-03-06T21:44:53+0000"
|
||||
},
|
||||
{
|
||||
"id": "367501354973_12251276",
|
||||
"from": {
|
||||
"name": "Sheila Taylor",
|
||||
"id": "1315606682"
|
||||
},
|
||||
"message": "Sounds delicious! I probably would have skipped the maple syrup, but I am not married to a Canadian :)\n\nSheila Taylor\n(925) 818-7795\nP.O. Box 938\nGlen Ellen, CA 95442\nwww.winecountrytrekking.com",
|
||||
"created_time": "2010-03-06T21:55:12+0000"
|
||||
},
|
||||
{
|
||||
"id": "367501354973_12264435",
|
||||
"from": {
|
||||
"name": "Amelia Ann Arapoff",
|
||||
"id": "1580390378"
|
||||
},
|
||||
"message": "Bacon is always in our refrigerator, in case of need, somehow there is always need.",
|
||||
"created_time": "2010-03-07T05:11:52+0000"
|
||||
}
|
||||
],
|
||||
"paging": {
|
||||
"previous": "https://graph.facebook.com/367501354973/comments?access_token=2227470867%7C2.wNlupL2HPsOtrlYFBF56NA__.3600.1285354800-100001548997697%7C8lZ_pdgNDvSHYS4o1OkqhdQu6mA&limit=25&since=2010-03-07T05%3A11%3A52%2B0000",
|
||||
"next": "https://graph.facebook.com/367501354973/comments?access_token=2227470867%7C2.wNlupL2HPsOtrlYFBF56NA__.3600.1285354800-100001548997697%7C8lZ_pdgNDvSHYS4o1OkqhdQu6mA&limit=25&until=2010-03-06T03%3A24%3A45%2B0000"
|
||||
}
|
||||
}
|
||||
}
|
||||
43
spec/models/fb_status_spec.rb
Normal file
43
spec/models/fb_status_spec.rb
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
|
||||
|
||||
require File.dirname(__FILE__) + '/../spec_helper'
|
||||
|
||||
describe FbStatus do
|
||||
|
||||
let(:fb_status) { Factory.create :fb_status }
|
||||
|
||||
it 'is valid' do
|
||||
fb_status.should be_valid
|
||||
end
|
||||
|
||||
describe '#from_api' do
|
||||
let!(:json_string) {File.open(File.dirname(__FILE__) + '/../fixtures/fb_status').read}
|
||||
let!(:json_object) { JSON.parse(json_string) }
|
||||
let!(:status_from_json) {FbStatus.from_api(json_object)}
|
||||
|
||||
it 'has graph_id' do
|
||||
status_from_json.graph_id.should == json_object['id']
|
||||
end
|
||||
|
||||
it 'has author_id' do
|
||||
status_from_json.author_id.should == json_object['from']['id']
|
||||
end
|
||||
|
||||
it 'has author_name' do
|
||||
status_from_json.author_name.should == json_object['from']['name']
|
||||
end
|
||||
|
||||
it 'has message' do
|
||||
status_from_json.message.should == json_object['message']
|
||||
end
|
||||
|
||||
it 'has author_name' do
|
||||
status_from_json.updated_time.should == Time.parse(json_object['updated_time'])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -46,15 +46,6 @@ describe User do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#repost' do
|
||||
it 'should make the post visible in another aspect' do
|
||||
status_message = user.post(:status_message, :message => "hello", :to => aspect.id)
|
||||
user.repost(status_message, :to => aspect1.id)
|
||||
aspect1.reload
|
||||
aspect1.posts.count.should be 1
|
||||
end
|
||||
end
|
||||
|
||||
describe '#update_post' do
|
||||
it 'should update fields' do
|
||||
album = user.post(:album, :name => "Profile Photos", :to => aspect.id)
|
||||
|
|
|
|||
|
|
@ -12,13 +12,38 @@ describe User do
|
|||
let!(:user2) { Factory(:user_with_aspect) }
|
||||
|
||||
let!(:status_message1) { user2.post :status_message, :message => "hi", :to => user2.aspects.first.id }
|
||||
let!(:status_message2) { user2.post :status_message, :message => "hey", :public => true , :to => user2.aspects.first.id }
|
||||
let!(:status_message3) { user2.post :status_message, :message => "va", :to => user2.aspects.first.id }
|
||||
let!(:status_message4) { user2.post :status_message, :message => "da", :public => true , :to => user2.aspects.first.id }
|
||||
|
||||
|
||||
before do
|
||||
friend_users(user, first_aspect, user2, user2.aspects.first)
|
||||
end
|
||||
|
||||
describe "#visible_posts" do
|
||||
it "generates a stream for each aspect that includes only that aspect's posts" do
|
||||
it "queries by person id" do
|
||||
user2.visible_posts(:person_id => user2.person.id).include?(status_message1).should == true
|
||||
user2.visible_posts(:person_id => user2.person.id).include?(status_message2).should == true
|
||||
user2.visible_posts(:person_id => user2.person.id).include?(status_message3).should == true
|
||||
user2.visible_posts(:person_id => user2.person.id).include?(status_message4).should == true
|
||||
end
|
||||
|
||||
it "selects public posts" do
|
||||
user2.visible_posts(:public => true).include?(status_message2).should == true
|
||||
user2.visible_posts(:public => true).include?(status_message4).should == true
|
||||
end
|
||||
|
||||
it "selects non public posts" do
|
||||
user2.visible_posts(:public => false).include?(status_message1).should == true
|
||||
user2.visible_posts(:public => false).include?(status_message3).should == true
|
||||
end
|
||||
|
||||
it "selects by message contents" do
|
||||
user2.visible_posts(:message => "hi").include?(status_message1).should == true
|
||||
end
|
||||
|
||||
it "queries by aspect" do
|
||||
user3 = Factory(:user_with_aspect)
|
||||
status_message2 = user3.post :status_message, :message => "heyyyy", :to => user3.aspects.first.id
|
||||
user4 = Factory(:user_with_aspect)
|
||||
|
|
|
|||
Loading…
Reference in a new issue