From 5764c36b32062682eec445970ffecc3f838b773c Mon Sep 17 00:00:00 2001 From: Yuki Date: Thu, 23 Apr 2015 06:48:17 +0530 Subject: [PATCH] DateTime.now -> DateTime.current --- Rakefile | 10 +++++----- app/models/user.rb | 2 +- app/views/user/_modal_ban.html.haml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Rakefile b/Rakefile index 8312e199..32b1647b 100644 --- a/Rakefile +++ b/Rakefile @@ -109,7 +109,7 @@ namespace :justask do fail "screen name required" if args[:screen_name].nil? user = User.find_by_screen_name(args[:screen_name]) user.permanently_banned = false - user.banned_until = DateTime.now + 1 + user.banned_until = DateTime.current + 1 user.ban_reason = args[:reason] user.save! puts "#{user.screen_name} got hit by\033[5m YE OLDE BANHAMMER\033[0m!!1!" @@ -120,7 +120,7 @@ namespace :justask do fail "screen name required" if args[:screen_name].nil? user = User.find_by_screen_name(args[:screen_name]) user.permanently_banned = false - user.banned_until = DateTime.now + 7 + user.banned_until = DateTime.current + 7 user.ban_reason = args[:reason] user.save! puts "#{user.screen_name} got hit by\033[5m YE OLDE BANHAMMER\033[0m!!1!" @@ -131,7 +131,7 @@ namespace :justask do fail "screen name required" if args[:screen_name].nil? user = User.find_by_screen_name(args[:screen_name]) user.permanently_banned = false - user.banned_until = DateTime.now + 30 + user.banned_until = DateTime.current + 30 user.ban_reason = args[:reason] user.save! puts "#{user.screen_name} got hit by\033[5m YE OLDE BANHAMMER\033[0m!!1!" @@ -142,7 +142,7 @@ namespace :justask do fail "screen name required" if args[:screen_name].nil? user = User.find_by_screen_name(args[:screen_name]) user.permanently_banned = false - user.banned_until = DateTime.now + 365 + user.banned_until = DateTime.current + 365 user.ban_reason = args[:reason] user.save! puts "#{user.screen_name} got hit by\033[5m YE OLDE BANHAMMER\033[0m!!1!" @@ -153,7 +153,7 @@ namespace :justask do fail "screen name required" if args[:screen_name].nil? user = User.find_by_screen_name(args[:screen_name]) user.permanently_banned = false - user.banned_until = DateTime.now + 365_000_000_000 + user.banned_until = DateTime.current + 365_000_000_000 user.ban_reason = args[:reason] user.save! puts "#{user.screen_name} got hit by\033[5m YE OLDE BANHAMMER\033[0m!!1!" diff --git a/app/models/user.rb b/app/models/user.rb index 9d4eaa2b..0ddc388c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -199,7 +199,7 @@ class User < ActiveRecord::Base # forwards fill def banned? - self.permanently_banned? or ((not self.banned_until.nil?) and self.banned_until > DateTime.now) + self.permanently_banned? or ((not self.banned_until.nil?) and self.banned_until >= DateTime.current) end def unban diff --git a/app/views/user/_modal_ban.html.haml b/app/views/user/_modal_ban.html.haml index 50917c33..2794baf9 100644 --- a/app/views/user/_modal_ban.html.haml +++ b/app/views/user/_modal_ban.html.haml @@ -14,7 +14,7 @@ #ban-controls{style: "#{"display: none" unless @user.banned?}"} = f.check_box :permaban, label: "Permanently?", checked: @user.permanently_banned? #ban-controls-time{style: "#{"display: none" unless not @user.permanently_banned?}"} - = f.datetime_local_field :until, label: "", required: true, value: (@user.banned_until || DateTime.now).strftime("%Y-%m-%dT%H:%M") + = f.datetime_local_field :until, label: "", required: true, value: (@user.banned_until || DateTime.current).strftime("%Y-%m-%dT%H:%M") = f.text_field :reason, placeholder: "Reason", value: @user.ban_reason .modal-footer %button.btn.btn-default{name: 'stop-time', type: :button, data: { dismiss: :modal }} Close