diff --git a/README.md b/README.md index d536c37..68f6653 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,30 @@ - [ ] Posting - [x] Making posts locally - - [ ] Figuring out follower list - - [ ] Sending to followers + - [x] Figuring out follower list + - [x] Sending to followers + - [ ] Post formatting + - [ ] Sending posts w/ images / videos + - [ ] Receiving posts w/ images / videos - [ ] Timeline - [x] My posts - [ ] Posts from accounts you follow + - [ ] Show the actor avatar and display name - [ ] Deleting posts +- [ ] Profile + - [ ] Name field (for display name) - [x] Following + - [ ] Scrape public posts from the outbox when you follow - [ ] Unfollowing - [x] Being followed - [x] Accepting follows - [ ] Approving / declining follows and authorized instance list - [ ] Liking - [ ] Unliking +- [ ] CW posts +- [ ] Polls +- [ ] DMs +- [ ] Followers-only posts (or maybe this is handled because we only send posts to followers? but we also include public in the TO field?) ## UX @@ -30,3 +41,6 @@ - Approving / declining follows and authorized instance list - [ ] Liking - [ ] Unliking +- [ ] CW posts +- [ ] Polls +- [ ] DMs diff --git a/assets/tailwind.config.js b/assets/tailwind.config.js index c8e6988..dd29cd1 100644 --- a/assets/tailwind.config.js +++ b/assets/tailwind.config.js @@ -20,20 +20,21 @@ module.exports = { }, plugins: [ require("@tailwindcss/forms"), + require('@tailwindcss/typography'), // Allows prefixing tailwind classes with LiveView classes to add rules // only when LiveView classes are applied, for example: // //
// - plugin(({addVariant}) => addVariant("phx-no-feedback", [".phx-no-feedback&", ".phx-no-feedback &"])), - plugin(({addVariant}) => addVariant("phx-click-loading", [".phx-click-loading&", ".phx-click-loading &"])), - plugin(({addVariant}) => addVariant("phx-submit-loading", [".phx-submit-loading&", ".phx-submit-loading &"])), - plugin(({addVariant}) => addVariant("phx-change-loading", [".phx-change-loading&", ".phx-change-loading &"])), + plugin(({ addVariant }) => addVariant("phx-no-feedback", [".phx-no-feedback&", ".phx-no-feedback &"])), + plugin(({ addVariant }) => addVariant("phx-click-loading", [".phx-click-loading&", ".phx-click-loading &"])), + plugin(({ addVariant }) => addVariant("phx-submit-loading", [".phx-submit-loading&", ".phx-submit-loading &"])), + plugin(({ addVariant }) => addVariant("phx-change-loading", [".phx-change-loading&", ".phx-change-loading &"])), // Embeds Heroicons (https://heroicons.com) into your app.css bundle // See your `CoreComponents.icon/1` for more information. // - plugin(function({matchComponents, theme}) { + plugin(function ({ matchComponents, theme }) { let iconsDir = path.join(__dirname, "../deps/heroicons/optimized") let values = {} let icons = [ @@ -45,11 +46,11 @@ module.exports = { icons.forEach(([suffix, dir]) => { fs.readdirSync(path.join(iconsDir, dir)).forEach(file => { let name = path.basename(file, ".svg") + suffix - values[name] = {name, fullPath: path.join(iconsDir, dir, file)} + values[name] = { name, fullPath: path.join(iconsDir, dir, file) } }) }) matchComponents({ - "hero": ({name, fullPath}) => { + "hero": ({ name, fullPath }) => { let content = fs.readFileSync(fullPath).toString().replace(/\r?\n|\r/g, "") let size = theme("spacing.6") if (name.endsWith("-mini")) { @@ -69,7 +70,7 @@ module.exports = { "height": size } } - }, {values}) + }, { values }) }) ] } diff --git a/lib/postland/accounts/user.ex b/lib/postland/accounts/user.ex index bf9d3fd..3409aa6 100644 --- a/lib/postland/accounts/user.ex +++ b/lib/postland/accounts/user.ex @@ -3,6 +3,8 @@ defmodule Postland.Accounts.User do import Ecto.Changeset schema "users" do + field :name, :string + field :summary, :string field :username, :string field :password, :string, virtual: true, redact: true field :hashed_password, :string, redact: true @@ -112,6 +114,11 @@ defmodule Postland.Accounts.User do change(user, confirmed_at: now) end + def profile_changeset(user, attrs) do + user + |> cast(attrs, [:name, :summary]) + end + @doc """ Verifies the password. diff --git a/lib/postland/activities.ex b/lib/postland/activities.ex index d8de4c4..9aa63fa 100644 --- a/lib/postland/activities.ex +++ b/lib/postland/activities.ex @@ -13,6 +13,14 @@ defmodule Postland.Activities do id = Ecto.UUID.autogenerate() html = Earmark.as_html!(markdown) + # Standard Mastodon will display the following kinds of post formatting: + # bold, italics, strikethrough, ordered and unordered lists, blockquotes, + # inline code, fenced code blocks, headers. Headers are displayed as bold + # text in a separate paragraph. + + # CW posts have a summary field which is the warning itself, a content + # field (like a non-CW post) that is the body, and a "sensitive" => true field + activity = %{ "@context" => [ diff --git a/lib/postland/timeline.ex b/lib/postland/timeline.ex index 775e6d6..c7719ab 100644 --- a/lib/postland/timeline.ex +++ b/lib/postland/timeline.ex @@ -9,7 +9,7 @@ defmodule Postland.Timeline do end def attribution(activity) do - get_from_html_item(activity, "attributedTo") + Postland.Actors.actor(get_from_html_item(activity, "attributedTo")) end defp get_from_html_item(activity, field_name) do diff --git a/lib/postland_web/components/core_components.ex b/lib/postland_web/components/core_components.ex index d045485..cfce2b6 100644 --- a/lib/postland_web/components/core_components.ex +++ b/lib/postland_web/components/core_components.ex @@ -25,10 +25,10 @@ defmodule PostlandWeb.CoreComponents do <.form class="py-5" phx-submit="create_post" phx-change="change_post">
- +
-
+