diff --git a/Changelog.md b/Changelog.md index 7026b59f3..2dc8fd054 100644 --- a/Changelog.md +++ b/Changelog.md @@ -118,6 +118,7 @@ by them self. * Fix mobile buttons are only clickable when scrolled to the top. [#4102](https://github.com/diaspora/diaspora/issues/4102) * Fix regression in bookmarklet causing uneditable post contents. [#4057](https://github.com/diaspora/diaspora/issues/4057) * Redirect all mixed case tags to the lower case equivalents [#4058](https://github.com/diaspora/diaspora/issues/4058) +* Fix wrong message on infinite scroll on contacts page [#3681](https://github.com/diaspora/diaspora/issues/3681) ## Features diff --git a/app/assets/javascripts/pages/contacts-index.js b/app/assets/javascripts/pages/contacts-index.js index 2f4dd6071..c570dfd6c 100644 --- a/app/assets/javascripts/pages/contacts-index.js +++ b/app/assets/javascripts/pages/contacts-index.js @@ -2,7 +2,8 @@ Diaspora.Pages.ContactsIndex = function() { var self = this; this.subscribe("page/ready", function(evt, document) { - self.infiniteScroll = self.instantiate("InfiniteScroll"); + self.infiniteScroll = self.instantiate("InfiniteScroll", + {donetext: Diaspora.I18n.t("infinite_scroll.no_more_contacts"),}); $('.conversation_button').tooltip({placement: 'bottom'}); }); diff --git a/app/assets/javascripts/widgets/infinite-scroll.js b/app/assets/javascripts/widgets/infinite-scroll.js index 38b826a91..dbf78b937 100644 --- a/app/assets/javascripts/widgets/infinite-scroll.js +++ b/app/assets/javascripts/widgets/infinite-scroll.js @@ -27,7 +27,8 @@ } }; - this.subscribe("widget/ready", function() { + this.subscribe("widget/ready", function(evt, opts) { + $.extend(self.options, opts); if($('#main_stream').length !== 0) { $('#main_stream').infinitescroll(self.options, function(newElements) { self.globalPublish("stream/scrolled", newElements); diff --git a/config/locales/javascript/javascript.en.yml b/config/locales/javascript/javascript.en.yml index 5fd479aca..44e6f0e42 100644 --- a/config/locales/javascript/javascript.en.yml +++ b/config/locales/javascript/javascript.en.yml @@ -43,6 +43,7 @@ en: public: "Public - your post will be visible to everyone and found by search engines" infinite_scroll: no_more: "No more posts." + no_more_contacts: "No more contacts." aspect_dropdown: add_to_aspect: "Add contact" select_aspects: "Select aspects" diff --git a/spec/javascripts/app/views/stream_view_spec.js b/spec/javascripts/app/views/stream_view_spec.js index b0a696274..dac66b2fc 100644 --- a/spec/javascripts/app/views/stream_view_spec.js +++ b/spec/javascripts/app/views/stream_view_spec.js @@ -39,21 +39,39 @@ describe("app.views.Stream", function() { describe("infScroll", function() { // NOTE: inf scroll happens at 500px - - it("fetches moar when the user is at the bottom of the page", function() { + beforeEach(function(){ spyOn($.fn, "height").andReturn(0); spyOn($.fn, "scrollTop").andReturn(100); spyOn(this.view.model, "fetch"); + }); + + it("fetches moar when the user is at the bottom of the page", function() { this.view.infScroll(); waitsFor(function(){ return this.view.model.fetch.wasCalled - }, "the infinite scroll function didn't fetch the stream") + }, "the infinite scroll function didn't fetch the stream"); runs(function(){ expect(this.view.model.fetch).toHaveBeenCalled() - }) + }); + }); + + it("shows the loader while fetching new posts", function() { + spyOn(this.view, "showLoader"); + this.view.infScroll(); + + expect(this.view.showLoader).toHaveBeenCalled(); + }); + + + it("doesnt try to fetch more content if already fetched all", function() { + spyOn($.fn, "unbind"); + + this.stream.trigger("allItemsLoaded", this.view); + + expect($.fn.unbind).toHaveBeenCalledWith("scroll"); }); });