Commit f3e897ab authored by Steffen van Bergerem's avatar Steffen van Bergerem Committed by Jonne Haß

Activate hovercards for logged out users

closes #6603
parent 40ff47f8
......@@ -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
......
......@@ -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();
......
......@@ -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]
......
......@@ -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
......@@ -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();
});
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment