mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 22:15:14 +00:00
demote old slack email when signing in (#802)
* demote old slack email when signing in * linting
This commit is contained in:
parent
5504815ee3
commit
ceb7a690d0
2 changed files with 4 additions and 2 deletions
|
|
@ -481,7 +481,6 @@ class User < ApplicationRecord
|
|||
|
||||
email = profile["email"]&.downcase
|
||||
email_address = EmailAddress.find_or_initialize_by(email: email)
|
||||
email_address.source ||= :slack
|
||||
user = email_address.user
|
||||
user ||= begin
|
||||
u = User.find_or_initialize_by(slack_uid: data.dig("authed_user", "id"))
|
||||
|
|
@ -491,6 +490,9 @@ class User < ApplicationRecord
|
|||
u
|
||||
end
|
||||
|
||||
user.email_addresses.source_slack.where.not(email: email).update_all(source: :signing_in)
|
||||
email_address.source = :slack
|
||||
|
||||
user.slack_uid = data.dig("authed_user", "id")
|
||||
user.slack_username = profile["display_name_normalized"].presence
|
||||
user.slack_username ||= profile["real_name_normalized"].presence
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
</ul>
|
||||
|
||||
<hr class="my-2 border-gray-700">
|
||||
|
||||
|
||||
<div class="flex flex-col gap-2 mt-2">
|
||||
<label class="flex items-center justify-between">Start:
|
||||
<input type="date" class="ml-2 py-1 px-2 bg-[#181b20] border border-gray-700 rounded" id="custom-start" value="<%= params[:from] %>">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue