Merge pull request #3754 from marpo60/housekeeping

Housekeeping2
This commit is contained in:
Jonne Haß 2012-11-22 01:06:30 -08:00
commit c59bb35087
23 changed files with 3 additions and 174 deletions

View file

@ -44,14 +44,6 @@ module ApplicationHelper
without_close_html + link_to(image_tag('deletelabel.png'), "#", :class => 'close')
end
def diaspora_id_host
User.diaspora_id_host
end
def modernizer_responsive_tag
javascript_tag("Modernizr.mq('(min-width:0)') || document.write(unescape('#{j javascript_include_tag("mbp-respond.min")}'));")
end
# Require jQuery from CDN if possible, falling back to vendored copy, and require
# vendored jquery_ujs
def jquery_include_tag

View file

@ -3,39 +3,6 @@
# the COPYRIGHT file.
module AspectGlobalHelper
def aspects_with_post(aspects, post)
aspects.select do |aspect|
AspectVisibility.exists?(:aspect_id => aspect.id, :shareable_id => post.id, :shareable_type => 'Post')
end
end
def aspect_links(aspects, opts={})
str = ""
aspects.each do |aspect|
str << '<li>'
str << link_for_aspect(aspect, :params => opts, 'data-guid' => aspect.id).html_safe
str << '</li>'
end
str.html_safe
end
def link_for_aspect(aspect, opts={})
opts[:params] ||= {}
params ||= {}
opts[:params] = opts[:params].merge("a_ids[]" => aspect.id, :created_at => params[:created_at])
opts['data-guid'] = aspect.id
link_to aspect.name, aspects_path( opts[:params] ), opts
end
def aspect_or_all_path(aspect)
if @aspect.is_a? Aspect
aspect_path @aspect
else
aspects_path
end
end
def aspect_membership_dropdown(contact, person, hang, aspect=nil)
selected_aspects = all_aspects.select{|aspect| contact.in_aspect?(aspect)}

View file

@ -3,14 +3,6 @@
# the COPYRIGHT file.
module AspectsHelper
def remove_link(aspect)
if aspect.contacts.size == 0
link_to I18n.t('aspects.helper.remove'), aspect, :method => :delete, :confirm => I18n.t('aspects.helper.are_you_sure')
else
"<span class='grey' title=#{I18n.t('aspects.helper.aspect_not_empty')}>#{I18n.t('aspects.helper.remove')}</span>"
end
end
def add_to_aspect_button(aspect_id, person_id)
link_to image_tag('icons/monotone_plus_add_round.png'),
{:controller => 'aspect_memberships',

View file

@ -39,14 +39,6 @@ module InterimStreamHackinessHelper
end
end
def what_stream_sentence(post)
from_group(post).map{|x| I18n.t("streams.#{x.to_s}")}.to_sentence
end
def stream_settings_link(post)
link_to "", "#{edit_user_path}#stream-preferences"
end
def publisher_open
if defined?(@stream)
@stream.publisher.open?

View file

@ -1,15 +1,4 @@
module InvitationCodesHelper
def invite_welcome_message
if invite.present?
content_tag(:div, :class => 'media well') do
person_image_link(invite.user.person, :class => 'img') +
content_tag(:div, :class => 'bd') do
I18n.translate('invitation_codes.excited', :name => invite.user_name)
end
end
end
end
def invite_hidden_tag(invite)
if invite.present?
hidden_field_tag 'invite[token]', invite.token

View file

@ -54,10 +54,6 @@ module NotificationsHelper
object_link(note, notification_people_link(note))
end
def peoples_names(note)
note.actors.map{|p| p.name}.join(", ")
end
def the_day(i18n)
i18n[0].match(/\d/) ? i18n[0].gsub('.', '') : i18n[1].gsub('.', '')
end

View file

@ -23,12 +23,4 @@ module NotifierHelper
text = process_newlines(text) if opts[:process_newlines]
text
end
def invite_email_title
if @inviter.present?
I18n.t 'notifier.invited_you', :name => @inviter.person.name
else
I18n.t 'notifier.accept_invite'
end
end
end

View file

@ -3,18 +3,10 @@
# the COPYRIGHT file.
module PublisherHelper
def public_value
params[:controller] == "tags" || params[:controller] == "posts"
end
def remote?
params[:controller] != "tags"
end
def public_helper_text
(public_value)? t('javascripts.publisher.public'): t('javascripts.publisher.limited')
end
def all_aspects_selected?(selected_aspects)
@all_aspects_selected ||= all_aspects.size == selected_aspects.size
end

View file

@ -6,8 +6,4 @@ module UsersHelper
def owner_image_link
person_image_link(current_user.person, :size => :thumb_small)
end
def mine?(post)
current_user.owns? post
end
end

View file

@ -167,12 +167,6 @@ class Person < ActiveRecord::Base
}.call
end
def self.public_search(query, opts={})
return [] if query.to_s.blank? || query.to_s.length < 3
sql, tokens = self.search_query_string(query)
Person.searchable.where(sql, *tokens)
end
def name(opts = {})
if self.profile.nil?
fix_profile

View file

@ -128,10 +128,6 @@ class Photo < ActiveRecord::Base
}
end
def thumb_hash
{:thumb_url => url(:thumb_medium), :id => id, :album_id => nil}
end
def queue_processing_job
Resque.enqueue(Jobs::ProcessPhoto, self.id)
end

View file

@ -103,11 +103,6 @@ class Post < ActiveRecord::Base
reshares.where(:author_id => user.person.id).first
end
def participation_for(user)
return unless user
participations.where(:author_id => user.person.id).first
end
def like_for(user)
return unless user
likes.where(:author_id => user.person.id).first
@ -133,10 +128,6 @@ class Post < ActiveRecord::Base
false
end
def triggers_caching?
true
end
def comment_email_subject
I18n.t('notifier.a_post_you_shared')
end

View file

@ -165,17 +165,6 @@ class User < ActiveRecord::Base
self.hidden_shareables[share_type].present?
end
def self.create_from_invitation!(invitation)
user = User.new
user.generate_keys
user.send(:generate_invitation_token)
user.email = invitation.identifier if invitation.service == 'email'
# we need to make a custom validator here to make this safer
user.save(:validate => false)
user
end
def send_reset_password_instructions
generate_reset_password_token! if should_generate_reset_token?
Resque.enqueue(Jobs::ResetPassword, self.id)

View file

@ -50,11 +50,6 @@ class Stream::Base
includes(:profile)
end
# @return [String]
def contacts_link_title
I18n.translate('aspects.selected_contacts.view_all_contacts')
end
# @return [String] def contacts_title 'change me in lib/base_stream.rb!'
def contacts_title
'change me in lib/base_stream.rb!'

View file

@ -52,15 +52,10 @@ describe RegistrationsController do
end
end
describe "#create" do
context "with valid parameters" do
before do
AppConfig.settings.enable_registrations = true
end
before do
user = FactoryGirl.build(:user)
User.stub!(:build).and_return(user)
end

View file

@ -17,8 +17,6 @@ describe ServicesController do
before do
@user = alice
@aspect = @user.aspects.first
sign_in :user, @user
@controller.stub!(:current_user).and_return(@user)
mock_access_token.stub!(:token => "12345", :secret => "56789")
@ -106,5 +104,4 @@ describe ServicesController do
}.should change(@user.services, :count).by(-1)
end
end
end

View file

@ -7,7 +7,6 @@ require 'spec_helper'
describe StatusMessagesController do
before do
@aspect1 = alice.aspects.first
@aspect2 = bob.aspects.first
request.env["HTTP_REFERER"] = ""
sign_in :user, alice
@ -55,8 +54,7 @@ describe StatusMessagesController do
describe '#new' do
it 'succeeds' do
get :new,
:person_id => bob.person.id
get :new, :person_id => bob.person.id
response.should be_success
end

View file

@ -7,8 +7,6 @@ require 'spec_helper'
describe UsersController do
before do
@user = alice
@aspect = @user.aspects.first
@aspect1 = @user.aspects.create(:name => "super!!")
sign_in :user, @user
@controller.stub(:current_user).and_return(@user)
end
@ -60,6 +58,7 @@ describe UsersController do
get :public, :username => @user.username
response.should be_redirect
end
it 'redirects to a profile page if mobile is requested' do
get :public, :username => @user.username, :format => :mobile
response.should be_redirect
@ -210,7 +209,6 @@ describe UsersController do
Resque.should_receive(:enqueue).with(Jobs::DeleteAccount, anything)
delete :destroy, :user => { :current_password => "bluepin7" }
end
end
describe '#confirm_email' do
@ -252,4 +250,3 @@ describe UsersController do
end
end
end

View file

@ -5,18 +5,7 @@
require 'spec_helper'
describe LayoutHelper do
include ApplicationHelper
before do
@user = alice
end
describe "#page_title" do
before do
def current_user
@current_user
end
end
context "passed blank text" do
it "returns Diaspora*" do
page_title.should == pod_name

View file

@ -1,12 +1,7 @@
require 'spec_helper'
describe Reshare do
include ActionView::Helpers::UrlHelper
include Rails.application.routes.url_helpers
def controller
mock()
end
it 'has a valid Factory' do
FactoryGirl.build(:reshare).should be_valid

View file

@ -5,12 +5,7 @@
require 'spec_helper'
describe StatusMessage do
include ActionView::Helpers::UrlHelper
include PeopleHelper
include Rails.application.routes.url_helpers
def controller
mock()
end
before do
@user = alice

View file

@ -8,9 +8,6 @@ require 'spec_helper'
describe Diaspora::Taggable do
shared_examples_for "it is taggable" do
include ActionView::Helpers::UrlHelper
include Rails.application.routes.url_helpers
def controller
end
def tag_link(s)
link_to "##{s}", "/tags/#{s}", :class => 'tag'

View file

@ -31,11 +31,4 @@ class User
p
end
end
def post_at_time(time)
to_aspect = self.aspects.length == 1 ? self.aspects.first : self.aspects.where(:name => "generic")
p = self.post(:status_message, :text => 'hi', :to => to_aspect)
p.created_at = time
p.save!
end
end