Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/hex/oban-2.17.12
Browse files Browse the repository at this point in the history
  • Loading branch information
rgarfield11 authored Dec 2, 2024
2 parents 4d4ebaa + 2e0cdf0 commit 43123f4
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ name: Test
on: push

env:
OTP_VERSION_SPEC: "24.1"
ELIXIR_VERSION_SPEC: "1.12.3"
OTP_VERSION_SPEC: "26.2.4"
ELIXIR_VERSION_SPEC: "1.16.2"
MIX_ENV: test

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 24.1.7
elixir 1.12.3-otp-24
erlang 26.2.4
elixir 1.16.2-otp-26
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Set the Docker image you want to base your image off.
FROM hexpm/elixir:1.12.3-erlang-24.1.7-debian-buster-20210902 as builder
FROM hexpm/elixir:1.16.2-erlang-26.2.4-debian-bullseye-20240423-slim as builder

# Install other stable dependencies that don't change often
RUN apt-get update && \
Expand Down Expand Up @@ -27,7 +27,7 @@ RUN mix do compile, release
# END BUILDER
#

FROM debian:buster-slim
FROM debian:bullseye-slim

RUN apt-get -qq update
RUN apt-get -qq install -y locales locales-all openssl
Expand Down
9 changes: 4 additions & 5 deletions lib/slax/github.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Slax.Github do
@moduledoc """
Functions for working with the Github API
"""

alias Slax.Http
alias Slax.Http.Error
alias Slax.ProjectRepos
Expand Down Expand Up @@ -507,7 +506,7 @@ defmodule Slax.Github do
"""
def load_issue(repo_and_issue) do
with {org, repo, issue} <- parse_repo_org_issue(repo_and_issue),
{token, warning_message} <- retrieve_token(repo),
{token, warning_message} <- retrieve_token(repo, org),
client <- Tentacat.Client.new(%{access_token: token}),
{200, issue, _http_response} <- Issues.find(client, org, repo, issue) do
{:ok, issue, warning_message}
Expand All @@ -531,7 +530,7 @@ defmodule Slax.Github do

def load_pr(repo_and_pr) do
with {org, repo, pr} <- parse_repo_org_issue(repo_and_pr),
{token, warning_message} <- retrieve_token(repo),
{token, warning_message} <- retrieve_token(repo, org),
client <- Tentacat.Client.new(%{access_token: token}),
{200, pr, _http_response} <- Prs.find(client, org, repo, pr) do
{:ok, pr, warning_message}
Expand Down Expand Up @@ -566,8 +565,8 @@ defmodule Slax.Github do
end)
end

defp retrieve_token(repo) do
case ProjectRepos.get_by_repo(repo) do
defp retrieve_token(repo, org) do
case ProjectRepos.get_by_repo_and_org(repo, org) do
%{token: token} when not is_nil(token) ->
{token, ""}

Expand Down
2 changes: 1 addition & 1 deletion lib/slax/poker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ defmodule Slax.Poker do
{org, repo, issue} = Github.parse_repo_org_issue(round.issue)

client =
case ProjectRepos.get_by_repo(repo) do
case ProjectRepos.get_by_repo_and_org(repo, org) do
%{token: token} when not is_nil(token) ->
Tentacat.Client.new(%{access_token: token})

Expand Down
15 changes: 13 additions & 2 deletions lib/slax/projects/project_repos.ex
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,19 @@ defmodule Slax.ProjectRepos do
|> Repo.all()
end

def get_by_repo(repo_name) do
Repo.get_by(ProjectRepo, repo_name: repo_name)
def get_by_repo_and_org(repo_name, org_name) do
lower_repo_name = String.downcase(repo_name)
lower_org_name = String.downcase(org_name)

query =
from(
p in ProjectRepo,
where:
fragment("lower(?)", p.repo_name) == ^lower_repo_name and
fragment("lower(?)", p.org_name) == ^lower_org_name
)

Repo.one(query)
end

def list_needs_reminder_message() do
Expand Down
2 changes: 1 addition & 1 deletion lib/slax_web/websockets/issue.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ defmodule SlaxWeb.Issue do
defp maybe_load_from_default_repo(default_repo, issue_number) do
case default_repo do
nil ->
"No default repo set for this channel"
"Use the format 'org/repo#{issue_number}' or set a default repo for this channel with '/slax'."

_ ->
org_name = default_repo.org_name
Expand Down
2 changes: 1 addition & 1 deletion lib/slax_web/websockets/poker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ defmodule SlaxWeb.Poker do
estimates =
round.estimates
|> Enum.sort_by(& &1.value)
|> Enum.map(&"#{&1.user} (#{&1.value})#{if &1.reason, do: ': #{&1.reason}'}")
|> Enum.map(&"#{&1.user} (#{&1.value})#{if &1.reason, do: ~c": #{&1.reason}"}")

message = "Estimates for round:\n---\n#{Enum.join(estimates, "\n")}"

Expand Down
11 changes: 6 additions & 5 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Slax.Mixfile do
version: "0.0.1",
elixir: "~> 1.6",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix] ++ Mix.compilers(),
compilers: Mix.compilers(),
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
aliases: aliases(),
Expand All @@ -33,10 +33,10 @@ defmodule Slax.Mixfile do
# Type `mix help deps` for examples and options.
defp deps do
[
{:phoenix, "~> 1.6.0", override: true},
{:phoenix, "~> 1.7.14", override: true},
{:phoenix_pubsub, "~> 2.0"},
{:phoenix_ecto, "~> 4.0"},
{:ecto_sql, "~> 3.11.1"},
{:ecto_sql, "~> 3.12.1"},
{:postgrex, "~> 0.16"},
{:plug_cowboy, "~> 2.5"},
{:plug, "~> 1.15.3"},
Expand All @@ -47,7 +47,7 @@ defmodule Slax.Mixfile do
{:jason, "~> 1.1"},
{:ex_machina, "~> 2.2", only: :test},
{:sobelow, "~> 0.13", only: [:dev, :test], runtime: false},
{:stream_data, "~> 0.6.0", only: :test},
{:stream_data, "~> 1.1.1", only: :test},
{:quantum, "~> 3.0"},
{:timex, "~> 3.7"},
{:tentacat, "~> 2.2.0"},
Expand All @@ -56,7 +56,8 @@ defmodule Slax.Mixfile do
{:gun, "~> 2.0.1"},
{:oban, "~> 2.13"},
{:certifi, "~> 2.8.0"},
{:castore, "~> 1.0"}
{:castore, "~> 1.0"},
{:phoenix_view, "~> 2.0"}
]
end

Expand Down
Loading

0 comments on commit 43123f4

Please sign in to comment.