From 020f8c51b4492ac1501cc9c2e654d5db53a6b67c Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Tue, 9 Aug 2016 00:29:04 +0200 Subject: [PATCH 1/2] Fix other user's profile photos stream --- app/assets/javascripts/app/router.js | 1 + features/desktop/profile_photos.feature | 18 ++++++++++-------- features/step_definitions/user_steps.rb | 9 +++++++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/app/router.js b/app/assets/javascripts/app/router.js index 0228358c0..3c78a5725 100644 --- a/app/assets/javascripts/app/router.js +++ b/app/assets/javascripts/app/router.js @@ -114,6 +114,7 @@ app.Router = Backbone.Router.extend({ }, photos : function(guid) { + this._loadRelationshipsPreloads(); this.renderPage(function() { return new app.pages.Profile({ person_id: guid, diff --git a/features/desktop/profile_photos.feature b/features/desktop/profile_photos.feature index 72e45ac36..644b21ecf 100644 --- a/features/desktop/profile_photos.feature +++ b/features/desktop/profile_photos.feature @@ -7,18 +7,11 @@ Feature: show photos | Bob Jones | bob@bob.bob | | Alice Smith | alice@alice.alice | | Robert Grimm | robert@grimm.grimm | + And "robert@grimm.grimm" has posted a status message with a photo And I sign in as "robert@grimm.grimm" - Given I expand the publisher - And I have turned off jQuery effects - And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload" - And I press "Share" - Then I should see a "img" within ".stream_element div.photo_attachments" - Scenario: see my own photos When I am on "robert@grimm.grimm"'s page - #TODO: find out why images don't show on first load - And I am on "robert@grimm.grimm"'s page And I press the first "#photos_link" Then I should be on person_photos page @@ -27,6 +20,15 @@ Feature: show photos And I am on "robert@grimm.grimm"'s page Then I should not see "Photos" within "#profile-horizontal-bar" + Scenario: I can see public photos of people who share with me + When "robert@grimm.grimm" has posted a public status message with a photo + And I sign in as "alice@alice.alice" + And I am on "robert@grimm.grimm"'s page + Then I should see "Photos" within "#profile-horizontal-bar" + When I press the first "#photos_link" + Then I should be on "robert@grimm.grimm"'s photos page + And I should see "Photos" within "#profile-horizontal-bar" + Scenario: I delete a photo When I am on "robert@grimm.grimm"'s photos page Then I should see a ".thumbnail" within "#main_stream" diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index 9074fccb1..45e1ded4c 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -158,9 +158,14 @@ Then /^I should not see "([^\"]*)" in the last sent email$/ do |text| email_text.should_not match(text) end -When /^"([^\"]+)" has posted a status message with a photo$/ do |email| +When /^"([^\"]+)" has posted a (public )?status message with a photo$/ do |email, public_status| user = User.find_for_database_authentication(:username => email) - post = FactoryGirl.create(:status_message_with_photo, :text => "Look at this dog", :author => user.person) + post = FactoryGirl.create( + :status_message_with_photo, + text: "Look at this dog", + author: user.person, + public: public_status.present? + ) [post, post.photos.first].each do |p| user.add_to_streams(p, user.aspects) user.dispatch_post(p) From 09aff306486215fd9126b11ebd7c8cc31ed79a5c Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Tue, 9 Aug 2016 00:55:44 +0200 Subject: [PATCH 2/2] Fix hovercards on profile edit page --- app/assets/javascripts/app/app.js | 5 +++++ app/assets/javascripts/app/router.js | 20 ++++--------------- features/desktop/notifications.feature | 15 +++++++++++++- features/step_definitions/custom_web_steps.rb | 2 +- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/app/assets/javascripts/app/app.js b/app/assets/javascripts/app/app.js index 3e7e3748b..25441a651 100644 --- a/app/assets/javascripts/app/app.js +++ b/app/assets/javascripts/app/app.js @@ -47,6 +47,7 @@ var app = { this.setupDummyPreloads(); this.setupUser(); + this.setupAspects(); this.setupHeader(); this.setupBackboneLinks(); this.setupGlobalViews(); @@ -83,6 +84,10 @@ var app = { app.currentUser = app.user(window.gon.user) || new app.models.User(); }, + setupAspects: function() { + app.aspects = new app.collections.Aspects(app.currentUser.get("aspects")); + }, + setupHeader: function() { if(app.currentUser.authenticated()) { app.header = new app.views.Header(); diff --git a/app/assets/javascripts/app/router.js b/app/assets/javascripts/app/router.js index 3c78a5725..e71480f0e 100644 --- a/app/assets/javascripts/app/router.js +++ b/app/assets/javascripts/app/router.js @@ -62,7 +62,7 @@ app.Router = Backbone.Router.extend({ contacts: function() { app.aspect = new app.models.Aspect(gon.preloads.aspect); - this._loadRelationshipsPreloads(); + this._loadContacts(); var stream = new app.views.ContactStream({ collection: app.contacts, @@ -73,7 +73,6 @@ app.Router = Backbone.Router.extend({ }, gettingStarted: function() { - this._loadAspects(); this.renderPage(function() { return new app.pages.GettingStarted({inviter: new app.models.Person(app.parsePreload("inviter"))}); }); @@ -107,14 +106,13 @@ app.Router = Backbone.Router.extend({ }, stream : function() { - this._loadAspects(); app.stream = new app.models.Stream(); app.stream.fetch(); this._initializeStreamView(); }, photos : function(guid) { - this._loadRelationshipsPreloads(); + this._loadContacts(); this.renderPage(function() { return new app.pages.Profile({ person_id: guid, @@ -146,7 +144,6 @@ app.Router = Backbone.Router.extend({ }, aspects: function() { - this._loadAspects(); app.aspectSelections = app.aspectSelections || new app.collections.AspectSelections(app.currentUser.get("aspects")); this.aspectsList = this.aspectsList || new app.views.AspectsList({collection: app.aspectSelections}); @@ -170,7 +167,7 @@ app.Router = Backbone.Router.extend({ }, profile: function() { - this._loadRelationshipsPreloads(); + this._loadContacts(); this.renderPage(function() { return new app.pages.Profile({ el: $("body > #profile_container") @@ -179,23 +176,14 @@ app.Router = Backbone.Router.extend({ }, pageWithAspectMembershipDropdowns: function() { - this._loadRelationshipsPreloads(); + this._loadContacts(); this.renderAspectMembershipDropdowns($(document)); }, - _loadAspects: function() { - app.aspects = new app.collections.Aspects(app.currentUser.get("aspects")); - }, - _loadContacts: function() { app.contacts = new app.collections.Contacts(app.parsePreload("contacts")); }, - _loadRelationshipsPreloads: function() { - this._loadContacts(); - this._loadAspects(); - }, - renderAspectMembershipDropdowns: function($context) { $context.find(".aspect_membership_dropdown.placeholder").each(function() { var personId = $(this).data("personId"); diff --git a/features/desktop/notifications.feature b/features/desktop/notifications.feature index aedfe0f4e..70a454d61 100644 --- a/features/desktop/notifications.feature +++ b/features/desktop/notifications.feature @@ -118,11 +118,24 @@ Feature: Notifications And I add the person to my "Besties" aspect And I sign out When I sign in as "alice@alice.alice" + And I go to the edit profile page And I follow "Notifications" in the header - And I active the first hovercard after loading the notifications page + And I activate the first hovercard after loading the notifications page When I press the aspect dropdown Then the aspect dropdown should be visible + Scenario: show hovercard in notification dropdown + When I sign in as "bob@bob.bob" + And I am on "alice@alice.alice"'s page + And I add the person to my "Besties" aspect + And I sign out + When I sign in as "alice@alice.alice" + And I follow "Notifications" in the header + Then the notification dropdown should be visible + When I activate the first hovercard after loading the notifications page + And I press the aspect dropdown + Then the aspect dropdown should be visible + Scenario: scrollbar shows up when >5 notifications Given a user with email "bob@bob.bob" is connected with "alice@alice.alice" And Alice has 6 posts mentioning Bob diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index 563ae51ec..6924e53a2 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -324,7 +324,7 @@ Then(/^I should have a validation error on "(.*?)"$/) do |field_list| check_fields_validation_error field_list end -And /^I active the first hovercard after loading the notifications page$/ do +And /^I activate the first hovercard after loading the notifications page$/ do page.should have_css '.notifications .hovercardable' first('.notifications .hovercardable').hover end