DH DG; don't display blocked people in stream; switch controls in stream; disallow blocking yourself
This commit is contained in:
parent
ae7944418c
commit
ee5bc25faf
8 changed files with 38 additions and 14 deletions
|
|
@ -2,12 +2,22 @@ class BlocksController < ApplicationController
|
|||
before_filter :authenticate_user!
|
||||
|
||||
def create
|
||||
current_user.blocks.create(params[:block])
|
||||
redirect_to :back, :notice => "that person sucked anyways..."
|
||||
block = current_user.blocks.new(params[:block])
|
||||
|
||||
if block.save
|
||||
notice = {:notice => t('blocks.create.success')}
|
||||
else
|
||||
notice = {:error => t('blocks.create.failure')}
|
||||
end
|
||||
redirect_to :back, notice
|
||||
end
|
||||
|
||||
def destroy
|
||||
current_user.blocks.find(params[:id]).delete
|
||||
redirect_to :back, :notice => "MAKE UP YOUR MIND."
|
||||
if current_user.blocks.find(params[:id]).delete
|
||||
notice = {:notice => t('blocks.destroy.success')}
|
||||
else
|
||||
notice = {:error => t('blocks.destroy.failure')}
|
||||
end
|
||||
redirect_to :back, notice
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
module StreamElementHelper
|
||||
def block_user_control(author)
|
||||
if user_signed_in?
|
||||
if user_signed_in? && current_user.person.id != author.id
|
||||
link_to image_tag('deletelabel.png'), blocks_path(:block => {:person_id => author.id}),
|
||||
:class => 'block_user delete',
|
||||
:confirm => t('are_you_sure'),
|
||||
:title => 'block user',
|
||||
:title => t('.block_user', :name => author.first_name),
|
||||
:method => :post
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
.stream_element{:id => post.guid, :class => from_group(post)}
|
||||
.right.controls
|
||||
= delete_or_hide_button(post)
|
||||
= block_user_control(post.author)
|
||||
= delete_or_hide_button(post)
|
||||
|
||||
= image_tag 'ajax-loader.gif', :class => "hide_loader hidden"
|
||||
|
||||
|
|
|
|||
|
|
@ -20,4 +20,5 @@
|
|||
= link_to t('.unblock'), block_path(block),
|
||||
:confirm => t('are_you_sure'),
|
||||
:method => :delete
|
||||
%br
|
||||
|
||||
|
|
|
|||
|
|
@ -723,6 +723,14 @@ en:
|
|||
invite: "invite"
|
||||
not_on_diaspora: "Not yet on Diaspora"
|
||||
|
||||
blocks:
|
||||
create:
|
||||
success: "Alright, you won't see them again. #niceblock!"
|
||||
failure: "I couldn't block that user. #evasion"
|
||||
destroy:
|
||||
success: "User unblocked! #combobreaker"
|
||||
failure: "I couldn't unblock that user. #evasion"
|
||||
|
||||
shared:
|
||||
aspect_dropdown:
|
||||
add_to_aspect: "Add contact"
|
||||
|
|
@ -768,7 +776,6 @@ en:
|
|||
reshare:
|
||||
reshare: "Reshare"
|
||||
public_explain:
|
||||
|
||||
control_your_audience: "Control your Audience"
|
||||
new_user_welcome_message: "Use #hashtags to classify your posts and find people who share your interests. Call out awesome people with @Mentions"
|
||||
visibility_dropdown: "Use this dropdown to change visibility of your post. (We suggest you make this first one public.)"
|
||||
|
|
@ -786,7 +793,8 @@ en:
|
|||
connect_to_comment: "Connect to this user to comment on their post"
|
||||
currently_unavailable: 'commenting currently unavailable'
|
||||
via: "via %{link}"
|
||||
hide_and_mute: "Hide and Mute"
|
||||
block_user: "Block %{name}"
|
||||
hide_and_mute: "Hide and mute post"
|
||||
like: "Like"
|
||||
unlike: "Unlike"
|
||||
dislike: "Dislike"
|
||||
|
|
|
|||
|
|
@ -52,8 +52,9 @@ class Stream::Base
|
|||
|
||||
# @return [ActiveRecord::Association<Person>] AR association of people within stream's given aspects
|
||||
def people
|
||||
people_ids = posts.map{|x| x.author_id}
|
||||
Person.where(:id => people_ids).includes(:profile)
|
||||
people_ids = self.stream_posts.map{|x| x.author_id}
|
||||
Person.where(:id => people_ids).
|
||||
includes(:profile)
|
||||
end
|
||||
|
||||
# @return [String]
|
||||
|
|
|
|||
|
|
@ -791,9 +791,6 @@ a.paginate, #infscr-loading
|
|||
:text-align center
|
||||
:width 100%
|
||||
|
||||
&:hover
|
||||
:border 1px solid #1C6D99
|
||||
|
||||
#main_stream
|
||||
:position relative
|
||||
:z-index 0
|
||||
|
|
|
|||
|
|
@ -43,6 +43,13 @@ describe Stream::Base do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#people' do
|
||||
it 'excludes blocked people' do
|
||||
@stream.should_receive(:stream_posts).and_return(stub.as_null_object)
|
||||
@stream.people
|
||||
end
|
||||
end
|
||||
|
||||
describe 'shared behaviors' do
|
||||
it_should_behave_like 'it is a stream'
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue