diff --git a/app/controllers/advertisement_controller.rb b/app/controllers/advertisement_controller.rb index e884040c62ad5229fb1053cccad9f50b71a1681a..12f2b34f77f88e1d5cf1dcf3b8afc4f967c179e9 100644 --- a/app/controllers/advertisement_controller.rb +++ b/app/controllers/advertisement_controller.rb @@ -197,7 +197,7 @@ class AdvertisementController < ApplicationController if category.nil? category = Category.where(use_for_advertisement: true) end - Post.undeleted.where(last_activity: (Rails.env.development? ? 365 : 7).days.ago..Time.zone.now) + Post.undeleted.where(last_activity: (Rails.env.development? ? 365 : 7).days.ago..DateTime.now) .where(post_type_id: Question.post_type_id) .where(category: category) .where('score > ?', SiteSetting['HotPostsScoreThreshold']) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 527bc7b615495d8f9bab081a5d83669dc19b6c0e..2cc78054b51483849ed15482c51ea543774d9fda 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -115,7 +115,7 @@ class ApplicationController < ActionController::Base end def check_edits_limit!(post) - recent_edits = SuggestedEdit.where(created_at: 24.hours.ago..Time.zone.now, user: current_user) \ + recent_edits = SuggestedEdit.where(created_at: 24.hours.ago..DateTime.now, user: current_user) \ .where('active = TRUE OR accepted = FALSE').count max_edits = SiteSetting[if current_user.privilege?('unrestricted') @@ -232,7 +232,7 @@ class ApplicationController < ActionController::Base end @hot_questions = Rails.cache.fetch("#{RequestContext.community_id}/hot_questions", expires_in: 4.hours) do Rack::MiniProfiler.step 'hot_questions: cache miss' do - Post.undeleted.where(last_activity: (Rails.env.development? ? 365 : 7).days.ago..Time.zone.now) + Post.undeleted.where(last_activity: (Rails.env.development? ? 365 : 7).days.ago..DateTime.now) .where(post_type_id: [Question.post_type_id, Article.post_type_id]) .joins(:category).where(categories: { use_for_hot_posts: true }) .where('score >= ?', SiteSetting['HotPostsScoreThreshold']) diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index c860421acbe25663985e10f22d26e9239392a46e..3356e4b951b4add885e2f4dff8e99fa4762b340a 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -15,7 +15,7 @@ class CommentsController < ApplicationController @comment = Comment.new comment_params.merge(user: current_user) - recent_comments = Comment.where(created_at: 24.hours.ago..Time.zone.now, user: current_user).where \ + recent_comments = Comment.where(created_at: 24.hours.ago..DateTime.now, user: current_user).where \ .not(post: Post.includes(:parent).where(parents_posts: { user_id: current_user.id })) \ .where.not(post: Post.where(user_id: current_user.id)).count max_comments_per_day = SiteSetting[current_user.privilege?('unrestricted') ? 'RL_Comments' : 'RL_NewUserComments'] diff --git a/app/controllers/flags_controller.rb b/app/controllers/flags_controller.rb index b07e521d1b490076e1c748a34239474f214fd719..d1d0575207c04ef0ede307b3eddf9785778fc02f 100644 --- a/app/controllers/flags_controller.rb +++ b/app/controllers/flags_controller.rb @@ -9,7 +9,7 @@ class FlagsController < ApplicationController PostFlagType.find params[:flag_type] end - recent_flags = Flag.where(created_at: 24.hours.ago..Time.zone.now, user: current_user).count + recent_flags = Flag.where(created_at: 24.hours.ago..DateTime.now, user: current_user).count max_flags_per_day = SiteSetting[current_user.privilege?('unrestricted') ? 'RL_Flags' : 'RL_NewUserFlags'] if recent_flags >= max_flags_per_day diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index d2aea372eb459ee27e5aac7564427b511381e229..0486ab3947d63eb905a5cd57d7a08b5df6df638b 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -68,7 +68,7 @@ class PostsController < ApplicationController level_name = @post_type.is_top_level? ? 'TopLevel' : 'SecondLevel' level_type_ids = @post_type.is_top_level? ? top_level_post_types : second_level_post_types - recent_level_posts = Post.where(created_at: 24.hours.ago..Time.zone.now, user: current_user) + recent_level_posts = Post.where(created_at: 24.hours.ago..DateTime.now, user: current_user) .where(post_type_id: level_type_ids).count setting_name = current_user.privilege?('unrestricted') ? "RL_#{level_name}Posts" : "RL_NewUser#{level_name}Posts" max_posts = SiteSetting[setting_name] @@ -230,7 +230,7 @@ class PostsController < ApplicationController return end - if @post.update(closed: false, closed_by: current_user, closed_at: Time.zone.now, + if @post.update(closed: false, closed_by: current_user, closed_at: DateTime.now, last_activity: DateTime.now, last_activity_by: current_user, close_reason: nil, duplicate_post: nil) PostHistory.question_reopened(@post, current_user) diff --git a/app/controllers/suspicious_votes_controller.rb b/app/controllers/suspicious_votes_controller.rb index 7092843a81e11a35706f26dcf94afd9d89f62e01..9189e5af088a95e835efeeab16b3b9191867382a 100644 --- a/app/controllers/suspicious_votes_controller.rb +++ b/app/controllers/suspicious_votes_controller.rb @@ -15,7 +15,7 @@ class SuspiciousVotesController < ApplicationController def investigated @sv = SuspiciousVote.find params[:id] @sv.was_investigated = true - @sv.investigated_at = Time.zone.now + @sv.investigated_at = DateTime.now @sv.investigated_by = current_user.id if @sv.save render json: { status: 'success' } diff --git a/app/controllers/votes_controller.rb b/app/controllers/votes_controller.rb index cad1790c7bc9684b9c2b4dbe4dd7fc6909b3403e..a8c13a7b98263f2113a109f5ab683f52807ebcb3 100644 --- a/app/controllers/votes_controller.rb +++ b/app/controllers/votes_controller.rb @@ -10,7 +10,7 @@ class VotesController < ApplicationController render(json: { status: 'failed', message: 'You may not vote on your own posts.' }, status: :forbidden) && return end - recent_votes = Vote.where(created_at: 24.hours.ago..Time.zone.now, user: current_user) \ + recent_votes = Vote.where(created_at: 24.hours.ago..DateTime.now, user: current_user) \ .where.not(post: Post.includes(:parent).where(parents_posts: { user_id: current_user.id })).count max_votes_per_day = SiteSetting[current_user.privilege?('unrestricted') ? 'RL_Votes' : 'RL_NewUserVotes']