Skip to content

Commit

Permalink
feature flag hand_off_reminders
Browse files Browse the repository at this point in the history
  • Loading branch information
marcdel committed Aug 23, 2024
1 parent 2ada88a commit b3e407e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/pears.ex
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,11 @@ defmodule Pears do
@decorate trace("pears.send_hand_off_reminder", include: [:team])
defp send_hand_off_reminder(team_record) do
with {:ok, team} <- TeamSession.find_or_start_session(team_record.name),
true <- FeatureFlags.enabled?(:hand_off_reminders, for: team),
{:ok, snapshot} <- Persistence.get_latest_snapshot(team.name),
true <- is_snapshot_from_today(snapshot),
matches <- Team.misaligned_tz_matches(team) do
Enum.each(matches, fn pears ->
Slack.send_hand_off_reminder(team, pears)
end)
Enum.each(matches, fn pears -> Slack.send_hand_off_reminder(team, pears) end)
end
end

Expand Down
2 changes: 2 additions & 0 deletions test/pears_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ defmodule PearsTest do

describe "hand off reminders" do
setup do
FeatureFlags.enable(:hand_off_reminders)

MockSlackClient
|> stub(:retrieve_access_tokens, fn _code, _url -> SlackFixtures.valid_token_response() end)
|> stub(:channels, fn _, _ -> SlackFixtures.channels_response() end)
Expand Down

0 comments on commit b3e407e

Please sign in to comment.