FEATURE: Add timezone to core user_options (#8380)

* Add timezone to user_options table

* Also migrate existing timezone values from UserCustomField,
  which is where the discourse-calendar plugin is storing them

* Allow user to change their core timezone from Profile

* Auto guess & set timezone on login & invite accept & signup

* Serialize user_options.timezone for group members. this is so discourse-group-timezones can access the core user timezone, as it is being removed in discourse-calendar.

* Annotate user_option with timezone

* Validate timezone values
This commit is contained in:
Martin Brennan
2019-11-25 10:49:27 +10:00
committed by GitHub
parent 43ddf60cdf
commit afb5533581
24 changed files with 215 additions and 13 deletions

View File

@@ -290,6 +290,16 @@ describe InvitesController do
expect(json["success"]).to eq(true)
expect(json["redirect_to"]).to eq(topic.relative_url)
end
context "if a timezone guess is provided" do
it "sets the timezone of the user in user_options" do
put "/invites/show/#{invite.invite_key}.json", params: { timezone: "Australia/Melbourne" }
expect(response.status).to eq(200)
invite.reload
user = User.find(invite.user_id)
expect(user.user_option.timezone).to eq("Australia/Melbourne")
end
end
end
context 'failure' do