[openstreetmap/openstreetmap-website] Don't update deactivates_at if block was already viewed (PR #5312)

Anton Khorev notifications at github.com
Tue Nov 12 22:44:14 UTC 2024


@AntonKhorev commented on this pull request.



> +      get user_block_path(block)
+      assert_response :success
+      block.reload
+      assert_not block.needs_view
+      assert_equal Time.now.utc - 1.hour, block.deactivates_at
+    end
+  end
+
+  ##
+  # test clearing needs_view by showing a timed block to the blocked user
+  def test_show_sets_deactivates_at_for_timed_block
+    user = create(:user)
+    session_for(user)
+
+    freeze_time do
+      block = create(:user_block, :needs_view, :created_at => Time.now.utc, :ends_at => Time.now.utc + 1.day, :user => user)

updated, but if it's actually an issue, `test/factories/user_blocks.rb` still uses days

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5312#discussion_r1838884712
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5312/review/2430873400 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20241112/9d0831c2/attachment-0001.htm>


More information about the rails-dev mailing list