Merge branch 'master' of git://github.com/diaspora/diaspora into migration_with_tmp_post_id

This commit is contained in:
Manuel Schölling 2011-10-22 19:50:24 +02:00
commit eddc3eb012
23 changed files with 132 additions and 85 deletions

View file

@ -6,7 +6,7 @@ class HomeController < ApplicationController
def show
if current_user
redirect_to :controller => 'aspects', :action => 'index'
redirect_to multi_path
elsif is_mobile_device?
redirect_to user_session_path
else

View file

@ -0,0 +1,11 @@
# Copyright (c) 2010-2011, 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', 'stream', 'multi')
class MultisController < ApplicationController
def index
default_stream_action(Stream::Multi)
end
end

View file

@ -1,9 +0,0 @@
require File.join(Rails.root, 'lib', 'stream', 'soup')
class SoupsController < ApplicationController
#before_filter :redirect_unless_admin
def index
default_stream_action(Stream::Soup)
end
end

View file

@ -44,7 +44,7 @@ class UsersController < ApplicationController
elsif u[:show_community_spotlight_in_stream]
if @user.update_attributes(u)
flash[:notice] = I18n.t 'users.update.settings_updated'
redirect_to soup_path
redirect_to multi_path
return
else
flash[:notice] = I18n.t 'users.update.settings_not_updated'

View file

@ -21,15 +21,15 @@ module InterimStreamHackinessHelper
end
def from_group(post)
if defined?(@stream) && params[:controller]== 'soups'
if defined?(@stream) && params[:controller] == 'multis'
@stream.post_from_group(post)
else
[]
end
end
def what_soup_sentence(post)
from_group(post).map{|x| x.to_s.gsub("_soup", '').gsub('_',' ').titleize}.to_sentence
def what_stream_sentence(post)
from_group(post).map{|x| I18n.t("streams.#{x.to_s}")}.to_sentence
end
def stream_settings_link(post)

View file

@ -16,8 +16,8 @@ module StreamHelper
spotlight_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order])
elsif controller.instance_of?(MentionsController)
mentions_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order])
elsif controller.instance_of?(SoupsController)
soup_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order])
elsif controller.instance_of?(MultisController)
multi_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order])
elsif controller.instance_of?(PostsController)
public_stream_path(:max_time => time_for_scroll(opts[:ajax_stream], @stream), :sort_order => session[:sort_order])
elsif controller.instance_of?(AspectsController)

View file

@ -4,11 +4,11 @@
#aspect_stream_header
#sort_by
= t('.recently')
= t('streams.recently')
%span.controls
= link_to_if(session[:sort_order] == 'created_at', t('.commented_on'), stream.link(:sort_order => 'updated_at'))
= link_to_if(session[:sort_order] == 'created_at', t('streams.commented_on'), stream.link(:sort_order => 'updated_at'))
·
= link_to_if(session[:sort_order] == 'updated_at', t('.posted'), stream.link(:sort_order => 'created_at' ))
= link_to_if(session[:sort_order] == 'updated_at', t('streams.posted'), stream.link(:sort_order => 'created_at' ))
%h3
= stream.title

View file

@ -16,13 +16,13 @@
.section
%ul.left_nav
%li
= link_to "Welcome", getting_started_path, :class => "home_selector"
= link_to t(".welcome"), getting_started_path, :class => "home_selector"
.section
%ul.left_nav
%li
%b
= link_to "Soup", soup_path, :class => 'home_selector'
= link_to t("streams.multi.title"), multi_path, :class => 'home_selector'
.section
= render 'aspects/aspect_listings', :stream => @stream
@ -31,7 +31,7 @@
%ul.left_nav
%li
%b
= link_to t('.mentions'), mentions_path, :class => 'home_selector'
= link_to t('streams.mentions.title'), mentions_path, :class => 'home_selector'
.section#followed_tags_listing
= render 'tags/followed_tags_listings'

View file

