From 58d2ce7ba67ba4cc55b7dee6f1a4f3cad5a3b9bd Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Sun, 7 Oct 2018 14:32:45 -0400 Subject: [PATCH 1/5] Ignore Users in Mobile UI fixes #7840 closes #7884 --- Changelog.md | 1 + app/assets/stylesheets/mobile/mobile.scss | 16 ++++++++++++++++ app/controllers/blocks_controller.rb | 1 + app/views/people/show.mobile.haml | 18 +++++++++++++++++- config/locales/diaspora/en.yml | 1 + 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 0e83f41fc..6dbf4de3c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ ## Bug fixes ## Features +* Suppoert ignore users on mobile [#7884](https://github.com/diaspora/diaspora/pull/7884) # 0.7.8.0 diff --git a/app/assets/stylesheets/mobile/mobile.scss b/app/assets/stylesheets/mobile/mobile.scss index 6447df013..f8b22d5f7 100644 --- a/app/assets/stylesheets/mobile/mobile.scss +++ b/app/assets/stylesheets/mobile/mobile.scss @@ -350,6 +350,7 @@ footer { } .bottom-bar { + margin: 0; position: static; } } @@ -694,6 +695,21 @@ select#aspect_ids_ { .entypo-camera { margin-right: 0; } } +.mobile-icon-bar { + background: $framed-background; + border-top: 1px solid $border-grey; + display: block; + padding: 1px 6px; + position: relative; +} + +.mobile-icon-bar-button { + color: $text-grey; + float: right; + font-size: large; + padding: 0; +} + #publisher-textarea-wrapper { border-radius: 2px; margin: 12px 0px; diff --git a/app/controllers/blocks_controller.rb b/app/controllers/blocks_controller.rb index 7256a38c8..39d8cb91c 100644 --- a/app/controllers/blocks_controller.rb +++ b/app/controllers/blocks_controller.rb @@ -10,6 +10,7 @@ class BlocksController < ApplicationController respond_to do |format| format.json { head :no_content } + format.any { redirect_back fallback_location: root_path } end end diff --git a/app/views/people/show.mobile.haml b/app/views/people/show.mobile.haml index f35f81cfc..4d8f1deae 100644 --- a/app/views/people/show.mobile.haml +++ b/app/views/people/show.mobile.haml @@ -10,7 +10,23 @@ %span.description = @person.diaspora_handle - if user_signed_in? && @person != current_user.person - = render 'aspect_memberships/aspect_membership_dropdown' + - if @presenter.full_hash[:block] + .pull-right + = link_to t("users.privacy_settings.stop_ignoring"), + block_path(@presenter.full_hash[:block][:id]), + class: "btn btn-danger", + method: :delete + - else + = render "aspect_memberships/aspect_membership_dropdown" + .clear + - if user_signed_in? && @person != current_user.person && !@presenter.full_hash[:block] + .mobile-icon-bar + = link_to "", + blocks_path(block: {person_id: @person.id}), + data: {confirm: t("are_you_sure_ignore_user")}, + method: :post, + confirm: true, + class: "btn entypo-block shield mobile-icon-bar-button" .clear .bottom-bar - if !@person.tag_string.blank? && user_signed_in? diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index fe86d2fa4..7b93ab90f 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -20,6 +20,7 @@ en: email: "Email" are_you_sure: "Are you sure?" are_you_sure_delete_account: "Are you sure you want to close your account? This can’t be undone!" + are_you_sure_ignore_user: "You are going to ignore that user. Are you sure?" fill_me_out: "Fill me out" public: "Public" limited: "Limited" From 6804132c1571d5e03cbc5ad6529bafbd8d28b827 Mon Sep 17 00:00:00 2001 From: flaburgan Date: Sun, 28 Oct 2018 22:52:59 +0100 Subject: [PATCH 2/5] Do not autofollow back a user you are ignoring fixes #7808 closes #7913 --- Changelog.md | 1 + app/models/user/connecting.rb | 2 ++ features/desktop/auto_follow_back.feature | 36 ++++++++++++++++++++++ features/step_definitions/aspects_steps.rb | 24 +++++++++++++++ features/step_definitions/user_steps.rb | 11 ------- 5 files changed, 63 insertions(+), 11 deletions(-) create mode 100644 features/desktop/auto_follow_back.feature diff --git a/Changelog.md b/Changelog.md index 6dbf4de3c..1ec03fca1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,7 @@ * Improve public stream performance and cleanup unused indexes [#7944](https://github.com/diaspora/diaspora/pull/7944) ## Bug fixes +* Do not autofollow back a user you are ignoring [#7913](https://github.com/diaspora/diaspora/pull/7913) ## Features * Suppoert ignore users on mobile [#7884](https://github.com/diaspora/diaspora/pull/7884) diff --git a/app/models/user/connecting.rb b/app/models/user/connecting.rb index 4ddd46e3e..232dba405 100644 --- a/app/models/user/connecting.rb +++ b/app/models/user/connecting.rb @@ -11,6 +11,8 @@ class User # @param [Aspect] aspect The aspect to add them to. # @return [Contact] The newly made contact for the passed in person. def share_with(person, aspect) + return if blocks.where(person_id: person.id).exists? + contact = contacts.find_or_initialize_by(person_id: person.id) return false unless contact.valid? diff --git a/features/desktop/auto_follow_back.feature b/features/desktop/auto_follow_back.feature new file mode 100644 index 000000000..1b7404805 --- /dev/null +++ b/features/desktop/auto_follow_back.feature @@ -0,0 +1,36 @@ +@javascript +Feature: auto follow back a user + + Background: + Given following users exist: + | username | email | + | Bob Jones | bob@bob.bob | + | Alice Smith | alice@alice.alice | + And I sign in as "bob@bob.bob" + And I have an aspect called "My main aspect" + And I have an aspect called "Others" with auto follow back + And I sign out + + Scenario: When a user with auto follow back enabled is shared with, he's sharing back + When I sign in as "alice@alice.alice" + And I am on "bob@bob.bob"'s page + And I add the person to my "Besties" aspect + And I sign out + And I sign in as "bob@bob.bob" + Then I should have 1 contact in "Others" + When I am on "alice@alice.alice"'s page + Then I should see "Others" within the contact aspect dropdown + + Scenario: When a user with auto follow back enabled is shared with by a user he's ignoring, he's not sharing back + When I sign in as "bob@bob.bob" + And I am on "alice@alice.alice"'s page + And I click on the profile block button + And I sign out + When I sign in as "alice@alice.alice" + And I am on "bob@bob.bob"'s page + And I add the person to my "Besties" aspect + And I sign out + And I sign in as "bob@bob.bob" + Then I should have 0 contact in "Others" + When I am on "alice@alice.alice"'s page + Then I should see "Stop ignoring" within "#unblock_user_button" diff --git a/features/step_definitions/aspects_steps.rb b/features/step_definitions/aspects_steps.rb index 9add74766..b00ddf731 100644 --- a/features/step_definitions/aspects_steps.rb +++ b/features/step_definitions/aspects_steps.rb @@ -38,6 +38,26 @@ module AspectCukeHelpers end World(AspectCukeHelpers) +Given /^I have an aspect called "([^\"]*)"$/ do |aspect_name| + @me.aspects.create!(name: aspect_name) + @me.reload +end + +Given /^I have an aspect called "([^\"]*)" with auto follow back$/ do |aspect_name| + aspect = @me.aspects.create!(name: aspect_name) + @me.auto_follow_back = true + @me.auto_follow_back_aspect = aspect + @me.save + @me.reload +end + +Given /^I have following aspect[s]?:$/ do |fields| + fields.raw.each do |field| + @me.aspects.create!(name: field[0]) + end + @me.reload +end + When /^I click on "([^"]*)" aspect edit icon$/ do |aspect_name| within(".all-aspects") do li = find('li', text: aspect_name) @@ -112,6 +132,10 @@ And /^I toggle the aspect "([^"]*)"$/ do |name| toggle_aspect(name) end +Then /^I should see "([^"]*)" within the contact aspect dropdown$/ do |aspect_name| + expect(find(".dropdown-toggle .text")).to have_content aspect_name +end + Then /^I should see "([^"]*)" aspect selected$/ do |aspect_name| aspect = @me.aspects.where(:name => aspect_name).first within("#aspects_list") do diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index e50102961..ee4e71b69 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -72,17 +72,6 @@ When /^I click on my name$/ do click_link("#{@me.first_name} #{@me.last_name}") end -Given /^I have an aspect called "([^\"]*)"$/ do |aspect_name| - @me.aspects.create!(:name => aspect_name) - @me.reload -end - -Given /^I have following aspect[s]?:$/ do |fields| - fields.raw.each do |field| - step %{I have an aspect called "#{field[0]}"} - end -end - When /^I have user with username "([^"]*)" in an aspect called "([^"]*)"$/ do |username, aspect| user = User.find_by_username(username) contact = @me.reload.contact_for(user.person) From c8a1f308c6625e4a9ea10e99141a5d93940a7a0e Mon Sep 17 00:00:00 2001 From: flaburgan Date: Mon, 5 Nov 2018 15:37:09 +0100 Subject: [PATCH 3/5] Rename 'toggle mobile' to 'switch to touch-optimized mode' or 'switch to standard mode' closes #7926 --- Changelog.md | 1 + app/assets/templates/header_tpl.jst.hbs | 2 +- app/views/api/openid_connect/error/error.mobile.haml | 2 +- app/views/devise/passwords/edit.mobile.haml | 2 +- app/views/devise/passwords/new.mobile.haml | 2 +- app/views/layouts/_drawer.mobile.haml | 2 +- app/views/registrations/new.mobile.haml | 2 +- app/views/sessions/new.mobile.haml | 2 +- app/views/shared/_links.haml | 2 +- config/locales/diaspora/en.yml | 3 ++- config/locales/javascript/javascript.en.yml | 2 +- 11 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Changelog.md b/Changelog.md index 1ec03fca1..b8eb2b175 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,7 @@ ## Refactor * Improve public stream performance and cleanup unused indexes [#7944](https://github.com/diaspora/diaspora/pull/7944) +* Improve wording of "Toggle mobile" [#7926](https://github.com/diaspora/diaspora/pull/7926) ## Bug fixes * Do not autofollow back a user you are ignoring [#7913](https://github.com/diaspora/diaspora/pull/7913) diff --git a/app/assets/templates/header_tpl.jst.hbs b/app/assets/templates/header_tpl.jst.hbs index 9c3270e5b..d730a8bd5 100644 --- a/app/assets/templates/header_tpl.jst.hbs +++ b/app/assets/templates/header_tpl.jst.hbs @@ -64,7 +64,6 @@ diff --git a/app/views/api/openid_connect/error/error.mobile.haml b/app/views/api/openid_connect/error/error.mobile.haml index dcfd1f5f8..75512477f 100644 --- a/app/views/api/openid_connect/error/error.mobile.haml +++ b/app/views/api/openid_connect/error/error.mobile.haml @@ -5,4 +5,4 @@ = render partial: "api/openid_connect/error/error" %footer - = link_to t("layouts.application.toggle"), toggle_mobile_path + = link_to t("layouts.application.switch_to_standard_mode"), toggle_mobile_path diff --git a/app/views/devise/passwords/edit.mobile.haml b/app/views/devise/passwords/edit.mobile.haml index 57f168682..a9d7df344 100644 --- a/app/views/devise/passwords/edit.mobile.haml +++ b/app/views/devise/passwords/edit.mobile.haml @@ -26,4 +26,4 @@ = f.submit t("devise.passwords.edit.change_password"), class: "btn btn-primary" %footer - = link_to t("layouts.application.toggle"), toggle_mobile_path + = link_to t("layouts.application.switch_to_standard_mode"), toggle_mobile_path diff --git a/app/views/devise/passwords/new.mobile.haml b/app/views/devise/passwords/new.mobile.haml index e588d71d0..af496b0bf 100644 --- a/app/views/devise/passwords/new.mobile.haml +++ b/app/views/devise/passwords/new.mobile.haml @@ -26,4 +26,4 @@ = link_to t('devise.sessions.new.sign_in'), new_user_session_path() - = link_to t('layouts.application.toggle'), toggle_mobile_path + = link_to t("layouts.application.switch_to_standard_mode"), toggle_mobile_path diff --git a/app/views/layouts/_drawer.mobile.haml b/app/views/layouts/_drawer.mobile.haml index 1f248a976..61b6045dc 100644 --- a/app/views/layouts/_drawer.mobile.haml +++ b/app/views/layouts/_drawer.mobile.haml @@ -59,5 +59,5 @@ .pull-right.badge = unreviewed_reports_count = t("admins.admin_bar.report") - %li= link_to t("layouts.application.toggle"), toggle_mobile_path + %li= link_to t("layouts.application.switch_to_standard_mode"), toggle_mobile_path %li= link_to t("layouts.header.logout"), destroy_user_session_path, method: :delete diff --git a/app/views/registrations/new.mobile.haml b/app/views/registrations/new.mobile.haml index 99c858cd2..7837a875d 100644 --- a/app/views/registrations/new.mobile.haml +++ b/app/views/registrations/new.mobile.haml @@ -15,4 +15,4 @@ %footer.footer %ul %li= link_to t("devise.shared.links.sign_in"), new_session_path(resource_name) - %li= link_to t("layouts.application.toggle"), toggle_mobile_path + %li= link_to t("layouts.application.switch_to_standard_mode"), toggle_mobile_path diff --git a/app/views/sessions/new.mobile.haml b/app/views/sessions/new.mobile.haml index e15f7af03..a7d7a64aa 100644 --- a/app/views/sessions/new.mobile.haml +++ b/app/views/sessions/new.mobile.haml @@ -21,4 +21,4 @@ id: "forgot_password_link" - if display_registration_link? %li= link_to t("devise.shared.links.sign_up"), new_registration_path(resource_name) - %li= link_to t("layouts.application.toggle"), toggle_mobile_path + %li= link_to t("layouts.application.switch_to_standard_mode"), toggle_mobile_path diff --git a/app/views/shared/_links.haml b/app/views/shared/_links.haml index 2032d6197..59725ac51 100644 --- a/app/views/shared/_links.haml +++ b/app/views/shared/_links.haml @@ -4,6 +4,6 @@ source_url.to_s, title: t("layouts.application.source_package") %li= link_to t("layouts.application.statistics_link"), statistics_path -%li= link_to t("layouts.application.toggle"), toggle_mobile_path +%li= link_to t("layouts.application.switch_to_touch_optimized_mode"), toggle_mobile_path - if AppConfig.settings.terms.enable? %li= link_to t("_terms"), terms_path diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 7b93ab90f..88ee05b20 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -616,7 +616,8 @@ en: whats_new: "What’s new?" statistics_link: "Pod statistics" discourse: "Project discussions and support" - toggle: "Toggle mobile" + switch_to_touch_optimized_mode: "Switch to touch-optimized mode" + switch_to_standard_mode: "Switch to standard mode" public_feed: "Public diaspora* feed for %{name}" back_to_top: "Back to top" source_package: "Download the source code package" diff --git a/config/locales/javascript/javascript.en.yml b/config/locales/javascript/javascript.en.yml index b935267b5..372d26705 100644 --- a/config/locales/javascript/javascript.en.yml +++ b/config/locales/javascript/javascript.en.yml @@ -311,7 +311,7 @@ en: moderator: "Moderator" log_out: "Log out" toggle_navigation: "Toggle navigation" - toggle_mobile: "Toggle mobile" + switch_to_touch_optimized_mode: "Switch to touch-optimized mode" notifications: "Notifications" conversations: "Conversations" From 3f700c3960e540fd24a332504b876c9ba4bee877 Mon Sep 17 00:00:00 2001 From: flaburgan Date: Wed, 5 Dec 2018 00:10:11 +0100 Subject: [PATCH 4/5] Fix photos galley when too many thumbnails by adding a scroll-x fixes #7942 closes #7943 --- Changelog.md | 1 + app/assets/javascripts/app/views/gallery_view.js | 2 +- app/assets/stylesheets/gallery.scss | 6 ++++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index b8eb2b175..856d6e439 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ ## Bug fixes * Do not autofollow back a user you are ignoring [#7913](https://github.com/diaspora/diaspora/pull/7913) +* Fix photos gallery when too many thumbnails are shown [#7943](https://github.com/diaspora/diaspora/pull/7943) ## Features * Suppoert ignore users on mobile [#7884](https://github.com/diaspora/diaspora/pull/7884) diff --git a/app/assets/javascripts/app/views/gallery_view.js b/app/assets/javascripts/app/views/gallery_view.js index 73a8a70c1..badf0c02d 100644 --- a/app/assets/javascripts/app/views/gallery_view.js +++ b/app/assets/javascripts/app/views/gallery_view.js @@ -41,7 +41,7 @@ app.views.Gallery = app.views.Base.extend({ if (image.naturalHeight > window.innerHeight && image.naturalHeight > image.naturalWidth * 2) { image.classList.add("too-tall"); } else { - var margins = 95; // Margins are 80px for thumbnails height and 15px for top image margin + var margins = 110; // Margins are 80px for thumbnails height and 15px for top image margin + scroll-x height image.style = "max-height: " + (window.innerHeight - margins) + "px"; } } diff --git a/app/assets/stylesheets/gallery.scss b/app/assets/stylesheets/gallery.scss index 3966bea20..67a1a467c 100644 --- a/app/assets/stylesheets/gallery.scss +++ b/app/assets/stylesheets/gallery.scss @@ -50,15 +50,17 @@ $margin: 15px; .indicator { bottom: 0; + overflow-x: auto; + white-space: nowrap; li { border: 0; border-radius: $thumbnail-size / 2; height: $thumbnail-size; - margin: 6px; - margin-bottom: $margin; + margin: $margin 6px; vertical-align: middle; width: $thumbnail-size; + background-size: cover; &.active, &:hover { From efcaa860ace3a4ce444f3dbe3c63e0e65e0f1631 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 6 Jan 2019 17:36:47 +0100 Subject: [PATCH 5/5] Revert "Bump bootstrap-switch-rails" It looks like 3.3.4 is broken :( Fixes #7940 This reverts commit 5205e3c5266aaa006340c668a1cc1a2c79499a2d. closes #7955 --- Changelog.md | 1 + Gemfile | 2 +- Gemfile.lock | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 856d6e439..58e397eb4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ ## Bug fixes * Do not autofollow back a user you are ignoring [#7913](https://github.com/diaspora/diaspora/pull/7913) * Fix photos gallery when too many thumbnails are shown [#7943](https://github.com/diaspora/diaspora/pull/7943) +* Fix extended profile visibility switch showing the wrong state [#7955](https://github.com/diaspora/diaspora/pull/7955) ## Features * Suppoert ignore users on mobile [#7884](https://github.com/diaspora/diaspora/pull/7884) diff --git a/Gemfile b/Gemfile index 20cddde2a..b7ae543c9 100644 --- a/Gemfile +++ b/Gemfile @@ -58,7 +58,7 @@ gem "rack-cors", "1.0.2", require: "rack/cors" gem "autoprefixer-rails", "8.6.5" gem "bootstrap-sass", "3.3.7" -gem "bootstrap-switch-rails", "3.3.4" +gem "bootstrap-switch-rails", "3.3.3" # 3.3.4 is broken, see https://github.com/Bttstrp/bootstrap-switch/issues/691 gem "compass-rails", "3.1.0" gem "sass-rails", "5.0.7" gem "sprockets-rails", "3.2.1" diff --git a/Gemfile.lock b/Gemfile.lock index 40e517274..e2f46878b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -69,7 +69,7 @@ GEM bootstrap-sass (3.3.7) autoprefixer-rails (>= 5.2.1) sass (>= 3.3.4) - bootstrap-switch-rails (3.3.4) + bootstrap-switch-rails (3.3.3) buftok (0.2.0) builder (3.2.3) byebug (10.0.2) @@ -771,7 +771,7 @@ DEPENDENCIES asset_sync (= 2.5.0) autoprefixer-rails (= 8.6.5) bootstrap-sass (= 3.3.7) - bootstrap-switch-rails (= 3.3.4) + bootstrap-switch-rails (= 3.3.3) capybara (= 3.11.1) carrierwave (= 1.2.3) compass-rails (= 3.1.0)