Browse Source

chore: mix format

master
Inhji Y. 10 months ago
parent
commit
8a3131ff54
  1. 8
      apps/bookmarks/lib/bookmarks/worker.ex
  2. 2
      apps/tomie_web/lib/tomie_web/live/bookmark_live/new.ex
  3. 6
      apps/tomie_web/lib/tomie_web/views/page_view.ex

8
apps/bookmarks/lib/bookmarks/worker.ex

@ -10,14 +10,14 @@ defmodule Bookmarks.Worker do
bookmark = Bookmarks.get_bookmark!(id)
with :ok <- scrape_bookmark_url(bookmark),
:ok <- send_webmention(bookmark, url) do
:ok <- send_webmention(bookmark, url) do
:ok
else
error -> error
end
end
def scrape_bookmark_url(%Bookmark{source: source} = bookmark) do
def scrape_bookmark_url(%Bookmark{source: source} = bookmark) do
with {:ok, html} <- Scraper.Html.get_html(source),
{:ok, result} <- Scraper.Html.parse(html),
{:ok, updated_bookmark} <- Bookmarks.update_bookmark(bookmark, %{title: result.title}) do
@ -32,14 +32,14 @@ defmodule Bookmarks.Worker do
})
:ok
else
else
_ -> {:error, "scrape error"}
end
end
def send_webmention(%Bookmark{source: destination}, source_url) do
with {:ok, endpoint} <- Webmentions.discover_endpoint(destination),
:ok <- Webmentions.send_webmention(endpoint, source_url, destination) do
:ok <- Webmentions.send_webmention(endpoint, source_url, destination) do
:ok
else
{:ok, nil} -> {:error, "No endpoint found"}

2
apps/tomie_web/lib/tomie_web/live/bookmark_live/new.ex

@ -40,7 +40,7 @@ defmodule TomieWeb.BookmarkLive.New do
url: Routes.home_url(TomieWeb.Endpoint, :bookmark, bookmark)
})
|> Oban.insert()
{:noreply,
push_redirect(socket, to: Routes.live_path(socket, BookmarkLive.Show, bookmark))}

6
apps/tomie_web/lib/tomie_web/views/page_view.ex

@ -10,9 +10,9 @@ defmodule TomieWeb.PageView do
end
def forecast_days(forecast) do
forecast
|> Enum.drop(1)
|> Enum.take(3)
forecast
|> Enum.drop(1)
|> Enum.take(3)
end
def weekday(timestamp) do

Loading…
Cancel
Save