@ -18,7 +18,7 @@
= t('share_visibilites.update.see_it_on_their_profile', :name => person_link(post.author)).html_safe
= link_to t('undo'), share_visibility_path(:id => "42", :post_id => post.id), :method => :put, :remote => true
.indicator{:title => "from #{what_soup_sentence(post)}"}
.indicator{:title => "#{what_stream_sentence(post)}"}
= stream_settings_link(post)
.sm_body

View file

@ -5,7 +5,7 @@
- if user_signed_in?
%ul.left_nav
%li
%b=link_to t('aspects.index.tags_following'), tag_followings_path, :class => 'home_selector'
%b=link_to t('streams.followed_tag.title'), tag_followings_path, :class => 'home_selector'
%ul.sub_nav
- if tags.size > 0

View file

@ -1,5 +1,10 @@
#this breaks seed scripts
if AppConfig[:featured_users].present? && AppConfig[:community_spotlight].blank?
AppConfig[:community_spotlight] = AppConfig[:featured_users]
puts "DEPRICATION WARNING (10/21/11): Please change `featured_users` in your applicaiton.yml to `community_spotlight`. Thanks!"
end
unless !ActiveRecord::Base.connection.table_exists?('people') || Rails.env == 'test' || AppConfig[:community_spotlight].nil? || AppConfig[:community_spotlight].count == Person.community_spotlight.count
print "Fetching community spotlight users from remote servers"
AppConfig[:community_spotlight].each do |x|

View file

@ -104,12 +104,6 @@ en:
updating: "updating"
aspect_contacts:
done_editing: "done editing"
aspect_stream:
stream: "Stream"
mentions: "Mentions"
recently: "recently:"
commented_on: "commented on"
posted: "posted"
show:
edit_aspect: "edit aspect"
no_posts_message:
@ -129,7 +123,6 @@ en:
view_all_contacts: "View all contacts"
no_contacts: "You don't have any contacts here yet."
manage_your_aspects: "Manage your aspects."
new:
name: "Name (only visible to you)"
create: "Create"
@ -159,13 +152,12 @@ en:
acquaintances: "Acquaintances"
friends: "Friends"
index:
mentions: "Mentions"
welcome: "Welcome"
community_spotlight: "Community Spotlight"
see_more_from_us: "See more of the D* community."
donate: "Donate"
keep_us_running: "Keep %{pod} running fast and buy servers their coffee fix with a monthly donation!"
your_aspects: "Your Aspects"
tags_following: "Followed Tags"
no_tags: "+ Find a tag to follow"
unfollow_tag: "Stop following #%{tag}"
handle_explanation: "This is your diaspora id. Like an email address, you can give this to people to reach you."
@ -833,18 +825,36 @@ en:
no_applications: "You haven't registered any applications yet."
streams:
recently: "recently:"
commented_on: "commented on"
posted: "posted"
community_spotlight_stream: "Community Spotlight"
aspects_stream: "Aspects"
mentioned_stream: "@Mentions"
followed_tags_stream: "#Followed Tags"
mentions:
title: "Your Mentions"
title: "@Mentions"
contacts_title: "People who mentioned you"
followed_tag:
title: "#Followed Tags"
contacts_title: "People who dig these tags"
tags:
title: "Posts tagged: %{tags}"
contacts_title: "People who dig these tags"
contacts_title: "People who dig this tag"
public:
title: "Public Activity"
contacts_title: "Recent Posters"
soup:
title: "The Soup"
contacts_title: "People in your Soup"
multi:
title: "Stream"
contacts_title: "People in your Stream"
aspects:
title: "Your Aspects"
users:
logged_out:

View file

@ -113,7 +113,7 @@ Diaspora::Application.routes.draw do
get 'community_spotlight' => "contacts#spotlight", :as => 'community_spotlight'
get 'soup' => "soups#index", :as => 'soup'
get 'stream' => "multis#index", :as => 'multi'
resources :people, :except => [:edit, :update] do
resources :status_messages

View file

