When a user is invited to a project, we associate them to it if they already have an account. If they don't, we send an invitation email. However, this approach often leads to a poor user experience, as the admin must resend the invitation once the user creates an account. To address this, I've implemented a fix that persists the invitation and automatically associates the user to the project upon account creation. I considered creating a temporary account in the existing accounts table with a different status ID, but this would require extensive Rodauth overrides. Therefore, I chose not to include non-existing users in the accounts table, which serves as the backbone of our authentication system. Another alternative could involve not automatically associating the user to the project upon account creation. Instead, users could explicitly accept the invitation post-account creation. However, I found no compelling reason to avoid automatic project-user association.
10 lines
170 B
Ruby
10 lines
170 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "../model"
|
|
|
|
class ProjectInvitation < Sequel::Model
|
|
many_to_one :project
|
|
end
|
|
|
|
ProjectInvitation.unrestrict_primary_key
|