diff --git a/Changelog.md b/Changelog.md index 50732375df7f86d8450f530bb0a5addc84546faf..258696f321d6583921e8a4c90d1daff5e534f5b4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -12,6 +12,8 @@ * Closed accounts will no longer show up in the account search [#7042](https://github.com/diaspora/diaspora/pull/7042) * Code blocks in conversations no longer overflow the content [#7055](https://github.com/diaspora/diaspora/pull/7055) * More buttons in mobile streams are fixed [#7036](https://github.com/diaspora/diaspora/pull/7036) +* Fixed missing sidebar background in the contacts tab [#7064](https://github.com/diaspora/diaspora/pull/7064) +* Fix tags URLs in hovercards [#7075](https://github.com/diaspora/diaspora/pull/7075) ## Features * Deleted comments will be removed when loading more comments [#7045](https://github.com/diaspora/diaspora/pull/7045) diff --git a/app/assets/javascripts/app/views/hovercard_view.js b/app/assets/javascripts/app/views/hovercard_view.js index 93f9ffa6232a750b7bc421c8e9aab1cc585a0abe..1013225baf7eaf534af8b8e99111075b11ad26ab 100644 --- a/app/assets/javascripts/app/views/hovercard_view.js +++ b/app/assets/javascripts/app/views/hovercard_view.js @@ -130,7 +130,7 @@ app.views.Hovercard = app.views.Base.extend({ // set hashtags this.hashtags.empty(); this.hashtags.html($(_.map(person.profile.tags, function(tag) { - return $("<a/>", {href: "/tags/" + tag.substring(1)}).text(tag)[0]; + return $("<a/>", {href: Routes.tag(tag)}).text("#" + tag)[0]; }))); } }, diff --git a/features/desktop/hovercards.feature b/features/desktop/hovercards.feature index 9c510ab0dcea6cdf6d1d2345d1a66a57a1c1bb81..a1061ea4f71f8c1147c56a80831e172c502a025b 100644 --- a/features/desktop/hovercards.feature +++ b/features/desktop/hovercards.feature @@ -39,3 +39,13 @@ Feature: Hovercards Then I should see a hovercard When I deactivate the first hovercard Then I should not see a hovercard + + Scenario: Hovercards contain profile tags + Given a user with email "bob@bob.bob" is tagged "#first #second" + And I sign in as "alice@alice.alice" + And I am on "bob@bob.bob"'s page + Then I should see "public stuff" within ".stream_element" + When I activate the first hovercard + Then I should see a hovercard + And I should see "#first" hashtag in the hovercard + And I should see "#second" hashtag in the hovercard diff --git a/features/step_definitions/hovercard_steps.rb b/features/step_definitions/hovercard_steps.rb index c76e481e7e4288ba9c7594295761ff050fcd2e6d..cfe38cecfb98cc18bd262b81d506571173fab717 100644 --- a/features/step_definitions/hovercard_steps.rb +++ b/features/step_definitions/hovercard_steps.rb @@ -6,6 +6,11 @@ Then(/^I should see a hovercard$/) do page.should have_css('#hovercard', visible: true) end +Then(/^I should see "([^"]*)" hashtag in the hovercard$/) do |tag| + element = find("#hovercard .hashtags a", text: tag) + expect(element["href"]).to include("/tags/#{tag.slice(1, tag.length)}") +end + When(/^I deactivate the first hovercard$/) do page.execute_script("$('.hovercardable').first().trigger('mouseleave');") end diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index ed1abe5f14dd0fc63ef69f6a06876fffc377cc1c..0bad1d6181e21a73f8416cd897c5e10d8638fdde 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -100,6 +100,13 @@ Given /^there is a user "([^\"]*)" who's tagged "([^\"]*)"$/ do |full_name, tag| user.profile.save! end +Given /^a user with email "([^\"]*)" is tagged "([^\"]*)"$/ do |email, tags| + user = User.find_by_email(email) + user.profile.tag_string = tags + user.profile.build_tags + user.profile.save! +end + Given /^many posts from alice for bob$/ do alice = FactoryGirl.create(:user_with_aspect, :username => 'alice', :email => 'alice@alice.alice', :password => 'password', :getting_started => false) bob = FactoryGirl.create(:user_with_aspect, :username => 'bob', :email => 'bob@bob.bob', :password => 'password', :getting_started => false) diff --git a/spec/javascripts/app/views/hovercard_view_spec.js b/spec/javascripts/app/views/hovercard_view_spec.js index 1bcbe8444481ccff13287b4ef8ef6a3056740eaf..c307ebceee3fcdd5058f624917805f9454536fbb 100644 --- a/spec/javascripts/app/views/hovercard_view_spec.js +++ b/spec/javascripts/app/views/hovercard_view_spec.js @@ -42,15 +42,17 @@ describe("app.views.Hovercard", function() { }); describe("_populateHovercard", function() { + beforeEach(function() { + this.view.parent = spec.content(); + }); + it("prevents global error handling for the ajax call", function() { spyOn(jQuery, "ajax").and.callThrough(); - this.view.parent = spec.content(); this.view._populateHovercard(); expect(jQuery.ajax).toHaveBeenCalledWith("undefined/hovercard.json", {preventGlobalErrorHandling: true}); }); it("creates the aspect dropdown", function() { - this.view.parent = spec.content(); this.view._populateHovercard(); jasmine.Ajax.requests.mostRecent().respondWith({ status: 200, @@ -58,6 +60,21 @@ describe("app.views.Hovercard", function() { }); expect(this.view.aspectMembershipDropdown).not.toEqual(undefined); }); + + it("renders tags properly", function() { + this.view._populateHovercard(); + jasmine.Ajax.requests.mostRecent().respondWith({ + status: 200, + responseText: JSON.stringify({id: 1337, profile: {tags: ["first", "second"]}}) + }); + + var first = this.view.hashtags.find("a:contains('#first')"); + var second = this.view.hashtags.find("a:contains('#second')"); + expect(first.length).toEqual(1); + expect(second.length).toEqual(1); + expect(first.first()[0].href).toContain(Routes.tag("first")); + expect(second.first()[0].href).toContain(Routes.tag("second")); + }); }); }); });