From a1ac848d6237eca497f9acf9ab063418041e6bc1 Mon Sep 17 00:00:00 2001 From: goobertron Date: Sun, 12 Jan 2014 20:02:33 +0000 Subject: [PATCH 1/3] Change NSFW explanation on profile settings page (and stop altering of text depending on NSFW setting) --- app/views/profiles/_edit.haml | 13 ++++++++----- app/views/profiles/_edit.mobile.haml | 11 +++++++---- config/locales/diaspora/en.yml | 5 +++-- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/app/views/profiles/_edit.haml b/app/views/profiles/_edit.haml index 6f15c4038..0717f826f 100644 --- a/app/views/profiles/_edit.haml +++ b/app/views/profiles/_edit.haml @@ -45,16 +45,19 @@ = t('search') %p{:class=>"checkbox_select"} - = label_tag 'profile[searchable]', t('profiles.edit.allow_search') = check_box_tag 'profile[searchable]', true, profile.searchable + = label_tag 'profile[searchable]', t('profiles.edit.allow_search') %br %br - %h4= t('nsfw') - %p.nsfw_explanation=profile.nsfw? ? t('.you_are_nsfw') : t('.you_are_safe_for_work') + %h4 + = t('nsfw') + = t('profiles.edit.nsfw_explanation') %p{:class=>"checkbox_select"} - = check_box_tag 'profile[nsfw]', true, profile.nsfw? - = label_tag 'profile[nsfw]', "nsfw?" + = check_box_tag 'profile[nsfw]', true, profile.nsfw + = label_tag 'profile[nsfw]', t('profiles.edit.nsfw_check') + = t('profiles.edit.nsfw_explanation2') + %br %br %br diff --git a/app/views/profiles/_edit.mobile.haml b/app/views/profiles/_edit.mobile.haml index 8442536e9..b4a5badbd 100644 --- a/app/views/profiles/_edit.mobile.haml +++ b/app/views/profiles/_edit.mobile.haml @@ -43,11 +43,14 @@ = check_box_tag 'profile[searchable]', true, profile.searchable %br - %h4= t('nsfw') - %p.nsfw_explanation=profile.nsfw? ? t('.you_are_nsfw') : t('.you_are_safe_for_work') + %h4 + = t('nsfw') + = t('profiles.edit.nsfw_explanation') %p{:class=>"checkbox_select"} - = check_box_tag 'profile[nsfw]', true, profile.nsfw? - = label_tag 'profile[nsfw]', "nsfw?" + = check_box_tag 'profile[nsfw]', true, profile.nsfw + = label_tag 'profile[nsfw]', t('profiles.edit.nsfw_check') + = t('profiles.edit.nsfw_explanation2') + %br %br .submit_block diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 86f50b8a2..8c2c64f5b 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -873,8 +873,9 @@ en: update_profile: "Update Profile" allow_search: "Allow for people to search for you within Diaspora" edit_profile: "Edit profile" - you_are_nsfw: "You have marked yourself not safe for work, your content will not show up in people who have opted out of seeing objectionable content's streams." - you_are_safe_for_work: "You have marked yourself as safe for work, this means you agree the content you post will agree with the community guidelines." + nsfw_explanation: "NSFW (‘not safe for work’) is diaspora*’s self-governing community standard for content which may not be suitable to view while at work. If you plan to share such material frequently, please check this option so that everything you share will be hidden from people’s streams unless they choose to view them." + nsfw_explanation2: "If you choose not to select this option, please add the #nsfw tag each time you share such material." + nsfw_check: "Mark everything I share as NSFW" update: updated: "Profile updated" failed: "Failed to update profile" From 706b11b14df42302c666560c9c634bda72f674de Mon Sep 17 00:00:00 2001 From: goobertron Date: Mon, 13 Jan 2014 18:14:43 +0000 Subject: [PATCH 2/3] Now with passing Cucumber tests --- app/views/profiles/_edit.haml | 2 +- features/desktop/not_safe_for_work.feature | 9 +++++---- features/step_definitions/message_steps.rb | 4 ---- features/step_definitions/profile_steps.rb | 14 ++++++++++++++ 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/app/views/profiles/_edit.haml b/app/views/profiles/_edit.haml index 0717f826f..07940a981 100644 --- a/app/views/profiles/_edit.haml +++ b/app/views/profiles/_edit.haml @@ -54,7 +54,7 @@ = t('nsfw') = t('profiles.edit.nsfw_explanation') %p{:class=>"checkbox_select"} - = check_box_tag 'profile[nsfw]', true, profile.nsfw + = check_box_tag 'profile[nsfw]', true, profile.nsfw? = label_tag 'profile[nsfw]', t('profiles.edit.nsfw_check') = t('profiles.edit.nsfw_explanation2') %br diff --git a/features/desktop/not_safe_for_work.feature b/features/desktop/not_safe_for_work.feature index 72bdbd1e4..781632287 100644 --- a/features/desktop/not_safe_for_work.feature +++ b/features/desktop/not_safe_for_work.feature @@ -7,14 +7,15 @@ Scenario: Setting not safe for work | pr0n king | tommy@pr0n.xxx | And I sign in as "tommy@pr0n.xxx" When I go to the edit profile page - And I should see the "you are safe for work" message And I mark myself as not safe for work And I submit the form Then I should be on the edit profile page - And I should see the "you are nsfw" message - When I mark myself as safe for work + 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 see the "you are safe for work" message + 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 diff --git a/features/step_definitions/message_steps.rb b/features/step_definitions/message_steps.rb index a3223b830..43399d007 100644 --- a/features/step_definitions/message_steps.rb +++ b/features/step_definitions/message_steps.rb @@ -5,10 +5,6 @@ Then /^I should see the "(.*)" message$/ do |message| I18n.translate('invitation_codes.excited', :name => @alice.name) when "welcome to diaspora" I18n.translate('users.getting_started.well_hello_there') - when 'you are safe for work' - I18n.translate('profiles.edit.you_are_safe_for_work') - when 'you are nsfw' - I18n.translate('profiles.edit.you_are_nsfw') when 'post not public' I18n.translate('error_messages.post_not_public_or_not_exist') else diff --git a/features/step_definitions/profile_steps.rb b/features/step_definitions/profile_steps.rb index 1c9c6a4b9..c1caa8a46 100644 --- a/features/step_definitions/profile_steps.rb +++ b/features/step_definitions/profile_steps.rb @@ -5,3 +5,17 @@ end And /^I mark myself as safe for work$/ do uncheck('profile[nsfw]') end + +And /^the "profile[nsfw]" checkbox should be checked$/ do |label, selector| + with_scope(selector) do + field_checked = find_field(label)['checked'] + field_checked.should be_true + end +end + +And /^the "profile[nsfw]" checkbox should not be checked$/ do |label, selector| + with_scope(selector) do + field_checked = find_field(label)['checked'] + field_checked.should be_false + end +end From 29a98ddc29f55beb8dd3fd8a23b74230c03c6e4d Mon Sep 17 00:00:00 2001 From: goobertron Date: Mon, 13 Jan 2014 18:47:47 +0000 Subject: [PATCH 3/3] Remove duplicate test steps --- features/step_definitions/profile_steps.rb | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/features/step_definitions/profile_steps.rb b/features/step_definitions/profile_steps.rb index c1caa8a46..80b148d9b 100644 --- a/features/step_definitions/profile_steps.rb +++ b/features/step_definitions/profile_steps.rb @@ -6,16 +6,3 @@ And /^I mark myself as safe for work$/ do uncheck('profile[nsfw]') end -And /^the "profile[nsfw]" checkbox should be checked$/ do |label, selector| - with_scope(selector) do - field_checked = find_field(label)['checked'] - field_checked.should be_true - end -end - -And /^the "profile[nsfw]" checkbox should not be checked$/ do |label, selector| - with_scope(selector) do - field_checked = find_field(label)['checked'] - field_checked.should be_false - end -end