Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 174b0d8

Browse files
author
mydearxym
committed
chore: merge branch 'dev'
2 parents 8f2d7f9 + ebf6ca2 commit 174b0d8

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

lib/groupher_server/cms/delegates/article_curd.ex

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,30 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do
9595
end
9696
end
9797

98+
@doc """
99+
notify(email) admin about new content
100+
NOTE: this method should NOT be pravite, because this method
101+
will be called outside this module
102+
"""
103+
def notify_admin_new_content(%{id: id} = result) do
104+
target = result.__struct__
105+
preload = [:origial_community, author: :user]
106+
107+
with {:ok, content} <- ORM.find(target, id, preload: preload) do
108+
info = %{
109+
id: content.id,
110+
title: content.title,
111+
digest: Map.get(content, :digest, content.title),
112+
author_name: content.author.user.nickname,
113+
community_raw: content.origial_community.raw,
114+
type:
115+
result.__struct__ |> to_string |> String.split(".") |> List.last() |> String.downcase()
116+
}
117+
118+
Email.notify_admin(info, :new_content)
119+
end
120+
end
121+
98122
@doc """
99123
update a content(post/job ...)
100124
"""
@@ -478,23 +502,4 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do
478502
|> Repo.update()
479503
end
480504
end
481-
482-
defp notify_admin_new_content(%{id: id} = result) do
483-
target = result.__struct__
484-
preload = [:origial_community, author: :user]
485-
486-
with {:ok, content} <- ORM.find(target, id, preload: preload) do
487-
info = %{
488-
id: content.id,
489-
title: content.title,
490-
digest: Map.get(content, :digest, content.title),
491-
author_name: content.author.user.nickname,
492-
community_raw: content.origial_community.raw,
493-
type:
494-
result.__struct__ |> to_string |> String.split(".") |> List.last() |> String.downcase()
495-
}
496-
497-
Email.notify_admin(info, :new_content)
498-
end
499-
end
500505
end

lib/groupher_server_web/router.ex

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ defmodule GroupherServerWeb.Router do
55
use Plug.ErrorHandler
66
use Sentry.Plug
77

8-
# see https://github.com/sikanhe/apollo-tracing-elixir/issues/26
9-
require Protocol
10-
Protocol.derive(Jason.Encoder, ApolloTracing.Schema)
11-
Protocol.derive(Jason.Encoder, ApolloTracing.Schema.Execution)
12-
138
pipeline :api do
149
plug(:accepts, ["json"])
1510
plug(GroupherServerWeb.Context)

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ defmodule GroupherServer.Mixfile do
8282
{:dataloader, "~> 1.0.2"},
8383
{:mix_test_watch, "~> 0.9", only: :dev, runtime: false},
8484
{:ex_unit_notifier, "~> 0.1", only: :test},
85-
{:apollo_tracing, "~> 0.4.1"},
85+
{:apollo_tracing, "~> 0.4.3"},
8686
{:pre_commit, "~> 0.3.4"},
8787
{:inch_ex, "~> 2.0", only: [:dev, :test]},
8888
{:short_maps, "~> 0.1.1"},

mix.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"absinthe": {:hex, :absinthe, "1.4.16", "0933e4d9f12652b12115d5709c0293a1bf78a22578032e9ad0dad4efee6b9eb1", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
33
"absinthe_ecto": {:hex, :absinthe_ecto, "0.1.3", "420b68129e79fe4571a4838904ba03e282330d335da47729ad52ffd7b8c5fcb1", [:mix], [{:absinthe, "~> 1.3.0 or ~> 1.4.0", [hex: :absinthe, repo: "hexpm", optional: false]}, {:ecto, ">= 0.0.0", [hex: :ecto, repo: "hexpm", optional: false]}], "hexpm"},
44
"absinthe_plug": {:hex, :absinthe_plug, "1.4.7", "939b6b9e1c7abc6b399a5b49faa690a1fbb55b195c670aa35783b14b08ccec7a", [:mix], [{:absinthe, "~> 1.4.11", [hex: :absinthe, repo: "hexpm", optional: false]}, {:plug, "~> 1.3.2 or ~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
5-
"apollo_tracing": {:hex, :apollo_tracing, "0.4.1", "210d20693f88bd133a55b04dc1d990ce68ce620a804773731faf180b8b85aa4e", [:mix], [{:absinthe, "~> 1.4", [hex: :absinthe, repo: "hexpm", optional: false]}, {:absinthe_plug, "~> 1.4", [hex: :absinthe_plug, repo: "hexpm", optional: true]}], "hexpm"},
5+
"apollo_tracing": {:hex, :apollo_tracing, "0.4.3", "6bc56132f4ab87223b10dc7ab91bf4374ba4033411ba80873f9f89caf15d7476", [:mix], [{:absinthe, "~> 1.4", [hex: :absinthe, repo: "hexpm", optional: false]}, {:absinthe_plug, "~> 1.4", [hex: :absinthe_plug, repo: "hexpm", optional: true]}, {:jason, "~> 1.1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm"},
66
"argon2_elixir": {:hex, :argon2_elixir, "1.2.14", "0fc4bfbc1b7e459954987d3d2f3836befd72d63f3a355e3978f5005dd6e80816", [], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"},
77
"bamboo": {:hex, :bamboo, "1.3.0", "9ab7c054f1c3435464efcba939396c29c5e1b28f73c34e1f169e0881297a3141", [:mix], [{:hackney, ">= 1.13.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
88
"base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [:rebar], [], "hexpm"},
@@ -16,7 +16,7 @@
1616
"corsica": {:hex, :corsica, "1.1.2", "5ad8b9dcbeeda4762d78a57c0c8c2f88e1eef8741508517c98cb79e0db1f107d", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
1717
"cowboy": {:hex, :cowboy, "2.6.3", "99aa50e94e685557cad82e704457336a453d4abcb77839ad22dbe71f311fcc06", [:rebar3], [{:cowlib, "~> 2.7.3", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"},
1818
"cowlib": {:hex, :cowlib, "2.7.3", "a7ffcd0917e6d50b4d5fb28e9e2085a0ceb3c97dea310505f7460ff5ed764ce9", [:rebar3], [], "hexpm"},
19-
"credo": {:hex, :credo, "1.1.2", "02b6422f3e659eb74b05aca3c20c1d8da0119a05ee82577a82e6c2938bf29f81", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
19+
"credo": {:hex, :credo, "1.1.3", "bf31887b8914a4b7e1810ae2b5aab7c657698abbf4cca6a2335a094d57995168", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
2020
"crontab": {:hex, :crontab, "1.1.7", "b9219f0bdc8678b94143655a8f229716c5810c0636a4489f98c0956137e53985", [:mix], [{:ecto, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm"},
2121
"dataloader": {:hex, :dataloader, "1.0.6", "fb724d6d3fb6acb87d27e3b32dea3a307936ad2d245faf9cf5221d1323d6a4ba", [:mix], [{:ecto, ">= 0.0.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm"},
2222
"db_connection": {:hex, :db_connection, "2.1.1", "a51e8a2ee54ef2ae6ec41a668c85787ed40cb8944928c191280fe34c15b76ae5", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm"},

0 commit comments

Comments
 (0)