diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb index 3826515d22772eaa2c3f4c3a0cd35a6a077d6687..b5b0446b43fa12a670cc51fe660e930744012992 100644 --- a/app/controllers/projects/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -5,7 +5,7 @@ class Projects::NotesController < Projects::ApplicationController before_filter :authorize_admin_note!, only: [:update, :destroy] def index - current_fetched_at = Time.now + current_fetched_at = Time.now.to_i @notes = NotesFinder.new.execute(project, current_user, params) notes_json = { notes: [], last_fetched_at: current_fetched_at } diff --git a/app/finders/notes_finder.rb b/app/finders/notes_finder.rb index 38d78f3a2d5d9984c2dbacac85ad74fd1d37dbf3..0b9affb716cc8c97259e80f574993644adf8241f 100644 --- a/app/finders/notes_finder.rb +++ b/app/finders/notes_finder.rb @@ -4,7 +4,7 @@ class NotesFinder def execute(project, current_user, params) target_type = params[:target_type] target_id = params[:target_id] - last_fetched_at = params.fetch(:last_fetched_at) + last_fetched_at = Time.at(params.fetch(:last_fetched_at).to_i) notes = case target_type when "commit" diff --git a/app/views/projects/notes/_notes_with_form.html.haml b/app/views/projects/notes/_notes_with_form.html.haml index bdcecd8a39a4982546af6ca4d137284a46a4e88d..052661962e43bf145742c8ff16d2ca91bde20d7e 100644 --- a/app/views/projects/notes/_notes_with_form.html.haml +++ b/app/views/projects/notes/_notes_with_form.html.haml @@ -7,4 +7,4 @@ = render "projects/notes/form" :javascript - new Notes("#{project_notes_path(target_id: @noteable.id, target_type: @noteable.class.name.underscore)}", #{@notes.map(&:id).to_json}, Time.now) + new Notes("#{project_notes_path(target_id: @noteable.id, target_type: @noteable.class.name.underscore)}", #{@notes.map(&:id).to_json}, #{Time.now.to_i}) diff --git a/spec/finders/notes_finder_spec.rb b/spec/finders/notes_finder_spec.rb index 80d6a36c311ffd664120b9f97a3fb03d41db02ce..4f8a5f909df1207545e28be2e1296b77b0e54a85 100644 --- a/spec/finders/notes_finder_spec.rb +++ b/spec/finders/notes_finder_spec.rb @@ -12,7 +12,7 @@ describe NotesFinder do end describe :execute do - let(:params) { { target_id: commit.id, target_type: 'commit', last_fetched_at: 1.hour.ago } } + let(:params) { { target_id: commit.id, target_type: 'commit', last_fetched_at: 1.hour.ago.to_i } } before do note1