@ -33,10 +33,8 @@ ActiveRecord::Schema.define(:version => 20111021184041) do
end
add_index "aspect_visibilities", ["aspect_id"], :name => "index_aspect_visibilities_on_aspect_id"
add_index "aspect_visibilities", ["shareable_id", "aspect_id"], :name => "index_aspect_visibilities_on_post_id_and_aspect_id", :unique => true
add_index "aspect_visibilities", ["shareable_id", "shareable_type", "aspect_id"], :name => "shareable_and_aspect_id"
add_index "aspect_visibilities", ["shareable_id", "shareable_type"], :name => "index_aspect_visibilities_on_shareable_id_and_shareable_type"
add_index "aspect_visibilities", ["shareable_id"], :name => "index_aspect_visibilities_on_post_id"
create_table "aspects", :force => true do |t|
t.string "name", :null => false
@ -51,17 +49,17 @@ ActiveRecord::Schema.define(:version => 20111021184041) do
add_index "aspects", ["user_id"], :name => "index_aspects_on_user_id"
create_table "comments", :force => true do |t|
t.text "text", :null => false
t.integer "commentable_id", :null => false
t.integer "author_id", :null => false
t.string "guid", :null => false
t.text "text", :null => false
t.integer "commentable_id", :null => false
t.integer "author_id", :null => false
t.string "guid", :null => false
t.text "author_signature"
t.text "parent_author_signature"
t.text "youtube_titles"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "likes_count", :default => 0, :null => false
t.string "commentable_type", :default => "Post", :null => false
t.integer "likes_count", :default => 0, :null => false
t.string "commentable_type", :limit => 60, :default => "Post", :null => false
end
add_index "comments", ["author_id"], :name => "index_comments_on_person_id"
@ -368,17 +366,15 @@ ActiveRecord::Schema.define(:version => 20111021184041) do
add_index "services", ["user_id"], :name => "index_services_on_user_id"
create_table "share_visibilities", :force => true do |t|
t.integer "shareable_id", :null => false
t.integer "shareable_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "hidden", :default => false, :null => false
t.integer "contact_id", :null => false
t.string "shareable_type", :default => "Post", :null => false
t.boolean "hidden", :default => false, :null => false
t.integer "contact_id", :null => false
t.string "shareable_type", :limit => 60, :default => "Post", :null => false
end
add_index "share_visibilities", ["contact_id", "shareable_id"], :name => "index_post_visibilities_on_contact_id_and_post_id", :unique => true
add_index "share_visibilities", ["contact_id"], :name => "index_post_visibilities_on_contact_id"
add_index "share_visibilities", ["shareable_id", "hidden", "contact_id"], :name => "index_post_visibilities_on_post_id_and_hidden_and_contact_id", :unique => true
add_index "share_visibilities", ["shareable_id", "shareable_type", "contact_id"], :name => "shareable_and_contact_id"
add_index "share_visibilities", ["shareable_id", "shareable_type", "hidden", "contact_id"], :name => "shareable_and_hidden_and_contact_id"
add_index "share_visibilities", ["shareable_id"], :name => "index_post_visibilities_on_post_id"

View file

@ -81,7 +81,7 @@ class Stream::Aspect < Stream::Base
# @return [String]
def title
if self.for_all_aspects?
I18n.t('aspects.aspect_stream.stream')
I18n.t('streams.aspects.title')
else
self.aspects.to_sentence
end

View file

@ -5,7 +5,7 @@ class Stream::Base
def initialize(user, opts={})
self.user = user
self.max_time = opts[:max_time]
self.order = opts[:order]
self.order = opts[:order]
end
# @return [Person]

View file

@ -9,7 +9,7 @@ class Stream::FollowedTag < Stream::Base
end
def title
I18n.t('aspects.index.tags_following')
I18n.t('streams.followed_tag.title')
end
# @return [ActiveRecord::Association<Post>] AR association of posts
@ -19,11 +19,9 @@ class Stream::FollowedTag < Stream::Base
end
def contacts_title
I18n.translate('streams.tags.contacts_title')
I18n.translate('streams.followed_tag.contacts_title')
end
private
def tag_string

View file

