diff --git a/Changelog.md b/Changelog.md index f209f66f6e4c14e13553755c91a55c27b78e6e7a..4caed69b87022b363bc7270b5c737886472fcbe3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,6 +11,8 @@ ## Features +Display hovercards without aspect dropdown when logged out [#6603](https://github.com/diaspora/diaspora/pull/6603) + # 0.5.5.1 * Fix XSS on profile pages diff --git a/app/assets/javascripts/app/views/hovercard_view.js b/app/assets/javascripts/app/views/hovercard_view.js index 0829849311b0d2a46fe231ea8c55dcd035060aed..2389521548763a7f4ee238df3a8edfeb3002c7e9 100644 --- a/app/assets/javascripts/app/views/hovercard_view.js +++ b/app/assets/javascripts/app/views/hovercard_view.js @@ -25,7 +25,7 @@ app.views.Hovercard = app.views.Base.extend({ this.hashtags = this.$('.hashtags'); this.person_link = this.$('a.person'); this.person_handle = this.$('div.handle'); - this.active = app.currentUser.authenticated(); + this.active = true; }, postRenderTemplate: function() { @@ -126,6 +126,7 @@ app.views.Hovercard = app.views.Base.extend({ return $('<a/>',{href: "/tags/"+tag.substring(1)}).text(tag)[0] ; })) ); + if(!app.currentUser.authenticated()){ return; } // set aspect dropdown // TODO render me client side!!! var href = this.href(); diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index b2343d941fc547800d5e865336ce428178bb93f5..154f4337674b9c004f1ff6597b4e1dde597131cd 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -3,8 +3,8 @@ # the COPYRIGHT file. class PeopleController < ApplicationController - before_action :authenticate_user!, except: [:show, :stream] - before_action :find_person, only: [:show, :stream, :hovercard] + before_action :authenticate_user!, except: %i(show stream hovercard) + before_action :find_person, only: %i(show stream hovercard) respond_to :html, :except => [:tag_index] respond_to :json, :only => [:index, :show] diff --git a/features/desktop/hovercards.feature b/features/desktop/hovercards.feature index 77c56903bac3e0be8467122509f559073e3a68aa..9c510ab0dcea6cdf6d1d2345d1a66a57a1c1bb81 100644 --- a/features/desktop/hovercards.feature +++ b/features/desktop/hovercards.feature @@ -6,15 +6,15 @@ Feature: Hovercards Background: Given a user named "Bob Jones" with email "bob@bob.bob" - And "bob@bob.bob" has a public post with text "public stuff" + And "bob@bob.bob" has a public post with text "public stuff #hashtag" And a user named "Alice" with email "alice@alice.alice" And "alice@alice.alice" has a public post with text "alice public stuff" - And the post with text "public stuff" is reshared by "alice@alice.alice" + And the post with text "public stuff #hashtag" is reshared by "alice@alice.alice" And the post with text "alice public stuff" is reshared by "bob@bob.bob" - And I sign in as "alice@alice.alice" Scenario: Hovercards on the main stream - Given I am on "bob@bob.bob"'s page + Given 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 @@ -22,7 +22,8 @@ Feature: Hovercards Then I should not see a hovercard Scenario: Hovercards on the main stream in reshares - Given I am on "bob@bob.bob"'s page + Given I sign in as "alice@alice.alice" + And I am on "bob@bob.bob"'s page Then I should see "Alice" within "#main_stream" When I hover "Alice" within "#main_stream" Then I should not see a hovercard @@ -30,3 +31,11 @@ Feature: Hovercards Then I should see "Bob Jones" within "#main_stream" When I hover "Bob Jones" within "#main_stream" Then I should see a hovercard + + Scenario: Hovercards on the tag stream as a logged out user + Given I am on the tag page for "hashtag" + Then I should see "public stuff" within ".stream_element" + When I activate the first hovercard + Then I should see a hovercard + When I deactivate the first hovercard + Then I should not see a hovercard diff --git a/spec/javascripts/app/views/hovercard_view_spec.js b/spec/javascripts/app/views/hovercard_view_spec.js index 2e8cddee5ee3999ada737f8a40286a0e3cbfa98b..6f7e4c26097b522a445b6d07e91d64c1908a0849 100644 --- a/spec/javascripts/app/views/hovercard_view_spec.js +++ b/spec/javascripts/app/views/hovercard_view_spec.js @@ -5,9 +5,12 @@ describe("app.views.Hovercard", function() { this.view = new app.views.Hovercard(); }); - describe("initialize", function() { - it("deactivates hovercards", function() { - expect(this.view.active).toBeFalsy(); + describe("_populateHovercardWith", function() { + it("doesn't fetch the aspect dropdown", function() { + spyOn(jQuery, "ajax").and.callThrough(); + this.view.parent = spec.content(); + this.view._populateHovercardWith({}); + expect(jQuery.ajax).not.toHaveBeenCalled(); }); }); });