diff --git a/Changelog.md b/Changelog.md index 3fed23c44..5de9675d0 100644 --- a/Changelog.md +++ b/Changelog.md @@ -33,6 +33,7 @@ Note: Although this is a minor release, the configuration file changed because t * Fix duplicate flash message on mobile profile edit [#7107](https://github.com/diaspora/diaspora/pull/7107) * Clicking photos on mobile should no longer cause 404s [#7071](https://github.com/diaspora/diaspora/pull/7071) * Fix avatar size on mobile privacy page for ignored people [#7148](https://github.com/diaspora/diaspora/pull/7148) +* Don't display tag following button when logged out [#7155](https://github.com/diaspora/diaspora/pull/7155) ## 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/router.js b/app/assets/javascripts/app/router.js index cda3ec98d..1884bb880 100644 --- a/app/assets/javascripts/app/router.js +++ b/app/assets/javascripts/app/router.js @@ -113,10 +113,12 @@ app.Router = Backbone.Router.extend({ app.tagFollowings.reset(gon.preloads.tagFollowings); if (name) { - var followedTagsAction = new app.views.TagFollowingAction( + if (app.currentUser.authenticated()) { + var followedTagsAction = new app.views.TagFollowingAction( {tagText: decodeURIComponent(name).toLowerCase()} - ); - $("#author_info").prepend(followedTagsAction.render().el); + ); + $("#author_info").prepend(followedTagsAction.render().el); + } app.tags = new app.views.Tags({hashtagName: name}); } this._hideInactiveStreamLists(); diff --git a/spec/javascripts/app/router_spec.js b/spec/javascripts/app/router_spec.js index 640441dc3..bafbe5568 100644 --- a/spec/javascripts/app/router_spec.js +++ b/spec/javascripts/app/router_spec.js @@ -26,6 +26,16 @@ describe('app.Router', function () { expect(followed_tags).toHaveBeenCalled(); expect(tag_following_action).toHaveBeenCalledWith({tagText: 'somethingwithcapitalletters'}); }); + + it("does not add the TagFollowingAction if not logged in", function() { + var followedTags = spyOn(app.router, "followed_tags").and.callThrough(); + var tagFollowingAction = spyOn(app.views, "TagFollowingAction"); + logout(); + + app.router.followed_tags("some_tag"); + expect(followedTags).toHaveBeenCalled(); + expect(tagFollowingAction).not.toHaveBeenCalled(); + }); }); describe("when routing to /stream and hiding inactive stream lists", function() {