move all stream actions into PostController
This commit is contained in:
parent
e0a63e624f
commit
bfe0b7129c
36 changed files with 200 additions and 312 deletions
|
|
@ -83,7 +83,7 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
def redirect_unless_admin
|
def redirect_unless_admin
|
||||||
unless current_user.admin?
|
unless current_user.admin?
|
||||||
redirect_to multi_url, :notice => 'you need to be an admin to do that'
|
redirect_to multi_stream_url, :notice => 'you need to be an admin to do that'
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -111,7 +111,7 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_sign_in_path_for(resource)
|
def after_sign_in_path_for(resource)
|
||||||
stored_location_for(:user) || (current_user.getting_started? ? getting_started_path : multi_path)
|
stored_location_for(:user) || (current_user.getting_started? ? getting_started_path : multi_stream_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def tag_followings
|
def tag_followings
|
||||||
|
|
|
||||||
|
|
@ -2,29 +2,13 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require File.join(Rails.root, "lib", 'stream', "aspect")
|
|
||||||
|
|
||||||
class AspectsController < ApplicationController
|
class AspectsController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
before_filter :save_selected_aspects, :only => :index
|
|
||||||
before_filter :ensure_page, :only => :index
|
|
||||||
|
|
||||||
respond_to :html,
|
respond_to :html,
|
||||||
:js,
|
:js,
|
||||||
:json
|
:json
|
||||||
|
|
||||||
def index
|
|
||||||
stream_klass = Stream::Aspect
|
|
||||||
aspect_ids = (session[:a_ids] ? session[:a_ids] : [])
|
|
||||||
@stream = Stream::Aspect.new(current_user, aspect_ids,
|
|
||||||
:max_time => params[:max_time].to_i)
|
|
||||||
|
|
||||||
respond_with do |format|
|
|
||||||
format.html { render 'aspects/index' }
|
|
||||||
format.json{ render_for_api :backbone, :json => @stream.stream_posts, :root => :posts }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@aspect = current_user.aspects.create(params[:aspect])
|
@aspect = current_user.aspects.create(params[:aspect])
|
||||||
|
|
||||||
|
|
@ -132,16 +116,4 @@ class AspectsController < ApplicationController
|
||||||
end
|
end
|
||||||
@aspect.save
|
@aspect.save
|
||||||
end
|
end
|
||||||
|
|
||||||
def ensure_page
|
|
||||||
params[:max_time] ||= Time.now + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def save_selected_aspects
|
|
||||||
if params[:a_ids].present?
|
|
||||||
session[:a_ids] = params[:a_ids]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
# 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', 'comments')
|
|
||||||
|
|
||||||
class CommentStreamController < ApplicationController
|
|
||||||
|
|
||||||
respond_to :html, :json
|
|
||||||
|
|
||||||
def index
|
|
||||||
stream_klass = Stream::Comments
|
|
||||||
|
|
||||||
respond_with do |format|
|
|
||||||
format.html{ default_stream_action(stream_klass) }
|
|
||||||
format.json{ stream_json(stream_klass) }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -6,7 +6,7 @@ class HomeController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
if current_user
|
if current_user
|
||||||
redirect_to multi_path if current_user
|
redirect_to multi_stream_path if current_user
|
||||||
elsif is_mobile_device?
|
elsif is_mobile_device?
|
||||||
redirect_to user_session_path
|
redirect_to user_session_path
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
# 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', 'likes')
|
|
||||||
|
|
||||||
class LikeStreamController < ApplicationController
|
|
||||||
|
|
||||||
respond_to :html, :json
|
|
||||||
|
|
||||||
def index
|
|
||||||
stream_klass = Stream::Likes
|
|
||||||
|
|
||||||
respond_with do |format|
|
|
||||||
format.html{ default_stream_action(stream_klass) }
|
|
||||||
format.json{ stream_json(stream_klass) }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
# 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', 'mention')
|
|
||||||
|
|
||||||
class MentionsController < ApplicationController
|
|
||||||
|
|
||||||
respond_to :html, :json
|
|
||||||
|
|
||||||
def index
|
|
||||||
stream_klass = Stream::Mention
|
|
||||||
|
|
||||||
respond_with do |format|
|
|
||||||
format.html{ default_stream_action(stream_klass) }
|
|
||||||
format.json{ stream_json(stream_klass) }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
# 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
|
|
||||||
|
|
||||||
respond_to :html, :json
|
|
||||||
|
|
||||||
def index
|
|
||||||
stream_klass = Stream::Multi
|
|
||||||
|
|
||||||
respond_with do |format|
|
|
||||||
format.html{ default_stream_action(stream_klass) }
|
|
||||||
format.mobile{ default_stream_action(stream_klass) }
|
|
||||||
format.json{ stream_json(stream_klass) }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -50,7 +50,7 @@ class NotificationsController < VannaController
|
||||||
|
|
||||||
post_process :html do
|
post_process :html do
|
||||||
def post_read_all(json)
|
def post_read_all(json)
|
||||||
Response.new(:status => 302, :location => multi_path)
|
Response.new(:status => 302, :location => multi_stream_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,21 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
require File.join(Rails.root, 'lib', 'stream', 'public')
|
require File.join(Rails.root, "lib", "stream", "aspect")
|
||||||
|
require File.join(Rails.root, "lib", "stream", "multi")
|
||||||
|
require File.join(Rails.root, "lib", "stream", "comments")
|
||||||
|
require File.join(Rails.root, "lib", "stream", "likes")
|
||||||
|
require File.join(Rails.root, "lib", "stream", "mention")
|
||||||
|
require File.join(Rails.root, "lib", "stream", "followed_tag")
|
||||||
|
|
||||||
class PostsController < ApplicationController
|
class PostsController < ApplicationController
|
||||||
before_filter :authenticate_user!, :except => :show
|
before_filter :authenticate_user!, :except => :show
|
||||||
before_filter :set_format_if_malformed_from_status_net, :only => :show
|
before_filter :set_format_if_malformed_from_status_net, :only => :show
|
||||||
before_filter :redirect_unless_admin, :only => :index
|
|
||||||
|
before_filter :redirect_unless_admin, :only => :public
|
||||||
|
|
||||||
|
before_filter :save_selected_aspects, :only => :aspects
|
||||||
|
before_filter :ensure_page, :only => :aspects
|
||||||
|
|
||||||
respond_to :html,
|
respond_to :html,
|
||||||
:mobile,
|
:mobile,
|
||||||
|
|
@ -54,7 +63,7 @@ class PostsController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js {render 'destroy'}
|
format.js {render 'destroy'}
|
||||||
format.json { render :nothing => true, :status => 204 }
|
format.json { render :nothing => true, :status => 204 }
|
||||||
format.all {redirect_to multi_path}
|
format.all {redirect_to multi_stream_path}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Rails.logger.info "event=post_destroy status=failure user=#{current_user.diaspora_handle} reason='User does not own post'"
|
Rails.logger.info "event=post_destroy status=failure user=#{current_user.diaspora_handle} reason='User does not own post'"
|
||||||
|
|
@ -62,16 +71,57 @@ class PostsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
# streams
|
||||||
default_stream_action(Stream::Public)
|
def aspects
|
||||||
|
stream_klass = Stream::Aspect
|
||||||
|
aspect_ids = (session[:a_ids] ? session[:a_ids] : [])
|
||||||
|
@stream = Stream::Aspect.new(current_user, aspect_ids,
|
||||||
|
:max_time => params[:max_time].to_i)
|
||||||
|
|
||||||
|
respond_with do |format|
|
||||||
|
format.html { render 'aspects/index' }
|
||||||
|
format.json{ render_for_api :backbone, :json => @stream.stream_posts, :root => :posts }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def public
|
||||||
|
stream_responder(Stream::Public)
|
||||||
|
end
|
||||||
|
|
||||||
|
def multi
|
||||||
|
stream_responder(Stream::Multi)
|
||||||
|
end
|
||||||
|
|
||||||
|
def commented
|
||||||
|
stream_responder(Stream::Comments)
|
||||||
|
end
|
||||||
|
|
||||||
|
def liked
|
||||||
|
stream_responder(Stream::Likes)
|
||||||
|
end
|
||||||
|
|
||||||
|
def mentioned
|
||||||
|
stream_responder(Stream::Mention)
|
||||||
|
end
|
||||||
|
|
||||||
|
def followed_tags
|
||||||
|
stream_responder(Stream::FollowedTag)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def stream_responder(stream_klass)
|
||||||
|
respond_with do |format|
|
||||||
|
format.html{ default_stream_action(stream_klass) }
|
||||||
|
format.mobile{ default_stream_action(stream_klass) }
|
||||||
|
format.json{ stream_json(stream_klass) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_format_if_malformed_from_status_net
|
def set_format_if_malformed_from_status_net
|
||||||
request.format = :html if request.format == 'application/html+xml'
|
request.format = :html if request.format == 'application/html+xml'
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def user_can_not_comment_on_post?
|
def user_can_not_comment_on_post?
|
||||||
if @post.public && @post.author.local?
|
if @post.public && @post.author.local?
|
||||||
false
|
false
|
||||||
|
|
@ -83,4 +133,14 @@ class PostsController < ApplicationController
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def save_selected_aspects
|
||||||
|
if params[:a_ids].present?
|
||||||
|
session[:a_ids] = params[:a_ids]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def ensure_page
|
||||||
|
params[:max_time] ||= Time.now + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class StatusMessagesController < ApplicationController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to :back}
|
format.html { redirect_to :back}
|
||||||
format.mobile{ redirect_to multi_path}
|
format.mobile{ redirect_to multi_stream_path}
|
||||||
format.json{ render :json => @status_message.as_api_response(:backbone), :status => 201 }
|
format.json{ render :json => @status_message.as_api_response(:backbone), :status => 201 }
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -2,22 +2,12 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
#
|
#
|
||||||
require File.join(Rails.root, 'lib', 'stream', 'followed_tag')
|
|
||||||
|
|
||||||
class TagFollowingsController < ApplicationController
|
class TagFollowingsController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
||||||
respond_to :html, :json
|
respond_to :html, :json
|
||||||
|
|
||||||
def index
|
|
||||||
stream_klass = Stream::FollowedTag
|
|
||||||
|
|
||||||
respond_with do |format|
|
|
||||||
format.html{ default_stream_action(stream_klass) }
|
|
||||||
format.json{ stream_json(stream_klass) }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# POST /tag_followings
|
# POST /tag_followings
|
||||||
# POST /tag_followings.xml
|
# POST /tag_followings.xml
|
||||||
def create
|
def create
|
||||||
|
|
@ -73,6 +63,6 @@ class TagFollowingsController < ApplicationController
|
||||||
@tag_following = current_user.tag_followings.create(:tag_id => @tag.id)
|
@tag_following = current_user.tag_followings.create(:tag_id => @tag.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
redirect_to multi_path
|
redirect_to multi_stream_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class UsersController < ApplicationController
|
||||||
if params[:user] && params[:user][:current_password] && current_user.valid_password?(params[:user][:current_password])
|
if params[:user] && params[:user][:current_password] && current_user.valid_password?(params[:user][:current_password])
|
||||||
current_user.close_account!
|
current_user.close_account!
|
||||||
sign_out current_user
|
sign_out current_user
|
||||||
redirect_to(multi_path, :notice => I18n.t('users.destroy.success'))
|
redirect_to(multi_stream_path, :notice => I18n.t('users.destroy.success'))
|
||||||
else
|
else
|
||||||
if params[:user].present? && params[:user][:current_password].present?
|
if params[:user].present? && params[:user][:current_password].present?
|
||||||
flash[:error] = t 'users.destroy.wrong_password'
|
flash[:error] = t 'users.destroy.wrong_password'
|
||||||
|
|
@ -111,7 +111,7 @@ class UsersController < ApplicationController
|
||||||
format.any { redirect_to person_path(user.person.id) }
|
format.any { redirect_to person_path(user.person.id) }
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
redirect_to multi_path, :error => I18n.t('users.public.does_not_exist', :username => params[:username])
|
redirect_to multi_stream_path, :error => I18n.t('users.public.does_not_exist', :username => params[:username])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -127,14 +127,14 @@ class UsersController < ApplicationController
|
||||||
def logged_out
|
def logged_out
|
||||||
@page = :logged_out
|
@page = :logged_out
|
||||||
if user_signed_in?
|
if user_signed_in?
|
||||||
redirect_to multi_path
|
redirect_to multi_stream_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def getting_started_completed
|
def getting_started_completed
|
||||||
user = current_user
|
user = current_user
|
||||||
user.update_attributes(:getting_started => false)
|
user.update_attributes(:getting_started => false)
|
||||||
redirect_to multi_path
|
redirect_to multi_stream_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def export
|
def export
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ class VannaController < Vanna::Base
|
||||||
|
|
||||||
def redirect_unless_admin
|
def redirect_unless_admin
|
||||||
unless current_user.admin?
|
unless current_user.admin?
|
||||||
redirect_to multi_path, :notice => 'you need to be an admin to do that'
|
redirect_to multi_stream_path, :notice => 'you need to be an admin to do that'
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -10,25 +10,19 @@ module StreamHelper
|
||||||
"/apps/1?#{{:max_time => @posts.last.created_at.to_i}.to_param}"
|
"/apps/1?#{{:max_time => @posts.last.created_at.to_i}.to_param}"
|
||||||
elsif controller.instance_of?(PeopleController)
|
elsif controller.instance_of?(PeopleController)
|
||||||
local_or_remote_person_path(@person, :max_time => time_for_scroll(@stream))
|
local_or_remote_person_path(@person, :max_time => time_for_scroll(@stream))
|
||||||
elsif controller.instance_of?(TagFollowingsController)
|
|
||||||
tag_followings_path(:max_time => time_for_scroll(@stream))
|
|
||||||
elsif controller.instance_of?(MentionsController)
|
|
||||||
mentions_path(:max_time => time_for_scroll(@stream))
|
|
||||||
elsif controller.instance_of?(MultisController)
|
|
||||||
multi_path(:max_time => time_for_scroll(@stream))
|
|
||||||
elsif controller.instance_of?(PostsController)
|
elsif controller.instance_of?(PostsController)
|
||||||
public_stream_path(:max_time => time_for_scroll(@stream))
|
public_stream_path(:max_time => time_for_scroll(@stream))
|
||||||
elsif controller.instance_of?(AspectsController)
|
|
||||||
aspects_path(:max_time => time_for_scroll(@stream), :a_ids => @stream.aspect_ids)
|
|
||||||
elsif controller.instance_of?(LikeStreamController)
|
|
||||||
like_stream_path(:max_time => time_for_scroll(@stream))
|
|
||||||
elsif controller.instance_of?(CommentStreamController)
|
|
||||||
comment_stream_path(:max_time => time_for_scroll(@stream))
|
|
||||||
else
|
else
|
||||||
raise 'in order to use pagination for this new controller, update next_page_path in stream helper'
|
raise 'in order to use pagination for this new controller, update next_page_path in stream helper'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def reshare?(post)
|
||||||
|
post.instance_of?(Reshare)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
def time_for_scroll(stream)
|
def time_for_scroll(stream)
|
||||||
if stream.stream_posts.empty?
|
if stream.stream_posts.empty?
|
||||||
(Time.now() + 1).to_i
|
(Time.now() + 1).to_i
|
||||||
|
|
@ -36,8 +30,4 @@ module StreamHelper
|
||||||
stream.stream_posts.last.send(stream.order.to_sym).to_i
|
stream.stream_posts.last.send(stream.order.to_sym).to_i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def reshare?(post)
|
|
||||||
post.instance_of?(Reshare)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -31,21 +31,21 @@
|
||||||
.section
|
.section
|
||||||
%ul.left_nav
|
%ul.left_nav
|
||||||
%li
|
%li
|
||||||
= link_to t("streams.multi.title"), multi_path, :class => 'home_selector', :rel => 'backbone'
|
= link_to t("streams.multi.title"), multi_stream_path, :class => 'home_selector', :rel => 'backbone'
|
||||||
|
|
||||||
= render 'aspects/aspect_listings', :stream => @stream
|
= render 'aspects/aspect_listings', :stream => @stream
|
||||||
|
|
||||||
%ul.left_nav
|
%ul.left_nav
|
||||||
%li
|
%li
|
||||||
= link_to t('streams.mentions.title'), mentions_path, :class => 'home_selector', :rel => 'backbone'
|
= link_to t('streams.mentions.title'), mentioned_stream_path, :class => 'home_selector', :rel => 'backbone'
|
||||||
|
|
||||||
%ul.left_nav
|
%ul.left_nav
|
||||||
%li
|
%li
|
||||||
= link_to t('streams.comment_stream.title'), comment_stream_path, :class => 'home_selector', :rel => 'backbone'
|
= link_to t('streams.comment_stream.title'), commented_stream_path, :class => 'home_selector', :rel => 'backbone'
|
||||||
|
|
||||||
%ul.left_nav
|
%ul.left_nav
|
||||||
%li
|
%li
|
||||||
= link_to t('streams.like_stream.title'), like_stream_path, :class => 'home_selector', :rel => 'backbone'
|
= link_to t('streams.like_stream.title'), liked_stream_path, :class => 'home_selector', :rel => 'backbone'
|
||||||
|
|
||||||
#followed_tags_listing
|
#followed_tags_listing
|
||||||
= render 'tags/followed_tags_listings'
|
= render 'tags/followed_tags_listings'
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
= yield
|
= yield
|
||||||
|
|
||||||
%header
|
%header
|
||||||
= link_to(image_tag('white@2x.png', :height => 20, :width => 127, :id => 'header_title'), multi_path)
|
= link_to(image_tag('white@2x.png', :height => 20, :width => 127, :id => 'header_title'), multi_stream_path)
|
||||||
- if user_signed_in?
|
- if user_signed_in?
|
||||||
- if yield(:header_action).present?
|
- if yield(:header_action).present?
|
||||||
= yield(:header_action)
|
= yield(:header_action)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
- if user_signed_in?
|
- if user_signed_in?
|
||||||
%ul.left_nav
|
%ul.left_nav
|
||||||
%li
|
%li
|
||||||
%b=link_to t('streams.followed_tag.title'), tag_followings_path, :class => 'home_selector'
|
%b=link_to t('streams.followed_tag.title'), followed_tags_stream_path, :class => 'home_selector'
|
||||||
|
|
||||||
- if @stream.is_a?(Stream::FollowedTag)
|
- if @stream.is_a?(Stream::FollowedTag)
|
||||||
%ul.sub_nav
|
%ul.sub_nav
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,7 @@
|
||||||
|
|
||||||
- content_for :head do
|
- content_for :head do
|
||||||
:css
|
:css
|
||||||
body {
|
body { margin-top: 220px; }
|
||||||
margin-top: 220px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#grey_header
|
#grey_header
|
||||||
.row
|
.row
|
||||||
|
|
@ -25,7 +22,7 @@
|
||||||
%h4
|
%h4
|
||||||
= t('.simply_visit')
|
= t('.simply_visit')
|
||||||
%strong
|
%strong
|
||||||
= link_to AppConfig[:pod_url], multi_path
|
= link_to AppConfig[:pod_url], multi_stream_path
|
||||||
= t('.on_your_mobile_device')
|
= t('.on_your_mobile_device')
|
||||||
|
|
||||||
%p.dull
|
%p.dull
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,10 @@
|
||||||
|
|
||||||
Diaspora::Application.routes.draw do
|
Diaspora::Application.routes.draw do
|
||||||
|
|
||||||
|
|
||||||
# Posting and Reading
|
# Posting and Reading
|
||||||
|
|
||||||
resources :reshares
|
resources :reshares
|
||||||
|
|
||||||
resources :aspects do
|
|
||||||
put :toggle_contact_visibility
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :status_messages, :only => [:new, :create]
|
resources :status_messages, :only => [:new, :create]
|
||||||
|
|
||||||
resources :posts, :only => [:show, :destroy] do
|
resources :posts, :only => [:show, :destroy] do
|
||||||
|
|
@ -20,12 +15,23 @@ Diaspora::Application.routes.draw do
|
||||||
resources :comments, :only => [:new, :create, :destroy, :index]
|
resources :comments, :only => [:new, :create, :destroy, :index]
|
||||||
end
|
end
|
||||||
get 'p/:id' => 'posts#show', :as => 'short_post'
|
get 'p/:id' => 'posts#show', :as => 'short_post'
|
||||||
get 'public_stream' => 'posts#index', :as => 'public_stream'
|
|
||||||
# roll up likes into a nested resource above
|
# roll up likes into a nested resource above
|
||||||
resources :comments, :only => [:create, :destroy] do
|
resources :comments, :only => [:create, :destroy] do
|
||||||
resources :likes, :only => [:create, :destroy, :index]
|
resources :likes, :only => [:create, :destroy, :index]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Streams
|
||||||
|
get "public" => "posts#public", :as => "public_stream"
|
||||||
|
get "stream" => "posts#multi", :as => "multi_stream"
|
||||||
|
get "followed_tags" => "posts#followed_tags", :as => "followed_tags_stream"
|
||||||
|
get "mentions" => "posts#mentioned", :as => "mentioned_stream"
|
||||||
|
get "liked" => "posts#liked", :as => "liked_stream"
|
||||||
|
get "commented" => "posts#commented", :as => "commented_stream"
|
||||||
|
get "aspects" => "posts#aspects", :as => "aspects_stream"
|
||||||
|
|
||||||
|
resources :aspects do
|
||||||
|
put :toggle_contact_visibility
|
||||||
|
end
|
||||||
|
|
||||||
get 'bookmarklet' => 'status_messages#bookmarklet'
|
get 'bookmarklet' => 'status_messages#bookmarklet'
|
||||||
|
|
||||||
|
|
@ -50,26 +56,19 @@ Diaspora::Application.routes.draw do
|
||||||
resources :tags, :only => [:index]
|
resources :tags, :only => [:index]
|
||||||
scope "tags/:name" do
|
scope "tags/:name" do
|
||||||
post "tag_followings" => "tag_followings#create", :as => 'tag_tag_followings'
|
post "tag_followings" => "tag_followings#create", :as => 'tag_tag_followings'
|
||||||
delete "tag_followings" => "tag_followings#destroy"
|
delete "tag_followings" => "tag_followings#destroy", :as => 'tag_tag_followings'
|
||||||
end
|
end
|
||||||
|
|
||||||
post "multiple_tag_followings" => "tag_followings#create_multiple", :as => 'multiple_tag_followings'
|
post "multiple_tag_followings" => "tag_followings#create_multiple", :as => 'multiple_tag_followings'
|
||||||
|
|
||||||
get "tag_followings" => "tag_followings#index", :as => 'tag_followings'
|
|
||||||
resources :mentions, :only => [:index]
|
|
||||||
resources "tag_followings", :only => [:create]
|
resources "tag_followings", :only => [:create]
|
||||||
|
|
||||||
get 'comment_stream' => 'comment_stream#index', :as => 'comment_stream'
|
|
||||||
|
|
||||||
get 'like_stream' => 'like_stream#index', :as => 'like_stream'
|
|
||||||
|
|
||||||
get 'tags/:name' => 'tags#show', :as => 'tag'
|
get 'tags/:name' => 'tags#show', :as => 'tag'
|
||||||
|
|
||||||
resources :apps, :only => [:show]
|
resources :apps, :only => [:show]
|
||||||
|
|
||||||
#Cubbies info page
|
#Cubbies info page
|
||||||
resource :token, :only => :show
|
|
||||||
|
|
||||||
|
resource :token, :only => :show
|
||||||
|
|
||||||
# Users and people
|
# Users and people
|
||||||
|
|
||||||
|
|
@ -120,8 +119,6 @@ Diaspora::Application.routes.draw do
|
||||||
|
|
||||||
get 'community_spotlight' => "contacts#spotlight", :as => 'community_spotlight'
|
get 'community_spotlight' => "contacts#spotlight", :as => 'community_spotlight'
|
||||||
|
|
||||||
get 'stream' => "multis#index", :as => 'multi'
|
|
||||||
|
|
||||||
resources :people, :except => [:edit, :update] do
|
resources :people, :except => [:edit, :update] do
|
||||||
resources :status_messages
|
resources :status_messages
|
||||||
resources :photos
|
resources :photos
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ Feature: invitation acceptance
|
||||||
|
|
||||||
And I preemptively confirm the alert
|
And I preemptively confirm the alert
|
||||||
And I follow "awesome_button"
|
And I follow "awesome_button"
|
||||||
Then I should be on the multi page
|
Then I should be on the multi stream page
|
||||||
|
|
||||||
Scenario: accept invitation from user
|
Scenario: accept invitation from user
|
||||||
Given I have been invited by a user
|
Given I have been invited by a user
|
||||||
|
|
@ -34,7 +34,7 @@ Feature: invitation acceptance
|
||||||
|
|
||||||
And I preemptively confirm the alert
|
And I preemptively confirm the alert
|
||||||
And I follow "awesome_button"
|
And I follow "awesome_button"
|
||||||
Then I should be on the multi page
|
Then I should be on the multi stream page
|
||||||
|
|
||||||
Scenario: sends an invitation
|
Scenario: sends an invitation
|
||||||
Given a user with email "bob@bob.bob"
|
Given a user with email "bob@bob.bob"
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ Feature: Change password
|
||||||
Then I should see "Password changed"
|
Then I should see "Password changed"
|
||||||
Then I should be on the new user session page
|
Then I should be on the new user session page
|
||||||
When I sign in with password "newsecret"
|
When I sign in with password "newsecret"
|
||||||
Then I should be on the multi page
|
Then I should be on the multi stream page
|
||||||
|
|
||||||
Scenario: Reset my password
|
Scenario: Reset my password
|
||||||
Given a user with email "forgetful@users.net"
|
Given a user with email "forgetful@users.net"
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,11 @@ Feature: posting
|
||||||
|
|
||||||
Scenario: can stop following a tag from the tag page
|
Scenario: can stop following a tag from the tag page
|
||||||
When I press "Following #boss"
|
When I press "Following #boss"
|
||||||
And I go to the tag_followings page
|
And I go to the followed tags stream page
|
||||||
Then I should not see "#boss" within ".left_nav"
|
Then I should not see "#boss" within ".left_nav"
|
||||||
|
|
||||||
Scenario: can stop following a tag from the homepage
|
Scenario: can stop following a tag from the homepage
|
||||||
When I go to the tag_followings page
|
When I go to the followed tags stream page
|
||||||
And I preemptively confirm the alert
|
And I preemptively confirm the alert
|
||||||
And I hover over the "li.unfollow#tag-following-boss"
|
And I hover over the "li.unfollow#tag-following-boss"
|
||||||
And I follow "unfollow_boss"
|
And I follow "unfollow_boss"
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ Feature: user authentication
|
||||||
And I fill in "Username" with "ohai"
|
And I fill in "Username" with "ohai"
|
||||||
And I fill in "Password" with "secret"
|
And I fill in "Password" with "secret"
|
||||||
And I press "Sign in"
|
And I press "Sign in"
|
||||||
Then I should be on the multi page
|
Then I should be on the multi stream page
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: user logs out
|
Scenario: user logs out
|
||||||
|
|
@ -19,5 +19,5 @@ Feature: user authentication
|
||||||
Scenario: user uses token auth
|
Scenario: user uses token auth
|
||||||
Given a user with username "ohai" and password "secret"
|
Given a user with username "ohai" and password "secret"
|
||||||
When I post a photo with a token
|
When I post a photo with a token
|
||||||
And I go to the multi page
|
And I go to the multi stream page
|
||||||
Then I should be on the new user session page
|
Then I should be on the new user session page
|
||||||
|
|
|
||||||
|
|
@ -19,18 +19,18 @@ Feature: new user registration
|
||||||
And I preemptively confirm the alert
|
And I preemptively confirm the alert
|
||||||
And I follow "awesome_button"
|
And I follow "awesome_button"
|
||||||
|
|
||||||
Then I should be on the multi page
|
Then I should be on the multi stream page
|
||||||
And I should not see "awesome_button"
|
And I should not see "awesome_button"
|
||||||
|
|
||||||
Scenario: new user skips the setup wizard
|
Scenario: new user skips the setup wizard
|
||||||
When I preemptively confirm the alert
|
When I preemptively confirm the alert
|
||||||
And I follow "awesome_button"
|
And I follow "awesome_button"
|
||||||
Then I should be on the multi page
|
Then I should be on the multi stream page
|
||||||
|
|
||||||
Scenario: closing a popover clears getting started
|
Scenario: closing a popover clears getting started
|
||||||
When I preemptively confirm the alert
|
When I preemptively confirm the alert
|
||||||
And I follow "awesome_button"
|
And I follow "awesome_button"
|
||||||
Then I should be on the multi page
|
Then I should be on the multi stream page
|
||||||
And I have turned off jQuery effects
|
And I have turned off jQuery effects
|
||||||
And I wait for the popovers to appear
|
And I wait for the popovers to appear
|
||||||
And I click close on all the popovers
|
And I click close on all the popovers
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ module NavigationHelpers
|
||||||
def path_to(page_name)
|
def path_to(page_name)
|
||||||
case page_name
|
case page_name
|
||||||
when /^the home(?: )?page$/
|
when /^the home(?: )?page$/
|
||||||
multi_path
|
multi_stream_path
|
||||||
when /^step (\d)$/
|
when /^step (\d)$/
|
||||||
if $1.to_i == 1
|
if $1.to_i == 1
|
||||||
getting_started_path
|
getting_started_path
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ class Stream::Multi < Stream::Base
|
||||||
|
|
||||||
# @return [String] URL
|
# @return [String] URL
|
||||||
def link(opts)
|
def link(opts)
|
||||||
Rails.application.routes.url_helpers.multi_path(opts)
|
Rails.application.routes.url_helpers.multi_stream_path(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [String]
|
# @return [String]
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@ app.Router = Backbone.Router.extend({
|
||||||
routes: {
|
routes: {
|
||||||
"stream": "stream",
|
"stream": "stream",
|
||||||
"aspects:query": "stream",
|
"aspects:query": "stream",
|
||||||
"comment_stream": "stream",
|
"commented": "stream",
|
||||||
"like_stream": "stream",
|
"liked": "stream",
|
||||||
"mentions": "stream",
|
"mentions": "stream",
|
||||||
"people/:id": "stream",
|
"people/:id": "stream",
|
||||||
"u/:name": "stream",
|
"u/:name": "stream",
|
||||||
"tag_followings": "stream",
|
"followed_tags": "stream",
|
||||||
"tags/:name": "stream",
|
"tags/:name": "stream",
|
||||||
"posts/:id": "stream"
|
"posts/:id": "stream"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ describe AdminsController do
|
||||||
context 'admin not signed in' do
|
context 'admin not signed in' do
|
||||||
it 'is behind redirect_unless_admin' do
|
it 'is behind redirect_unless_admin' do
|
||||||
get :user_search
|
get :user_search
|
||||||
response.should redirect_to multi_path
|
response.should redirect_to multi_stream_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ describe AdminsController do
|
||||||
context 'admin not signed in' do
|
context 'admin not signed in' do
|
||||||
it 'is behind redirect_unless_admin' do
|
it 'is behind redirect_unless_admin' do
|
||||||
get :admin_inviter
|
get :admin_inviter
|
||||||
response.should redirect_to multi_path
|
response.should redirect_to multi_stream_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,52 +35,6 @@ describe AspectsController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#index" do
|
|
||||||
it 'assigns an Stream::Aspect' do
|
|
||||||
get :index
|
|
||||||
assigns(:stream).class.should == Stream::Aspect
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'filtering by aspect' do
|
|
||||||
before do
|
|
||||||
@aspect1 = alice.aspects.create(:name => "test aspect")
|
|
||||||
@stream = Stream::Aspect.new(alice, [])
|
|
||||||
@stream.stub(:posts).and_return([])
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'respects a single aspect' do
|
|
||||||
Stream::Aspect.should_receive(:new).with(alice, [@aspect1.id], anything).and_return(@stream)
|
|
||||||
get :index, :a_ids => [@aspect1.id]
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'respects multiple aspects' do
|
|
||||||
aspect2 = alice.aspects.create(:name => "test aspect two")
|
|
||||||
Stream::Aspect.should_receive(:new).with(alice, [@aspect1.id, aspect2.id], anything).and_return(@stream)
|
|
||||||
get :index, :a_ids => [@aspect1.id, aspect2.id]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'performance', :performance => true do
|
|
||||||
before do
|
|
||||||
require 'benchmark'
|
|
||||||
8.times do |n|
|
|
||||||
user = Factory.create(:user)
|
|
||||||
aspect = user.aspects.create(:name => 'people')
|
|
||||||
connect_users(alice, @alices_aspect_1, user, aspect)
|
|
||||||
post = alice.post(:status_message, :text => "hello#{n}", :to => @alices_aspect_2.id)
|
|
||||||
8.times do |n|
|
|
||||||
user.comment "yo#{post.text}", :post => post
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
it 'takes time' do
|
|
||||||
Benchmark.realtime {
|
|
||||||
get :index
|
|
||||||
}.should < 1.5
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#show" do
|
describe "#show" do
|
||||||
it "succeeds" do
|
it "succeeds" do
|
||||||
get :show, 'id' => @alices_aspect_1.id.to_s
|
get :show, 'id' => @alices_aspect_1.id.to_s
|
||||||
|
|
@ -124,6 +78,7 @@ describe AspectsController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with invalid params" do
|
context "with invalid params" do
|
||||||
it "does not create an aspect" do
|
it "does not create an aspect" do
|
||||||
alice.aspects.count.should == 2
|
alice.aspects.count.should == 2
|
||||||
|
|
@ -232,25 +187,4 @@ describe AspectsController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "mobile site" do
|
|
||||||
before do
|
|
||||||
ap = alice.person
|
|
||||||
posts = []
|
|
||||||
posts << alice.post(:reshare, :root_guid => Factory(:status_message, :public => true).guid, :to => 'all')
|
|
||||||
posts << alice.post(:status_message, :text => 'foo', :to => alice.aspects)
|
|
||||||
photo = Factory(:activity_streams_photo, :public => true, :author => ap)
|
|
||||||
posts << photo
|
|
||||||
posts.each do |p|
|
|
||||||
alice.build_like(:positive => true, :target => p).save
|
|
||||||
end
|
|
||||||
alice.add_to_streams(photo, alice.aspects)
|
|
||||||
sign_in alice
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should not 500' do
|
|
||||||
get :index, :format => :mobile
|
|
||||||
response.should be_success
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ describe HomeController do
|
||||||
it 'redirects to multis index if user is logged in' do
|
it 'redirects to multis index if user is logged in' do
|
||||||
sign_in alice
|
sign_in alice
|
||||||
get :show, :home => true
|
get :show, :home => true
|
||||||
response.should redirect_to(multi_path)
|
response.should redirect_to(multi_stream_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe AspectsController do
|
describe PostsController do
|
||||||
describe '#index' do
|
describe '#aspects' do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in :user, alice
|
||||||
@alices_aspect_2 = alice.aspects.create(:name => "another aspect")
|
@alices_aspect_2 = alice.aspects.create(:name => "another aspect")
|
||||||
|
|
@ -19,19 +19,19 @@ describe AspectsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "generates a jasmine fixture", :fixture => true do
|
it "generates a jasmine fixture", :fixture => true do
|
||||||
get :index
|
get :aspects
|
||||||
save_fixture(html_for("body"), "aspects_index")
|
save_fixture(html_for("body"), "aspects_index")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "generates a jasmine fixture with a prefill", :fixture => true do
|
it "generates a jasmine fixture with a prefill", :fixture => true do
|
||||||
get :index, :prefill => "reshare things"
|
get :aspects, :prefill => "reshare things"
|
||||||
save_fixture(html_for("body"), "aspects_index_prefill")
|
save_fixture(html_for("body"), "aspects_index_prefill")
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'generates a jasmine fixture with services', :fixture => true do
|
it 'generates a jasmine fixture with services', :fixture => true do
|
||||||
alice.services << Services::Facebook.create(:user_id => alice.id)
|
alice.services << Services::Facebook.create(:user_id => alice.id)
|
||||||
alice.services << Services::Twitter.create(:user_id => alice.id)
|
alice.services << Services::Twitter.create(:user_id => alice.id)
|
||||||
get :index, :prefill => "reshare things"
|
get :aspects, :prefill => "reshare things"
|
||||||
save_fixture(html_for("body"), "aspects_index_services")
|
save_fixture(html_for("body"), "aspects_index_services")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -39,14 +39,14 @@ describe AspectsController do
|
||||||
bob.post(:status_message, :text => "Is anyone out there?", :to => @bob.aspects.where(:name => "generic").first.id)
|
bob.post(:status_message, :text => "Is anyone out there?", :to => @bob.aspects.where(:name => "generic").first.id)
|
||||||
message = alice.post(:status_message, :text => "hello "*800, :to => @alices_aspect_2.id)
|
message = alice.post(:status_message, :text => "hello "*800, :to => @alices_aspect_2.id)
|
||||||
5.times { bob.comment("what", :post => message) }
|
5.times { bob.comment("what", :post => message) }
|
||||||
get :index
|
get :aspects
|
||||||
save_fixture(html_for("body"), "aspects_index_with_posts")
|
save_fixture(html_for("body"), "aspects_index_with_posts")
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'generates a jasmine fixture with only posts', :fixture => true do
|
it 'generates a jasmine fixture with only posts', :fixture => true do
|
||||||
2.times { bob.post(:status_message, :text => "Is anyone out there?", :to => @bob.aspects.where(:name => "generic").first.id) }
|
2.times { bob.post(:status_message, :text => "Is anyone out there?", :to => @bob.aspects.where(:name => "generic").first.id) }
|
||||||
|
|
||||||
get :index, :only_posts => true
|
get :aspects, :only_posts => true
|
||||||
|
|
||||||
save_fixture(response.body, "aspects_index_only_posts")
|
save_fixture(response.body, "aspects_index_only_posts")
|
||||||
end
|
end
|
||||||
|
|
@ -54,14 +54,14 @@ describe AspectsController do
|
||||||
it "generates a jasmine fixture with a post with comments", :fixture => true do
|
it "generates a jasmine fixture with a post with comments", :fixture => true do
|
||||||
message = bob.post(:status_message, :text => "HALO WHIRLED", :to => @bob.aspects.where(:name => "generic").first.id)
|
message = bob.post(:status_message, :text => "HALO WHIRLED", :to => @bob.aspects.where(:name => "generic").first.id)
|
||||||
5.times { bob.comment("what", :post => message) }
|
5.times { bob.comment("what", :post => message) }
|
||||||
get :index
|
get :aspects
|
||||||
save_fixture(html_for("body"), "aspects_index_post_with_comments")
|
save_fixture(html_for("body"), "aspects_index_post_with_comments")
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'generates a jasmine fixture with a followed tag', :fixture => true do
|
it 'generates a jasmine fixture with a followed tag', :fixture => true do
|
||||||
@tag = ActsAsTaggableOn::Tag.create!(:name => "partytimeexcellent")
|
@tag = ActsAsTaggableOn::Tag.create!(:name => "partytimeexcellent")
|
||||||
TagFollowing.create!(:tag => @tag, :user => alice)
|
TagFollowing.create!(:tag => @tag, :user => alice)
|
||||||
get :index
|
get :aspects
|
||||||
save_fixture(html_for("body"), "aspects_index_with_one_followed_tag")
|
save_fixture(html_for("body"), "aspects_index_with_one_followed_tag")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -89,7 +89,7 @@ describe AspectsController do
|
||||||
)
|
)
|
||||||
|
|
||||||
alice.post(:status_message, :text => "http://www.youtube.com/watch?v=UYrkQL1bX4A", :to => @alices_aspect_2.id)
|
alice.post(:status_message, :text => "http://www.youtube.com/watch?v=UYrkQL1bX4A", :to => @alices_aspect_2.id)
|
||||||
get :index
|
get :aspects
|
||||||
save_fixture(html_for("body"), "aspects_index_with_video_post")
|
save_fixture(html_for("body"), "aspects_index_with_video_post")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -98,7 +98,7 @@ describe AspectsController do
|
||||||
alice.build_like(:positive => true, :target => message).save
|
alice.build_like(:positive => true, :target => message).save
|
||||||
bob.build_like(:positive => true, :target => message).save
|
bob.build_like(:positive => true, :target => message).save
|
||||||
|
|
||||||
get :index
|
get :aspects
|
||||||
save_fixture(html_for("body"), "aspects_index_with_a_post_with_likes")
|
save_fixture(html_for("body"), "aspects_index_with_a_post_with_likes")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe MultisController do
|
describe PostsController do
|
||||||
describe '#index' do
|
describe '#multi' do
|
||||||
before do
|
before do
|
||||||
sign_in :user, alice
|
sign_in :user, alice
|
||||||
end
|
end
|
||||||
|
|
@ -27,7 +27,7 @@ describe MultisController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
get :index, :format => :json
|
get :multi, :format => :json
|
||||||
response.should be_success
|
response.should be_success
|
||||||
save_fixture(response.body, "multi_stream_json")
|
save_fixture(response.body, "multi_stream_json")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
# 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 LikeStreamController do
|
|
||||||
before do
|
|
||||||
sign_in :user, alice
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'index' do
|
|
||||||
it 'succeeds' do
|
|
||||||
get :index
|
|
||||||
response.should be_success
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'assigns a stream' do
|
|
||||||
get :index
|
|
||||||
assigns[:stream].should be_a Stream::Likes
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -138,22 +138,70 @@ describe PostsController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#index' do
|
context 'streams' do
|
||||||
before do
|
before do
|
||||||
sign_in alice
|
sign_in alice
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'will succeed if admin' do
|
describe "#public" do
|
||||||
AppConfig[:admins] = [alice.username]
|
it 'will succeed if admin' do
|
||||||
get :index
|
AppConfig[:admins] = [alice.username]
|
||||||
response.should be_success
|
get :public
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'will redirect if not' do
|
||||||
|
AppConfig[:admins] = []
|
||||||
|
get :public
|
||||||
|
response.should be_redirect
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'will redirect if not' do
|
describe '#multi' do
|
||||||
AppConfig[:admins] = []
|
before do
|
||||||
get :index
|
@old_spotlight_value = AppConfig[:community_spotlight]
|
||||||
response.should be_redirect
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
AppConfig[:community_spotlight] = @old_spotlight_value
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'succeeds' do
|
||||||
|
AppConfig[:community_spotlight] = [bob.person.diaspora_handle]
|
||||||
|
get :multi
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'succeeds without AppConfig[:community_spotlight]' do
|
||||||
|
AppConfig[:community_spotlight] = nil
|
||||||
|
get :multi
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'succeeds on mobile' do
|
||||||
|
get :multi, :format => :mobile
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
streams = [
|
||||||
|
{:path => :liked, :type => Stream::Likes},
|
||||||
|
{:path => :mentioned, :type => Stream::Mention},
|
||||||
|
{:path => :followed_tags, :type => Stream::FollowedTag}
|
||||||
|
]
|
||||||
|
|
||||||
|
streams.each do |s|
|
||||||
|
describe "##{s[:path]}" do
|
||||||
|
it 'succeeds' do
|
||||||
|
get s[:path]
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'assigns a stream' do
|
||||||
|
get s[:path]
|
||||||
|
assigns[:stream].should be_a s[:type]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ describe RegistrationsController do
|
||||||
it "redirects to the home path" do
|
it "redirects to the home path" do
|
||||||
get :create, @valid_params
|
get :create, @valid_params
|
||||||
response.should be_redirect
|
response.should be_redirect
|
||||||
response.location.should match /^#{multi_url}\??$/
|
response.location.should match /^#{multi_stream_url}\??$/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,14 @@ describe SessionsController do
|
||||||
it "redirects to /stream for a non-mobile user" do
|
it "redirects to /stream for a non-mobile user" do
|
||||||
post :create, {"user" => {"remember_me" => "0", "username" => @user.username, "password" => "evankorth"}}
|
post :create, {"user" => {"remember_me" => "0", "username" => @user.username, "password" => "evankorth"}}
|
||||||
response.should be_redirect
|
response.should be_redirect
|
||||||
response.location.should match /^#{multi_url}\??$/
|
response.location.should match /^#{multi_stream_url}\??$/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "redirects to /stream for a mobile user" do
|
it "redirects to /stream for a mobile user" do
|
||||||
@request.env['HTTP_USER_AGENT'] = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7'
|
@request.env['HTTP_USER_AGENT'] = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7'
|
||||||
post :create, {"user" => {"remember_me" => "0", "username" => @user.username, "password" => "evankorth"}}
|
post :create, {"user" => {"remember_me" => "0", "username" => @user.username, "password" => "evankorth"}}
|
||||||
response.should be_redirect
|
response.should be_redirect
|
||||||
response.location.should match /^#{multi_url}\??$/
|
response.location.should match /^#{multi_stream_url}\??$/
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'queues up an update job' do
|
it 'queues up an update job' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue