demote old slack email when signing in (#802)

* demote old slack email when signing in

* linting
This commit is contained in:
Echo 2026-01-19 02:04:58 -05:00 committed by GitHub
parent 5504815ee3
commit ceb7a690d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -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

View file

@ -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] %>">