Merge pull request #6948 from svbergerem/fix-photos-page
Fix other user's profile photos stream
This commit is contained in:
commit
2afb0b95ff
6 changed files with 41 additions and 27 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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,13 +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._loadContacts();
|
||||
this.renderPage(function() {
|
||||
return new app.pages.Profile({
|
||||
person_id: guid,
|
||||
|
|
@ -145,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});
|
||||
|
|
@ -169,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")
|
||||
|
|
@ -178,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");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue