FIX: topic timer offset applied two times

timezone offset was calculated and sent from browser to server, it would be applied on utc time generated from '2013-11-22 5:00' format for example and then sent back to browser which would display it thinking it's UTC time using `moment(utc time)` when it's in fact an UTC time we have offseted with the initial user timezone.

This is impossible to automatically test in the current app state. Easiest reproduction is in live browser after setting your timezone to `America/New_York`, when setting a topic timer to later_today, after save, the time under the topic should be off to something roughly equal +1/-1  hour to your timezone offset.
This commit is contained in:
Joffrey JAFFEUX
2017-12-07 14:42:58 +01:00
committed by GitHub
parent eda30c4cf2
commit f0ef307d2d
4 changed files with 3 additions and 25 deletions

View File

@ -287,7 +287,7 @@ class TopicsController < ApplicationController
end
def timer
params.permit(:time, :timezone_offset, :based_on_last_post, :category_id)
params.permit(:time, :based_on_last_post, :category_id)
params.require(:status_type)
status_type =
@ -302,7 +302,6 @@ class TopicsController < ApplicationController
options = {
by_user: current_user,
timezone_offset: params[:timezone_offset]&.to_i,
based_on_last_post: params[:based_on_last_post]
}