hr_lite 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a85f50e1151c664825892bd973f34842d1330e4878e39bb4984233880258c446
4
- data.tar.gz: 95012fa0d0b7332e35e1fdef90ace239a95b415cbdc9d3101cb86fac18de9f7c
3
+ metadata.gz: 5b975162e55e723ed0bd24a9e032eba889d18e89c106ce55fc051a8566ce41e0
4
+ data.tar.gz: 2a0bd3e239011f037e300f26f3e8d18e3fb9a4fe7ca17b1317e70d3318a93844
5
5
  SHA512:
6
- metadata.gz: 6b532c9f0fe3b5408eea1e847c40329ab28da2a4c996d7cb229d1d745187fe33b5ace2fb17b8d1ea1ec1fc2e326cfc91dfd8881d296197a9d80bb40ded90a6f2
7
- data.tar.gz: 64dfd72f81d71bd48ce01a4815c95360994dfb6b06235933ba893bb8245bdf4bd79ab384d7f7ca441fcec3ab158861c73d9bf8485b2478811e7df90d67443bb9
6
+ metadata.gz: 2405b7818d6a8028375fb614ec0d187faf01088996e8d0754b3e7882ebc4adb2846cd4bf026de0aba86504c63264a8cdbbaaad740b610ce12661718581b45e04
7
+ data.tar.gz: 632fc1794614fa739375e0fe1a4c8b55195f9a51e7b4d5d74f65eadafc157f14b8e391eb7846c84a299634f1fd1e6f5abe64e5b18c253fa0ad276ce495da2c43
data/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.1] - 2026-07-19
11
+
12
+ ### Added
13
+
14
+ - Email-invite onboarding: leave the starting password blank and the
15
+ welcome email carries a set-your-password link from the host's
16
+ `invite_url_for` hook; `Notifications.publish`/`EventMailer.event`
17
+ accept an absolute `link_url` for tokenized URLs. (Intended for 0.2.0;
18
+ missed the merge window.)
19
+
10
20
  ## [0.2.0] - 2026-07-19
11
21
 
12
22
  ### Added
@@ -36,11 +36,14 @@ module HrLite
36
36
 
37
37
  if @profile.save
38
38
  if new_login
39
+ invite_url = HrLite.config.invite_url_for&.call(@profile.user)
39
40
  Notifications.publish(
40
41
  "employee.onboarded",
41
42
  title: "Welcome aboard — your HR account is ready",
42
- body: "Sign in with your email; your manager has your starting password.",
43
+ body: invite_url ? "Set your password with the button below, then sign in with your email."
44
+ : "Sign in with your email; your manager has your starting password.",
43
45
  path: "/",
46
+ link_url: invite_url,
44
47
  bell_to: [ @profile.user ],
45
48
  email_to: [ @profile.user ]
46
49
  )
@@ -3,11 +3,11 @@ module HrLite
3
3
  # body, detail lines, diff table) is assembled by the Notifications bus so
4
4
  # adding an event never means adding a template.
5
5
  class EventMailer < ApplicationMailer
6
- def event(to:, subject:, heading:, body: nil, lines: [], path: nil)
6
+ def event(to:, subject:, heading:, body: nil, lines: [], path: nil, link_url: nil)
7
7
  @heading = heading
8
8
  @body = body
9
9
  @lines = Array(lines)
10
- @cta_url = HrLite::EventMailer.link_for(path)
10
+ @cta_url = link_url.presence || HrLite::EventMailer.link_for(path)
11
11
  mail(to: to, from: HrLite.config.mailer_from, subject: subject)
12
12
  end
13
13
 
@@ -21,8 +21,10 @@
21
21
  <%= f.email_field :new_user_email %>
22
22
  </div>
23
23
  <div class="hrl-field">
24
- <%= f.label :new_user_password, "Starting password (share it with them; they can change it later)" %>
24
+ <%= f.label :new_user_password, "Starting password (optional)" %>
25
25
  <%= f.text_field :new_user_password %>
26
+ <p class="hrl-hint">Leave blank (recommended): they get an email invite and set their own
27
+ password. Fill it only if you want to hand a password over yourself.</p>
26
28
  </div>
27
29
  </fieldset>
28
30
  <% end %>
@@ -9,7 +9,7 @@ module HrLite
9
9
  :time_zone, :currency_symbol, :on_designation_change,
10
10
  :leadership_emails, :leadership_check, :extra_stylesheets,
11
11
  :mailer_from, :public_url_base, :notification_matrix, :back_link,
12
- :onboard_user, :offboard_user
12
+ :onboard_user, :offboard_user, :invite_url_for
13
13
 
14
14
  # 0.1.0 pre-release name for public_url_base; kept as an alias so early
15
15
  # adopters' initializers don't break.
@@ -58,6 +58,10 @@ module HrLite
58
58
  klass.create!(attributes)
59
59
  }
60
60
  @offboard_user = ->(user) { }
61
+ # Optional: return an absolute set-your-password URL for a freshly
62
+ # onboarded user (e.g. a Devise reset link). When present, the welcome
63
+ # email carries it and leadership never needs to hand over a password.
64
+ @invite_url_for = nil
61
65
  end
62
66
  end
63
67
 
@@ -37,7 +37,7 @@ module HrLite
37
37
  HrLite.config.notification_matrix || DEFAULT_MATRIX
38
38
  end
39
39
 
40
- def publish(event, title:, body: nil, path: nil, bell_to: [], email_to: [], lines: [], diff: nil)
40
+ def publish(event, title:, body: nil, path: nil, bell_to: [], email_to: [], lines: [], diff: nil, link_url: nil)
41
41
  row = matrix[event.to_s]
42
42
  unless row
43
43
  Rails.logger.warn("[hr_lite] unknown notification event #{event}")
@@ -45,7 +45,7 @@ module HrLite
45
45
  end
46
46
 
47
47
  deliver_bells(event, row, bell_to, title, body, path)
48
- deliver_emails(row, email_to, title, body, path, lines)
48
+ deliver_emails(row, email_to, title, body, path, lines, link_url)
49
49
  deliver_leadership_email(event, row, title, body, path, lines, diff)
50
50
  deliver_leadership_bells(event, row, bell_to, title, body, path)
51
51
  nil
@@ -61,14 +61,15 @@ module HrLite
61
61
  end
62
62
  end
63
63
 
64
- def deliver_emails(row, email_to, title, body, path, lines)
64
+ def deliver_emails(row, email_to, title, body, path, lines, link_url = nil)
65
65
  return unless row[:email]
66
66
 
67
67
  Array(email_to).compact.uniq.each do |user|
68
68
  next if user.email.blank?
69
69
 
70
70
  EventMailer.event(to: user.email, subject: title, heading: title,
71
- body: body, lines: lines, path: path).deliver_later
71
+ body: body, lines: lines, path: path,
72
+ link_url: link_url).deliver_later
72
73
  end
73
74
  rescue => e
74
75
  Rails.logger.error("[hr_lite] event email failed: #{e.class}: #{e.message}")
@@ -1,3 +1,3 @@
1
1
  module HrLite
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hr_lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kshitiz sinha