remove dislikes; didn't change the db structure, just removed the traces in the code since we're not using them
This commit is contained in:
parent
04e53fa1fc
commit
829c86823d
8 changed files with 10 additions and 19 deletions
|
|
@ -38,7 +38,7 @@ class AspectsController < ApplicationController
|
||||||
:type => ['StatusMessage','ActivityStreams::Photo'],
|
:type => ['StatusMessage','ActivityStreams::Photo'],
|
||||||
:order => session[:sort_order] + ' DESC',
|
:order => session[:sort_order] + ' DESC',
|
||||||
:max_time => params[:max_time].to_i
|
:max_time => params[:max_time].to_i
|
||||||
).includes(:comments, :mentions, :likes, :dislikes)
|
).includes(:comments, :mentions, :likes)
|
||||||
|
|
||||||
@posts = PostsFake.new(posts)
|
@posts = PostsFake.new(posts)
|
||||||
if params[:only_posts]
|
if params[:only_posts]
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ module SocketsHelper
|
||||||
v = render_to_string(:partial => 'comments/comment', :locals => {:post => object.post, :comment => object, :person => object.author, :current_user => user})
|
v = render_to_string(:partial => 'comments/comment', :locals => {:post => object.post, :comment => object, :person => object.author, :current_user => user})
|
||||||
|
|
||||||
elsif object.is_a? Like
|
elsif object.is_a? Like
|
||||||
v = render_to_string(:partial => 'likes/likes', :locals => {:likes => object.post.likes, :dislikes => object.post.dislikes})
|
v = render_to_string(:partial => 'likes/likes', :locals => {:likes => object.post.likes})
|
||||||
|
|
||||||
elsif object.is_a? Notification
|
elsif object.is_a? Notification
|
||||||
v = render_to_string(:partial => 'notifications/popup', :locals => {:note => object, :person => opts[:actor]})
|
v = render_to_string(:partial => 'notifications/popup', :locals => {:note => object, :person => opts[:actor]})
|
||||||
|
|
|
||||||
|
|
@ -193,10 +193,8 @@ class User < ActiveRecord::Base
|
||||||
# @param [Post] post
|
# @param [Post] post
|
||||||
# @return [Like]
|
# @return [Like]
|
||||||
def like_for(post)
|
def like_for(post)
|
||||||
[post.likes, post.dislikes].each do |likes|
|
post.likes.each do |like|
|
||||||
likes.each do |like|
|
return like if like.author_id == self.person.id
|
||||||
return like if like.author_id == self.person.id
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
$(".like_action", ".stream_element[data-guid=<%=@like.post_id%>]").html("<%= escape_javascript(like_action(@like.post))%>");
|
$(".like_action", ".stream_element[data-guid=<%=@like.post_id%>]").html("<%= escape_javascript(like_action(@like.post))%>");
|
||||||
|
|
||||||
WebSocketReceiver.processLike("<%=@like.post_id%>", "<%= escape_javascript(render("likes/likes", :post_id => @like.post_id, :likes => @like.post.likes, :dislikes => @like.post.dislikes)) %>");
|
WebSocketReceiver.processLike("<%=@like.post_id%>", "<%= escape_javascript(render("likes/likes", :post_id => @like.post_id, :likes => @like.post.likes)) %>");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
$(".like_action", ".stream_element[data-guid=<%=@like.post_id%>]").html("<%= escape_javascript(like_action(@like.post))%>");
|
$(".like_action", ".stream_element[data-guid=<%=@like.post_id%>]").html("<%= escape_javascript(like_action(@like.post))%>");
|
||||||
WebSocketReceiver.processLike("<%=@like.post_id%>", "<%= escape_javascript(render("likes/likes", :post_id => @like.post_id, :likes => @like.post.likes, :dislikes => @like.post.dislikes)) %>");
|
WebSocketReceiver.processLike("<%=@like.post_id%>", "<%= escape_javascript(render("likes/likes", :post_id => @like.post_id, :likes => @like.post.likes)) %>");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,14 +63,7 @@
|
||||||
|
|
||||||
.span-16.prepend-4.append-4.last
|
.span-16.prepend-4.append-4.last
|
||||||
#photo_stream.stream.show
|
#photo_stream.stream.show
|
||||||
// TODO(likes)
|
|
||||||
/- if (defined?(current_user) && !current_user.liked?(@parent))
|
|
||||||
/ %span.like_links
|
|
||||||
/ = link_to t('shared.stream_element.like'), likes_path(:positive => 'true', :post_id => @parent.id), :method => :post, :class => "like_it", :remote => true
|
|
||||||
/ |
|
|
||||||
/ = link_to t('shared.stream_element.dislike'), likes_path(:positive => 'false', :post_id => @parent.id), :method => :post, :class => "dislike_it", :remote => true
|
|
||||||
|
|
||||||
%div{:data=>{:guid=>parent.id}}
|
%div{:data=>{:guid=>parent.id}}
|
||||||
.likes_container
|
.likes_container
|
||||||
= render "likes/likes", :post_id => parent.id, :likes => parent.likes, :dislikes => parent.dislikes
|
= render "likes/likes", :post_id => parent.id, :likes => parent.likes
|
||||||
= render "comments/comments", :post => parent, :comments => parent.comments, :always_expanded => true
|
= render "comments/comments", :post => parent, :comments => parent.comments, :always_expanded => true
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,6 @@
|
||||||
|
|
||||||
.likes
|
.likes
|
||||||
- if post.likes.size > 0
|
- if post.likes.size > 0
|
||||||
= render "likes/likes", :post_id => post.id, :likes => post.likes, :dislikes => post.dislikes, :current_user => current_user
|
= render "likes/likes", :post_id => post.id, :likes => post.likes, :current_user => current_user
|
||||||
|
|
||||||
= render "comments/comments", :post => post, :comments => post.comments, :current_user => current_user, :condensed => true, :commenting_disabled => (defined?(@commenting_disabled) && @commenting_disabled)
|
= render "comments/comments", :post => post, :comments => post.comments, :current_user => current_user, :condensed => true, :commenting_disabled => (defined?(@commenting_disabled) && @commenting_disabled)
|
||||||
|
|
|
||||||
|
|
@ -570,13 +570,13 @@ describe User do
|
||||||
@message = alice.post(:status_message, :text => "cool", :to => alice.aspects.first)
|
@message = alice.post(:status_message, :text => "cool", :to => alice.aspects.first)
|
||||||
@message2 = bob.post(:status_message, :text => "uncool", :to => bob.aspects.first)
|
@message2 = bob.post(:status_message, :text => "uncool", :to => bob.aspects.first)
|
||||||
@like = alice.like(true, :post => @message)
|
@like = alice.like(true, :post => @message)
|
||||||
@dislike = bob.like(false, :post => @message)
|
@like2 = bob.like(true, :post => @message)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#like_for' do
|
describe '#like_for' do
|
||||||
it 'returns the correct like' do
|
it 'returns the correct like' do
|
||||||
alice.like_for(@message).should == @like
|
alice.like_for(@message).should == @like
|
||||||
bob.like_for(@message).should == @dislike
|
bob.like_for(@message).should == @like2
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns nil if there's no like" do
|
it "returns nil if there's no like" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue