Skip to content
Extraits de code Groupes Projets
Valider e402bbdd rédigé par Steffen van Bergerem's avatar Steffen van Bergerem
Parcourir les fichiers

Merge pull request #6245 from AugierLe42e/fix-nsfw-author

Fix nsfw author
parents 922d700d 9a23c92f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -49,6 +49,7 @@ With the port to Bootstrap 3, app/views/terms/default.haml has a new structure.
* Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852)
* Improve accessibility of a couple pages [#6227](https://github.com/diaspora/diaspora/pull/6227)
* Capitalize "Powered by diaspora" [#6254](https://github.com/diaspora/diaspora/pull/6254)
* Display username and avatar for NSFW posts in mobile view [#6245](https://github.com/diaspora/diaspora/6245)
## Features
* Support color themes [#6033](https://github.com/diaspora/diaspora/pull/6033)
......
......@@ -24,7 +24,7 @@
$(document).ready(function(){
$('.shield a').click(function(){
$(this).parents('.shield_wrapper').remove();
$(this).parents(".stream_element").removeClass("shield-active");
return false;
});
var showLoader = function(link){
......
......@@ -77,20 +77,28 @@ h3 { margin-top: 0; }
.photo_attachments{ margin-top: 6px; }
.timeago{ font-weight: normal; }
}
.shield{
padding: 10px;
font-size: larger;
}
.shield_wrapper{
.nsfw-shield{
height: 100%;
width: 100%;
background-color: LightGrey;
position: absolute;
border-radius: 5px;
border-radius: 0;
z-index: 2;
}
.stream_element:not(.shield-active) .shield{
display: none;
}
.stream_element.shield-active .nsfw-hidden{
display: none;
}
.new_comment {
padding: 10px;
}
......@@ -571,10 +579,10 @@ select {
.reshare_via {
width: 100%;
position: absolute;
bottom: -7px;
bottom: -10px;
text-align: center;
span {
padding: 2px 10px;
padding: 0 10px;
font-weight: bold;
color: $text-grey;
background: {
......
......@@ -4,17 +4,22 @@
.reshare
- if post
= render 'shared/photo_area', :post => post
.nsfw-hidden
= render "shared/photo_area", post: post
.content
= render 'shared/post_info', :post => post
= render "shared/post_info", post: post
- unless post.is_a?(Reshare)
= render "shared/nsfw_shield", post: post
- if !post.activity_streams?
= render 'status_messages/status_message', :post => post, :photos => post.photos
.nsfw-hidden
= render "status_messages/status_message", post: post, photos: post.photos
- else
.content
= t('.deleted')
= t(".deleted")
.reshare_via
%span
= t('.reshared_via')
= t(".reshared_via")
- if post.respond_to?(:nsfw) && post.nsfw
.nsfw-shield
.shield
%strong #NSFW
|
= link_to t("javascripts.stream.show_nsfw_post"), "#", class: "toggle_nsfw_state"
......@@ -31,5 +31,5 @@
- else
= t('limited')
- if !post.is_a?(Reshare) and post.location
.location
.location.nsfw-hidden
= t("posts.show.location", location: post.location.address)
......@@ -2,26 +2,24 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
.stream_element{data: {guid: post.id}}
- if post.respond_to?(:nsfw) && post.nsfw
.shield_wrapper
.shield
%strong #NSFW
|
= link_to t("javascripts.stream.show_nsfw_post"), "#"
.stream_element{data: {guid: post.id}, class: post.respond_to?(:nsfw) && post.nsfw ? "shield-active" : ""}
- if post.is_a?(Reshare)
= render "reshares/reshare", reshare: post, post: post.absolute_root
= render "shared/photo_area", post: post
.nsfw-hidden
= render "shared/photo_area", post: post
.content
= render "shared/post_info", post: post
- unless post.is_a?(Reshare)
= render "shared/nsfw_shield", post: post
.nsfw-hidden
- if post.is_a?(StatusMessage)
= render "status_messages/status_message", post: post, photos: post.photos
.bottom_bar
.bottom_bar.nsfw-hidden
.floater
= mobile_reshare_icon(post)
= mobile_comment_icon(post)
......@@ -31,4 +29,3 @@
- if defined?(expanded_info) && expanded_info
= render partial: "shared/post_stats", locals: {post: @post}
@javascript @mobile
Feature: Not safe for work
Background:
Given a nsfw user with email "tommy@nsfw.example.com"
And a user with email "laura@office.example.com"
And a user with email "laura@office.example.com" is connected with "tommy@nsfw.example.com"
Scenario: Setting not safe for work
And I sign in as "tommy@nsfw.example.com"
When I go to the edit profile page
And I mark myself as not safe for work
And I submit the form
Then I should be on the edit profile page
And the "profile[nsfw]" checkbox should be checked
When I go to the edit profile page
And I mark myself as safe for work
And I submit the form
Then I should be on the edit profile page
And the "profile[nsfw]" checkbox should not be checked
Scenario: Toggling nsfw state
#Nsfw users posts are marked nsfw
And "tommy@nsfw.example.com" has a public post with text "I love 0bj3ction4bl3 c0nt3nt!" and a poll
And "tommy@nsfw.example.com" has a public post with text "I love 0bj3ction4bl3 c0nt3nt!" and a location
And "tommy@nsfw.example.com" has a public post with text "I love 0bj3ction4bl3 c0nt3nt!" and a picture
#toggling nsfw state
When I sign in as "laura@office.example.com"
Then I should not see "I love 0bj3ction4bl3 c0nt3nt!"
And I should not see "What do you think about 1 ninjas?"
And I should not see "Posted from:"
And I should not see any picture in my stream
When I toggle all nsfw posts
Then I should see "I love 0bj3ction4bl3 c0nt3nt!"
And I should see "What do you think about 1 ninjas?"
And I should see "Posted from:"
And I should see 1 pictures in my stream
Scenario: Resharing a nsfw post with poll
And "tommy@nsfw.example.com" has a public post with text "Sexy Senators Gone Wild!" and a poll
And I sign in as "laura@office.example.com"
And I toggle all nsfw posts
And I follow "Reshare"
And I confirm the alert
And I go to the home page
Then I should not see "Sexy Senators Gone Wild!"
And I should not see "What do you think about 1 ninjas?"
And I should have 2 nsfw posts
Scenario: Resharing a nsfw post with location
And "tommy@nsfw.example.com" has a public post with text "Sexy Senators Gone Wild!" and a location
And I sign in as "laura@office.example.com"
And I toggle all nsfw posts
And I follow "Reshare"
And I confirm the alert
And I go to the home page
Then I should not see "Sexy Senators Gone Wild!"
And I should not see "Posted from:"
And I should have 2 nsfw posts
Scenario: Resharing a nsfw post with picture
And "tommy@nsfw.example.com" has a public post with text "Sexy Senators Gone Wild!" and a picture
And I sign in as "laura@office.example.com"
And I toggle all nsfw posts
And I follow "Reshare"
And I confirm the alert
And I go to the home page
Then I should not see "Sexy Senators Gone Wild!"
And I should not see any picture in my stream
And I should have 2 nsfw posts
......@@ -18,6 +18,14 @@ Then /^I should not see any posts in my stream$/ do
page.assert_selector(".stream_element", count: 0)
end
Then /^I should not see any picture in my stream$/ do
expect(page).to have_selector(".photo_area img", count: 0)
end
Then /^I should see (\d+) pictures in my stream$/ do |count|
expect(page).to have_selector(".photo_area img", count: count)
end
Then /^I should not be able to submit the publisher$/ do
expect(publisher_submittable?).to be false
end
......@@ -27,6 +35,24 @@ Given /^"([^"]*)" has a public post with text "([^"]*)"$/ do |email, text|
user.post(:status_message, :text => text, :public => true, :to => user.aspect_ids)
end
Given /^"([^"]*)" has a public post with text "([^"]*)" and a poll$/ do |email, text|
user = User.find_by(email: email)
post = user.post(:status_message, text: text, public: true, to: user.aspect_ids)
FactoryGirl.create(:poll, status_message: post)
end
Given /^"([^"]*)" has a public post with text "([^"]*)" and a location$/ do |email, text|
user = User.find_by(email: email)
post = user.post(:status_message, text: text, public: true, to: user.aspect_ids)
FactoryGirl.create(:location, status_message: post)
end
Given /^"([^"]*)" has a public post with text "([^"]*)" and a picture/ do |email, text|
user = User.find_by(email: email)
post = user.post(:status_message, text: text, public: true, to: user.aspect_ids)
FactoryGirl.create(:photo, status_message: post)
end
Given /^there are (\d+) public posts from "([^"]*)"$/ do |n_posts, email|
user = User.find_by_email(email)
(1..n_posts.to_i).each do |n|
......
......@@ -14,6 +14,10 @@ When /^I toggle nsfw posts$/ do
find(".toggle_nsfw_state", match: :first).click
end
When /^I toggle all nsfw posts$/ do
all("a.toggle_nsfw_state").each &:click
end
Then /^I should have (\d+) nsfw posts$/ do |num_posts|
page.should have_css(".nsfw-shield", count: num_posts.to_i)
end
......@@ -29,7 +29,7 @@ describe PostsController, type: :request do
get "/posts/#{sm.id}", format: :mobile
expect(response.status).to eq(200)
expect(response.body).to match(/div class='location'/)
expect(response.body).to match(/'location nsfw-hidden'/)
expect(response.body).to match(/#{I18n.t("posts.show.location", location: sm.location.address)}/)
end
end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter