Merge pull request #6698 from svbergerem/remove-unused-code
Remove unused code
This commit is contained in:
commit
dfc649e772
15 changed files with 1 additions and 213 deletions
|
|
@ -1,10 +0,0 @@
|
||||||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
|
||||||
|
|
||||||
app.views.PhotoViewer = app.views.Base.extend({
|
|
||||||
templateName : "photo-viewer",
|
|
||||||
|
|
||||||
presenter : function(){
|
|
||||||
return { photos : this.model.get("photos") }; //json array of attributes, not backbone models, yet.
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// @license-end
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<a href="{{object_url}}" class="stream-photo-link">
|
|
||||||
<img src="{{image_url}}" data-small-photo="{{image_url}}" data-full-photo="{{image_url}}" class="stream-photo" />
|
|
||||||
</a>
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<div class="photo-set">
|
|
||||||
{{#each photos}}
|
|
||||||
<div class="img-bounding-box">
|
|
||||||
<img src="{{sizes.large}}"/>
|
|
||||||
</div>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
{{#people}}
|
|
||||||
{{#linkToAuthor this}}
|
|
||||||
{{{personImage this "small"}}}
|
|
||||||
{{/linkToAuthor}}
|
|
||||||
{{/people}}
|
|
||||||
|
|
@ -6,9 +6,8 @@ class PeopleController < ApplicationController
|
||||||
before_action :authenticate_user!, except: %i(show stream hovercard)
|
before_action :authenticate_user!, except: %i(show stream hovercard)
|
||||||
before_action :find_person, only: %i(show stream hovercard)
|
before_action :find_person, only: %i(show stream hovercard)
|
||||||
|
|
||||||
respond_to :html, :except => [:tag_index]
|
respond_to :html
|
||||||
respond_to :json, :only => [:index, :show]
|
respond_to :json, :only => [:index, :show]
|
||||||
respond_to :js, :only => [:tag_index]
|
|
||||||
|
|
||||||
rescue_from ActiveRecord::RecordNotFound do
|
rescue_from ActiveRecord::RecordNotFound do
|
||||||
render :file => Rails.root.join('public', '404').to_s,
|
render :file => Rails.root.join('public', '404').to_s,
|
||||||
|
|
@ -64,13 +63,6 @@ class PeopleController < ApplicationController
|
||||||
render :json => { :search_count => @people.count, :search_html => @answer_html }.to_json
|
render :json => { :search_count => @people.count, :search_html => @answer_html }.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def tag_index
|
|
||||||
profiles = Profile.tagged_with(params[:name]).where(:searchable => true).select('profiles.id, profiles.person_id')
|
|
||||||
@people = Person.where(:id => profiles.map{|p| p.person_id}).paginate(:page => params[:page], :per_page => 15)
|
|
||||||
respond_with @people
|
|
||||||
end
|
|
||||||
|
|
||||||
# renders the persons user profile page
|
# renders the persons user profile page
|
||||||
def show
|
def show
|
||||||
mark_corresponding_notifications_read if user_signed_in?
|
mark_corresponding_notifications_read if user_signed_in?
|
||||||
|
|
|
||||||
|
|
@ -109,34 +109,6 @@ class PhotosController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
|
||||||
if @photo = current_user.photos.where(:id => params[:id]).first
|
|
||||||
respond_with @photo
|
|
||||||
else
|
|
||||||
redirect_to person_photos_path(current_user.person)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
photo = current_user.photos.where(:id => params[:id]).first
|
|
||||||
if photo
|
|
||||||
if current_user.update_post( photo, photo_params )
|
|
||||||
flash.now[:notice] = I18n.t 'photos.update.notice'
|
|
||||||
respond_to do |format|
|
|
||||||
format.js{ render :json => photo, :status => 200 }
|
|
||||||
end
|
|
||||||
else
|
|
||||||
flash.now[:error] = I18n.t 'photos.update.error'
|
|
||||||
respond_to do |format|
|
|
||||||
format.html{ redirect_to [:edit, photo] }
|
|
||||||
format.js{ render :status => 403 }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
redirect_to person_photos_path(current_user.person)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def photo_params
|
def photo_params
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
= stream.title
|
= stream.title
|
||||||
|
|
||||||
= render 'publisher/publisher', publisher_aspects_for(stream)
|
= render 'publisher/publisher', publisher_aspects_for(stream)
|
||||||
= render 'aspects/no_posts_message'
|
|
||||||
|
|
||||||
#gs-shim{:title => popover_with_close_html("3. #{t('.stay_updated')}"), 'data-content' => t('.stay_updated_explanation')}
|
#gs-shim{:title => popover_with_close_html("3. #{t('.stay_updated')}"), 'data-content' => t('.stay_updated_explanation')}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +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.
|
|
||||||
|
|
||||||
#no_posts.hidden.empty_message
|
|
||||||
= t('.start_talking')
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
$("#people_stream").html("<%= escape_javascript(render("index", :people => @people)) %>");
|
|
||||||
|
|
@ -1,15 +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.
|
|
||||||
|
|
||||||
%h2= "#{t('.editing')} #{@photo.processed_image}"
|
|
||||||
|
|
||||||
%div{id: @photo.id}
|
|
||||||
#show_photo
|
|
||||||
= image_tag @photo.url(:scaled_full)
|
|
||||||
|
|
||||||
= form_for @photo do |photo|
|
|
||||||
= photo.label :text
|
|
||||||
= photo.text_field :text, value: @photo.text
|
|
||||||
= photo.submit
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
var tagName = "<%= escape_javascript(@tag.name) %>"
|
|
||||||
$("#followed_tags_listing").find("#tag-following-"+tagName).slideUp(100);
|
|
||||||
app.flashMessages.success(Diaspora.I18n.t("tags.wasnt_that_interesting", {tagName: tagName}));
|
|
||||||
|
|
@ -1,52 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
$(document).bind("mobileinit", function() {
|
|
||||||
$.extend($.mobile, {
|
|
||||||
ajaxLinksEnabled: false,
|
|
||||||
ajaxEnabled: false,
|
|
||||||
ajaxFormsEnabled: false
|
|
||||||
|
|
||||||
});
|
|
||||||
$.mobile.selectmenu.prototype.options.nativeMenu = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
|
||||||
$(".like_action.inactive").bind('tap', function(evt){
|
|
||||||
evt.preventDefault();
|
|
||||||
var target = $(this),
|
|
||||||
postId = target.data('post-id');
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '/posts/'+postId+'/likes.json',
|
|
||||||
type: 'POST',
|
|
||||||
complete: function(data){
|
|
||||||
target.addClass('inactive')
|
|
||||||
.removeClass('active')
|
|
||||||
.data('post-id', postId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".like_action.active").bind('tap', function(evt){
|
|
||||||
evt.preventDefault();
|
|
||||||
var target = $(this),
|
|
||||||
postId = $(this).data('post-id'),
|
|
||||||
likeId = $(this).data('like-id');
|
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '/posts/'+postId+'/likes/'+likeId+'.json',
|
|
||||||
type: 'DELETE',
|
|
||||||
complete: function(data){
|
|
||||||
target.addClass('inactive')
|
|
||||||
.removeClass('active')
|
|
||||||
.data('like-id', '');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -116,21 +116,6 @@ describe PeopleController, :type => :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#tag_index' do
|
|
||||||
it 'works for js' do
|
|
||||||
xhr :get, :tag_index, :name => 'jellybeans', :format => :js
|
|
||||||
expect(response).to be_success
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'returns awesome people who have that tag' do
|
|
||||||
f = FactoryGirl.create(:person)
|
|
||||||
f.profile.tag_string = "#seeded"
|
|
||||||
f.profile.save
|
|
||||||
xhr :get, :tag_index, :name => 'seeded', :format => :js
|
|
||||||
expect(assigns[:people].count).to eq(1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#show performance", :performance => true do
|
describe "#show performance", :performance => true do
|
||||||
before do
|
before do
|
||||||
require 'benchmark'
|
require 'benchmark'
|
||||||
|
|
|
||||||
|
|
@ -175,18 +175,6 @@ describe PhotosController, :type => :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#edit' do
|
|
||||||
it "succeeds when user owns the photo" do
|
|
||||||
get :edit, :id => @alices_photo.id
|
|
||||||
expect(response).to be_success
|
|
||||||
end
|
|
||||||
|
|
||||||
it "redirects when the user does not own the photo" do
|
|
||||||
get :edit, :id => @bobs_photo.id
|
|
||||||
expect(response).to redirect_to(:action => :index, :person_id => alice.person.guid.to_s)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '#destroy' do
|
describe '#destroy' do
|
||||||
it 'let a user delete his message' do
|
it 'let a user delete his message' do
|
||||||
delete :destroy, :id => @alices_photo.id
|
delete :destroy, :id => @alices_photo.id
|
||||||
|
|
@ -217,33 +205,6 @@ describe PhotosController, :type => :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#update" do
|
|
||||||
it "updates the caption of a photo" do
|
|
||||||
put :update, :id => @alices_photo.id, :photo => { :text => "now with lasers!" }, :format => :js
|
|
||||||
expect(@alices_photo.reload.text).to eq("now with lasers!")
|
|
||||||
end
|
|
||||||
|
|
||||||
it "doesn't allow mass assignment of person" do
|
|
||||||
new_user = FactoryGirl.create(:user)
|
|
||||||
params = { :text => "now with lasers!", :author => new_user }
|
|
||||||
put :update, :id => @alices_photo.id, :photo => params, :format => :js
|
|
||||||
expect(@alices_photo.reload.author).to eq(alice.person)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "doesn't allow mass assignment of person_id" do
|
|
||||||
new_user = FactoryGirl.create(:user)
|
|
||||||
params = { :text => "now with lasers!", :author_id => new_user.id }
|
|
||||||
put :update, :id => @alices_photo.id, :photo => params, :format => :js
|
|
||||||
expect(@alices_photo.reload.author_id).to eq(alice.person.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'redirects if you do not have access to the post' do
|
|
||||||
params = { :text => "now with lasers!" }
|
|
||||||
put :update, :id => @bobs_photo.id, :photo => params
|
|
||||||
expect(response).to redirect_to(:action => :index, :person_id => alice.person.guid.to_s)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#make_profile_photo" do
|
describe "#make_profile_photo" do
|
||||||
it 'should return a 201 on a js success' do
|
it 'should return a 201 on a js success' do
|
||||||
xhr :get, :make_profile_photo, :photo_id => @alices_photo.id, :format => 'js'
|
xhr :get, :make_profile_photo, :photo_id => @alices_photo.id, :format => 'js'
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
describe("app.views.PhotoViewer", function(){
|
|
||||||
beforeEach(function(){
|
|
||||||
this.model = factory.post({
|
|
||||||
photos : [
|
|
||||||
factory.photoAttrs({sizes : {large : "http://tieguy.org/me.jpg"}}),
|
|
||||||
factory.photoAttrs({sizes : {large : "http://whatthefuckiselizabethstarkupto.com/none_knows.gif"}}) //SIC
|
|
||||||
]
|
|
||||||
});
|
|
||||||
this.view = new app.views.PhotoViewer({model : this.model});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("rendering", function(){
|
|
||||||
it("should have an image for each photoAttr on the model", function(){
|
|
||||||
this.view.render();
|
|
||||||
expect(this.view.$("img").length).toBe(2);
|
|
||||||
expect(this.view.$("img[src='http://tieguy.org/me.jpg']")).toExist();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Loading…
Reference in a new issue