Skip to content

Commit

Permalink
Merge pull request #78 from CaptainFact/staging
Browse files Browse the repository at this point in the history
Release 0.9.2
  • Loading branch information
Betree authored Dec 29, 2018
2 parents aee0be4 + e4f614f commit e182aaf
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 24 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions apps/cf/lib/utils/frontend_router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions apps/cf/lib/videos/captions_fetcher_youtube.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion apps/cf/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion apps/cf/priv/limitations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 8 additions & 8 deletions apps/cf_atom_feed/lib/flags.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -18,16 +18,16 @@ 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
DB.Repo.all(
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]]],
Expand All @@ -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()
Expand All @@ -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()
Expand Down
1 change: 1 addition & 0 deletions apps/cf_atom_feed/lib/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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()}"
Expand Down
2 changes: 1 addition & 1 deletion apps/cf_atom_feed/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion apps/cf_atom_feed/test/comments_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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}&amp;c=#{
comment.id
}"/>)

assert feed =~ ~r(<title>New Comment from .+ on ##{comment.statement_id}</title>)
end
Expand Down
5 changes: 4 additions & 1 deletion apps/cf_graphql/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule CF.GraphQL.Mixfile do
def project do
[
app: :cf_graphql,
version: "0.9.1",
version: "0.9.2",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand Down Expand Up @@ -42,6 +42,9 @@ defmodule CF.GraphQL.Mixfile do
{:basic_auth, "~> 2.2.2"},
{:kaur, "~> 1.1"},
{:poison, "~> 3.1"},

# Local
{:cf, in_umbrella: true},
{:db, in_umbrella: true},

# Dev only
Expand Down
2 changes: 1 addition & 1 deletion apps/cf_jobs/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule CF.Jobs.Mixfile do
def project do
[
app: :cf_jobs,
version: "0.9.1",
version: "0.9.2",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand Down
2 changes: 1 addition & 1 deletion apps/cf_opengraph/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule CF.Opengraph.MixProject do
def project do
[
app: :cf_opengraph,
version: "0.9.1",
version: "0.9.2",
elixir: "~> 1.6",
start_permanent: Mix.env() == :prod,
deps: deps(),
Expand Down
7 changes: 5 additions & 2 deletions apps/cf_rest_api/lib/channels/user_socket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ defmodule CF.RestApi.UserSocket do

def handle_in_authenticated(command, params, socket, handler) do
case socket.assigns.user_id do
nil -> {:reply, :error, socket}
_ -> rescue_handler(handler, command, params, socket)
nil ->
reply_error(socket, Phoenix.View.render(ErrorView, "401.json", []))

_ ->
rescue_handler(handler, command, params, socket)
end
end

Expand Down
2 changes: 1 addition & 1 deletion apps/cf_rest_api/lib/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ defmodule CF.RestApi.Router do
plug(:accepts, ["html"])
end

scope "/jouge42" do
scope "/_dev/" do
pipe_through([:browser])
forward("/mail", Bamboo.SentEmailViewerPlug)
end
Expand Down
2 changes: 1 addition & 1 deletion apps/cf_rest_api/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule CF.RestApi.Mixfile do
def project do
[
app: :cf_rest_api,
version: "0.9.1",
version: "0.9.2",
build_path: "../../_build",
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
config_path: "../../config/config.exs",
Expand Down
2 changes: 1 addition & 1 deletion apps/db/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule DB.Mixfile do
def project do
[
app: :db,
version: "0.9.1",
version: "0.9.2",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand Down

0 comments on commit e182aaf

Please sign in to comment.