From 4621c54421444394bd755ae7ff6e77c9fed4d4c3 Mon Sep 17 00:00:00 2001 From: cmrd Senya Date: Mon, 10 Apr 2017 19:12:49 +0300 Subject: [PATCH 1/4] fix a typo --- features/mobile/activity_stream.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/mobile/activity_stream.feature b/features/mobile/activity_stream.feature index 72a444c79..27475abcd 100644 --- a/features/mobile/activity_stream.feature +++ b/features/mobile/activity_stream.feature @@ -1,5 +1,5 @@ @javascript @mobile -Feature: Viewing my activity on the steam mobile page +Feature: Viewing my activity on the stream mobile page In order to navigate Diaspora* As a mobile user I want to view my activity stream From a880de28a8bbf3fd08e043d58d3d2dc8ef58e134 Mon Sep 17 00:00:00 2001 From: cmrd Senya Date: Mon, 10 Apr 2017 21:26:39 +0300 Subject: [PATCH 2/4] Add a cuke for mobile stream page post timestamps --- features/mobile/stream.feature | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 features/mobile/stream.feature diff --git a/features/mobile/stream.feature b/features/mobile/stream.feature new file mode 100644 index 000000000..02301cd47 --- /dev/null +++ b/features/mobile/stream.feature @@ -0,0 +1,16 @@ +@javascript @mobile +Feature: Viewing the main stream mobile page + + Background: + Given following users exist: + | username | + | alice | + | bob | + And a user with username "bob" is connected with "alice" + And "alice@alice.alice" has a public post with text "Hello! I am #newhere" + + Scenario: Show post with correct timestamp + When I sign in as "bob@bob.bob" on the mobile website + And I go to the stream page + Then I should see "Hello! I am #newhere" within ".ltr" + And I should see "less than a minute ago" within "#main_stream" From 87ed561d451c853ff7705f2a7f90df53c8fe30e5 Mon Sep 17 00:00:00 2001 From: cmrd Senya Date: Mon, 10 Apr 2017 18:26:39 +0300 Subject: [PATCH 3/4] bump rails-timeago Here we also set autoDispose to false. This is an option that was introduced sometime after our last bump. Default is true and it disposes timeago object if it is not in DOM. But that is the way we initialize timeago objects, therefore if we have autoDispose=true then they will be disposed before they inserted in DOM. So by using autoDispose=false we enforce previous behavior that worked fine for us. --- Gemfile | 2 +- Gemfile.lock | 6 +++--- app/assets/javascripts/widgets/timeago.js | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 1fb74a0e1..e87d4e833 100644 --- a/Gemfile +++ b/Gemfile @@ -183,8 +183,8 @@ gem "typhoeus", "1.1.2" gem "gon", "6.1.0" gem "hamlit", "2.8.0" gem "mobile-fu", "1.3.1" +gem "rails-timeago", "2.16.0" gem "will_paginate", "3.1.5" -gem "rails-timeago", "2.11.0" # Logging diff --git a/Gemfile.lock b/Gemfile.lock index 3241688a5..6b2899769 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -568,7 +568,7 @@ GEM rails-i18n (4.0.8) i18n (~> 0.7) railties (~> 4.0) - rails-timeago (2.11.0) + rails-timeago (2.16.0) actionpack (>= 3.1) activesupport (>= 3.1) rails_admin (0.8.1) @@ -734,7 +734,7 @@ GEM unf (~> 0.1.0) typhoeus (1.1.2) ethon (>= 0.9.0) - tzinfo (1.2.2) + tzinfo (1.2.3) thread_safe (~> 0.1) uglifier (3.1.2) execjs (>= 0.3.0, < 3) @@ -886,7 +886,7 @@ DEPENDENCIES rails-assets-markdown-it-sup (= 1.0.0)! rails-assets-perfect-scrollbar (= 0.6.16)! rails-i18n (= 4.0.8) - rails-timeago (= 2.11.0) + rails-timeago (= 2.16.0) rails_admin (= 0.8.1) rb-fsevent (= 0.9.8) rb-inotify (= 0.9.8) diff --git a/app/assets/javascripts/widgets/timeago.js b/app/assets/javascripts/widgets/timeago.js index 4d159818f..69d082b7e 100644 --- a/app/assets/javascripts/widgets/timeago.js +++ b/app/assets/javascripts/widgets/timeago.js @@ -26,6 +26,8 @@ } }); } + + $.timeago.settings.autoDispose = false; }); }; })(); From 9e36f0201ce8de0d7cd6f83ffe2a224c6dfd6bd3 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 23 Apr 2017 18:22:06 +0200 Subject: [PATCH 4/4] Initialize timeago only after language is set closes #7419 --- app/assets/javascripts/main.js | 2 +- app/assets/javascripts/mobile/mobile.js | 2 +- app/assets/javascripts/widgets/timeago.js | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index e8840b6dc..c754c5686 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -9,7 +9,7 @@ //= require autosize //= require charcount //= require jquery-placeholder -//= require rails-timeago +//= require jquery.timeago //= require jquery-ui/core //= require jquery-ui/widget //= require jquery-ui/mouse diff --git a/app/assets/javascripts/mobile/mobile.js b/app/assets/javascripts/mobile/mobile.js index c7259edda..f0fb64c39 100644 --- a/app/assets/javascripts/mobile/mobile.js +++ b/app/assets/javascripts/mobile/mobile.js @@ -11,7 +11,7 @@ //= require keycodes //= require jquery.autoSuggest.custom //= require fine-uploader/fine-uploader.core -//= require rails-timeago +//= require jquery.timeago //= require underscore //= require bootstrap //= require diaspora diff --git a/app/assets/javascripts/widgets/timeago.js b/app/assets/javascripts/widgets/timeago.js index 69d082b7e..a0bfd010a 100644 --- a/app/assets/javascripts/widgets/timeago.js +++ b/app/assets/javascripts/widgets/timeago.js @@ -28,6 +28,10 @@ } $.timeago.settings.autoDispose = false; + + $(function() { + $("time[data-time-ago]").timeago(); + }); }); }; })();