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!
|
before_filter :authenticate_user!
|
||||||
|
|
||||||
def create
|
def create
|
||||||
current_user.blocks.create(params[:block])
|
block = current_user.blocks.new(params[:block])
|
||||||
redirect_to :back, :notice => "that person sucked anyways..."
|
|
||||||
|
if block.save
|
||||||
|
notice = {:notice => t('blocks.create.success')}
|
||||||
|
else
|
||||||
|
notice = {:error => t('blocks.create.failure')}
|
||||||
|
end
|
||||||
|
redirect_to :back, notice
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
current_user.blocks.find(params[:id]).delete
|
if current_user.blocks.find(params[:id]).delete
|
||||||
redirect_to :back, :notice => "MAKE UP YOUR MIND."
|
notice = {:notice => t('blocks.destroy.success')}
|
||||||
|
else
|
||||||
|
notice = {:error => t('blocks.destroy.failure')}
|
||||||
|
end
|
||||||
|
redirect_to :back, notice
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
module StreamElementHelper
|
module StreamElementHelper
|
||||||
def block_user_control(author)
|
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}),
|
link_to image_tag('deletelabel.png'), blocks_path(:block => {:person_id => author.id}),
|
||||||
:class => 'block_user delete',
|
:class => 'block_user delete',
|
||||||
:confirm => t('are_you_sure'),
|
:confirm => t('are_you_sure'),
|
||||||
:title => 'block user',
|
:title => t('.block_user', :name => author.first_name),
|
||||||
:method => :post
|
:method => :post
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
|
|
||||||
.stream_element{:id => post.guid, :class => from_group(post)}
|
.stream_element{:id => post.guid, :class => from_group(post)}
|
||||||
.right.controls
|
.right.controls
|
||||||
= delete_or_hide_button(post)
|
|
||||||
= block_user_control(post.author)
|
= block_user_control(post.author)
|
||||||
|
= delete_or_hide_button(post)
|
||||||
|
|
||||||
= image_tag 'ajax-loader.gif', :class => "hide_loader hidden"
|
= image_tag 'ajax-loader.gif', :class => "hide_loader hidden"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,4 +20,5 @@
|
||||||
= link_to t('.unblock'), block_path(block),
|
= link_to t('.unblock'), block_path(block),
|
||||||
:confirm => t('are_you_sure'),
|
:confirm => t('are_you_sure'),
|
||||||
:method => :delete
|
:method => :delete
|
||||||
|
%br
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -723,6 +723,14 @@ en:
|
||||||
invite: "invite"
|
invite: "invite"
|
||||||
not_on_diaspora: "Not yet on Diaspora"
|
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:
|
shared:
|
||||||
aspect_dropdown:
|
aspect_dropdown:
|
||||||
add_to_aspect: "Add contact"
|
add_to_aspect: "Add contact"
|
||||||
|
|
@ -768,7 +776,6 @@ en:
|
||||||
reshare:
|
reshare:
|
||||||
reshare: "Reshare"
|
reshare: "Reshare"
|
||||||
public_explain:
|
public_explain:
|
||||||
|
|
||||||
control_your_audience: "Control your Audience"
|
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"
|
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.)"
|
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"
|
connect_to_comment: "Connect to this user to comment on their post"
|
||||||
currently_unavailable: 'commenting currently unavailable'
|
currently_unavailable: 'commenting currently unavailable'
|
||||||
via: "via %{link}"
|
via: "via %{link}"
|
||||||
hide_and_mute: "Hide and Mute"
|
block_user: "Block %{name}"
|
||||||
|
hide_and_mute: "Hide and mute post"
|
||||||
like: "Like"
|
like: "Like"
|
||||||
unlike: "Unlike"
|
unlike: "Unlike"
|
||||||
dislike: "Dislike"
|
dislike: "Dislike"
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,9 @@ class Stream::Base
|
||||||
|
|
||||||
# @return [ActiveRecord::Association<Person>] AR association of people within stream's given aspects
|
# @return [ActiveRecord::Association<Person>] AR association of people within stream's given aspects
|
||||||
def people
|
def people
|
||||||
people_ids = posts.map{|x| x.author_id}
|
people_ids = self.stream_posts.map{|x| x.author_id}
|
||||||
Person.where(:id => people_ids).includes(:profile)
|
Person.where(:id => people_ids).
|
||||||
|
includes(:profile)
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [String]
|
# @return [String]
|
||||||
|
|
|
||||||
|
|
@ -791,9 +791,6 @@ a.paginate, #infscr-loading
|
||||||
:text-align center
|
:text-align center
|
||||||
:width 100%
|
:width 100%
|
||||||
|
|
||||||
&:hover
|
|
||||||
:border 1px solid #1C6D99
|
|
||||||
|
|
||||||
#main_stream
|
#main_stream
|
||||||
:position relative
|
:position relative
|
||||||
:z-index 0
|
:z-index 0
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,13 @@ describe Stream::Base do
|
||||||
end
|
end
|
||||||
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
|
describe 'shared behaviors' do
|
||||||
it_should_behave_like 'it is a stream'
|
it_should_behave_like 'it is a stream'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue