Per User TimeZone settings #362

Open
alias1 opened this Issue Jun 2, 2014 · 8 comments

Projects

None yet

4 participants

Collaborator
alias1 commented Jun 2, 2014

It would be good to be able to setup timezone preferences on a user/account level rather than Huginn-wide (though obviously that can still control the default)

Running a 6pm on a server configured for a different timezone becomes a bit of a mindbend.

Owner
cantino commented Jun 3, 2014

Good idea.

We'll need it to get set anywhere we're doing code. For the Rails portions, an around_filter in the application controller should probably work:

class ApplicationController < ActionController::Base
  around_filter :set_time_zone

  def set_time_zone
    if logged_in?
      Time.use_zone(current_user.time_zone) { yield }
    else
      yield
    end
  end
end

Other portions (like scheduler) will need to handle this themselves.

Collaborator
alias1 commented Jun 3, 2014
  • I'm guessing user.time_zone doesn't currently exist either? So would need a migration for that.
  • Also a view update to change timezone on the account page (/users/edit) (is there an easy way to list all possible timezones in a dropdown?)
  • The updates to scheduler/etc

Anything else?

Collaborator
dsander commented Jun 3, 2014

@alias1 yep there is the time_zone_select helper.
We probably could change the TZ of the scheduler to UTC and convert users timezone to UTC in the controller right?

Collaborator
alias1 commented Jun 3, 2014

That could be a good idea. I was actually thinking along the lines of maybe UTC should be default or whatnot.

But you currently set the instance default in config yeah? Would that change to just setting the default for new users?

Sent from Mailbox

On Wed, Jun 4, 2014 at 3:06 AM, Dominik Sander notifications@github.com
wrote:

@alias1 yep there is the time_zone_select helper.

We probably could change the TZ of the scheduler to UTC and convert users timezone to UTC in the controller right?

Reply to this email directly or view it on GitHub:
#362 (comment)

Collaborator
dsander commented Jun 3, 2014

Yeah, actually I do not know the details about this part of huginn yet, but you might be right, the migration could be hard/impossible without manual changes.

Collaborator
alias1 commented Jun 4, 2014

Migrations should have access to env variables I would think? If so, then read the .env TZ, use that to set all of the users TZ (which they can later change from account settings), and then use the .env TZ as the default for any new users (or, move that setting to an admin panel, see below)

Only a similar strain of thought, I wonder if we can/should look at moving some of the things currently configured by .env into an 'admin panel' configuration inside Huginn itself (obviously only things that aren't required to run Huginn itself; the invite code comes to mind, that is only used to set the DB during install isn't it?)

Owner
cantino commented Jun 4, 2014

Migrating some things into Huginn makes sense. Right now we don't have an "admin interface" for admin users. Everyone is just a user. For now, your idea of pulling in the timezone on migration, then allowing editing in a user's settings page makes sense to me.

@alias1 alias1 added this to the Admin Panel/Configuration milestone Jul 30, 2014
Contributor

Rather than per user, why not storing everything in UTC and using the browser client time zone to set the times to the user?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment