diff --git a/README.md b/README.md index 3ddef81d..260d35d9 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ Following services will be started: - [localhost:4003](https://localhost:4003) - GraphQL API (https) - [localhost:4004](http://localhost:4004) - Atom feed +You can also see all the mail sent by going to http://localhost:4000/_dev/mail + ## Other useful commands - `mix test` --> Run tests diff --git a/apps/cf/lib/utils/frontend_router.ex b/apps/cf/lib/utils/frontend_router.ex index 236e7c03..4f42cf1b 100644 --- a/apps/cf/lib/utils/frontend_router.ex +++ b/apps/cf/lib/utils/frontend_router.ex @@ -38,8 +38,8 @@ defmodule CF.Utils.FrontendRouter do @doc """ Comment's URL """ - def comment_url(video_hash_id, %Comment{statement: statement}), - do: statement_url(video_hash_id, statement.id) + def comment_url(video_hash_id, %Comment{id: id, statement: statement}), + do: statement_url(video_hash_id, statement.id) <> "&c=#{id}" @doc """ Speaker URL diff --git a/apps/cf/lib/videos/captions_fetcher_youtube.ex b/apps/cf/lib/videos/captions_fetcher_youtube.ex index 5081c689..69666aa6 100644 --- a/apps/cf/lib/videos/captions_fetcher_youtube.ex +++ b/apps/cf/lib/videos/captions_fetcher_youtube.ex @@ -6,8 +6,8 @@ defmodule CF.Videos.CaptionsFetcherYoutube do @behaviour CF.Videos.CaptionsFetcher @impl true - def fetch(%{youtube_id: youtube_id, locale: locale}) do - with {:ok, content} <- fetch_captions_content(youtube_id, locale) do + def fetch(%{youtube_id: youtube_id, language: language}) do + with {:ok, content} <- fetch_captions_content(youtube_id, language) do captions = %DB.Schema.VideoCaption{ content: content, format: "xml" diff --git a/apps/cf/mix.exs b/apps/cf/mix.exs index b9ef4810..9cdc0f7e 100644 --- a/apps/cf/mix.exs +++ b/apps/cf/mix.exs @@ -4,7 +4,7 @@ defmodule CF.Mixfile do def project do [ app: :cf, - version: "0.9.1", + version: "0.9.2", build_path: "../../_build", compilers: [:phoenix, :gettext] ++ Mix.compilers(), config_path: "../../config/config.exs", diff --git a/apps/cf/priv/limitations.yaml b/apps/cf/priv/limitations.yaml index 95a74ba0..889a5361 100644 --- a/apps/cf/priv/limitations.yaml +++ b/apps/cf/priv/limitations.yaml @@ -13,7 +13,7 @@ update: statement: [ 0 , 0 , 5 , 15 , 30 , 75 , 125 , 150 , 200 ] speaker: [ 0 , 0 , 3 , 7 , 15 , 30 , 60 , 80 , 100 ] video: [ 0 , 0 , 0 , 0 , 3 , 6 , 12 , 25 , 40 ] - user: [ 1 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 ] + user: [ 1 , 10 , 15 , 20 , 20 , 30 , 30 , 50 , 50 ] delete: comment: [ 1 , 20 , 30 , 50 , 75 , 300 , 300 , 300 , 300 ] remove: diff --git a/apps/cf_atom_feed/lib/flags.ex b/apps/cf_atom_feed/lib/flags.ex index deb2d05b..e2c89382 100644 --- a/apps/cf_atom_feed/lib/flags.ex +++ b/apps/cf_atom_feed/lib/flags.ex @@ -6,7 +6,7 @@ defmodule CF.AtomFeed.Flags do import Ecto.Query alias Atomex.{Feed, Entry} - alias DB.Schema.{Flag, UserAction, User, Comment} + alias DB.Schema.{Flag, User} alias DB.Type.FlagReason alias CF.Utils.FrontendRouter @@ -18,7 +18,7 @@ defmodule CF.AtomFeed.Flags do """ def feed_all() do flags = fetch_flags() - generate_feed(flags, last_update(flags)) + generate_feed("https://feed.captainfact.io/flags/", flags, last_update(flags)) end defp fetch_flags() do @@ -26,8 +26,8 @@ defmodule CF.AtomFeed.Flags do from( flag in Flag, order_by: [desc: flag.inserted_at], - left_join: action in assoc(flag, :action), - left_join: comment in assoc(action, :comment), + inner_join: action in assoc(flag, :action), + inner_join: comment in assoc(action, :comment), left_join: user in assoc(comment, :user), left_join: source in assoc(comment, :source), preload: [action: [comment: [:user, :statement, :source]]], @@ -42,11 +42,11 @@ defmodule CF.AtomFeed.Flags do defp last_update(_), do: DateTime.utc_now() - defp generate_feed(flags, last_update) do - FrontendRouter.base_url() + defp generate_feed(feed_link, flags, last_update) do + feed_link |> Feed.new(last_update, "[CaptainFact] All Flags") |> CF.AtomFeed.Common.feed_author() - |> Feed.link("https://feed.captainfact.io/flags/", rel: "self") + |> Feed.link(feed_link, rel: "self") |> Feed.entries(Enum.map(flags, &get_entry/1)) |> Feed.build() |> Atomex.generate_document() @@ -67,7 +67,7 @@ defmodule CF.AtomFeed.Flags do ``` #{comment.text} ``` - Source Comment: #{source(comment)}\n + Source: #{source(comment)}\n Flag reason: #{FlagReason.label(flag.reason)} """) |> Entry.build() diff --git a/apps/cf_atom_feed/lib/router.ex b/apps/cf_atom_feed/lib/router.ex index 40bd8c2b..b79673de 100644 --- a/apps/cf_atom_feed/lib/router.ex +++ b/apps/cf_atom_feed/lib/router.ex @@ -16,6 +16,7 @@ defmodule CF.AtomFeed.Router do |> put_resp_content_type("application/json") |> send_resp(200, """ { + "app": "CF.AtomFeed", "status": "✔", "version": "#{CF.AtomFeed.Application.version()}", "db_version": "#{DB.Application.version()}" diff --git a/apps/cf_atom_feed/mix.exs b/apps/cf_atom_feed/mix.exs index daf6d507..cfa244e1 100644 --- a/apps/cf_atom_feed/mix.exs +++ b/apps/cf_atom_feed/mix.exs @@ -4,7 +4,7 @@ defmodule CF.AtomFeed.Mixfile do def project do [ app: :cf_atom_feed, - version: "0.9.1", + version: "0.9.2", build_path: "../../_build", config_path: "../../config/config.exs", deps_path: "../../deps", diff --git a/apps/cf_atom_feed/test/comments_test.exs b/apps/cf_atom_feed/test/comments_test.exs index 1b918fea..c5521fcc 100644 --- a/apps/cf_atom_feed/test/comments_test.exs +++ b/apps/cf_atom_feed/test/comments_test.exs @@ -30,7 +30,9 @@ defmodule CF.AtomFeed.CommentsTest do # Check comment entries for comment <- comments do assert feed =~ - ~r(https://TEST_FRONTEND/videos/[a-zA-Z0-9]+\?statement=#{comment.statement_id}"/>) + ~r(https://TEST_FRONTEND/videos/[a-zA-Z0-9]+\?statement=#{comment.statement_id}&c=#{ + comment.id + }"/>) assert feed =~ ~r(