@ -1,14 +1,18 @@
class Stream::Soup < Stream::Base
class Stream::Multi < Stream::Base
# @return [String] URL
def link(opts)
Rails.application.routes.url_helpers.soup_path
Rails.application.routes.url_helpers.multi_path
end
# @return [String]
def title
I18n.t('streams.soup.title')
I18n.t('streams.multi.title')
end
# @return [String]
def contacts_title
I18n.t('streams.soup.contacts_title')
I18n.t('streams.multi.contacts_title')
end
def posts
@ -19,6 +23,7 @@ class Stream::Soup < Stream::Base
end.call
end
# @return [Boolean]
def ajax_stream?
false
end
@ -26,21 +31,32 @@ class Stream::Soup < Stream::Base
#emits an enum of the groups which the post appeared
# :spotlight, :aspects, :tags, :mentioned
def post_from_group(post)
[:mentioned, :aspects, :followed_tags, :community_spotlight].collect do |source|
streams_included.collect do |source|
is_in?(source, post)
end.compact
end
private
# @return [Array<Symbol>]
def streams_included
@streams_included ||= lambda do
array = [:mentioned, :aspects, :followed_tags]
array << :community_spotlight if include_community_spotlight?
array
end.call
end
# @return [Symbol]
def is_in?(sym, post)
if self.send("#{sym.to_s}_post_ids").find{|x| x == post.id}
"#{sym.to_s}_soup".to_sym
"#{sym.to_s}_stream".to_sym
end
end
# @return [Boolean]
def include_community_spotlight?
user.show_community_spotlight_in_stream?
AppConfig[:community_spotlight].present? && user.show_community_spotlight_in_stream?
end
def aspects_post_ids

View file

@ -1,4 +1,4 @@
Diaspora.Pages.SoupsIndex = function() {
Diaspora.Pages.MultisIndex = function() {
var self = this;
this.subscribe("page/ready", function(evt, document) {

View file

@ -3507,15 +3507,15 @@ ul#getting_started
:padding 0
:margin 0
.community_spotlight_soup
.community_spotlight_stream
.indicator
:background-color #DE5099
.followed_tags_soup
.followed_tags_stream
.indicator
:background-color $blue
.aspects_soup
.aspects_stream
.indicator
:background-color $green
.mentioned_soup
.mentioned_stream
.indicator
:background-color #E3E856

View file

@ -12,20 +12,10 @@ describe HomeController do
response.should_not be_redirect
end
it 'redirects to aspects index if user is logged in' do
it 'redirects to multis index if user is logged in' do
sign_in alice
get :show, :home => true
response.should redirect_to( :controller => 'aspects', :action => 'index')
end
it 'redirects to aspects index with stored aspects' do
sign_in alice
@aspect0 = alice.aspects.all[0]
@aspect1 = alice.aspects.create(:name => "Yeaaaah!")
@index_params = {:a_ids => [@aspect0.id.to_s, @aspect1.id.to_s]}
alice.save
get :show
response.should redirect_to( :controller => 'aspects', :action => 'index')
response.should redirect_to(multi_path)
end
describe "custom logging on success" do

View file

@ -0,0 +1,30 @@
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe MultisController do
describe '#index' do
before do
@old_spotlight_value = AppConfig[:community_spotlight]
sign_in :user, alice
end
after do
AppConfig[:community_spotlight] = @old_spotlight_value
end
it 'succeeds' do
AppConfig[:community_spotlight] = [bob.person.diaspora_handle]
get :index
response.should be_success
end
it 'succeeds without AppConfig[:community_spotlight]' do
AppConfig[:community_spotlight] = nil
get :index
response.should be_success
end
end
end

View file

@ -1,9 +1,9 @@
require 'spec_helper'
require File.join(Rails.root, 'spec', 'shared_behaviors', 'stream')
describe Stream::Soup do
describe Stream::Multi do
before do
@stream = Stream::Soup.new(Factory(:user), :max_time => Time.now, :order => 'updated_at')
@stream = Stream::Multi.new(Factory(:user), :max_time => Time.now, :order => 'updated_at')
end
describe 'shared behaviors' do