mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-25 07:36:07 +00:00
only put linked mfm in source (#171)
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/171
This commit is contained in:
parent
11ec9daa5b
commit
aaf78e2b52
|
@ -1169,7 +1169,6 @@ config :pleroma, :config_description, [
|
||||||
hideFilteredStatuses: false,
|
hideFilteredStatuses: false,
|
||||||
hideMutedPosts: false,
|
hideMutedPosts: false,
|
||||||
hidePostStats: false,
|
hidePostStats: false,
|
||||||
hideSitename: false,
|
|
||||||
hideUserStats: false,
|
hideUserStats: false,
|
||||||
loginMethod: "password",
|
loginMethod: "password",
|
||||||
logo: "/static/logo.svg",
|
logo: "/static/logo.svg",
|
||||||
|
@ -1235,12 +1234,6 @@ config :pleroma, :config_description, [
|
||||||
type: :boolean,
|
type: :boolean,
|
||||||
description: "Hide notices statistics (repeats, favorites, ...)"
|
description: "Hide notices statistics (repeats, favorites, ...)"
|
||||||
},
|
},
|
||||||
%{
|
|
||||||
key: :hideSitename,
|
|
||||||
label: "Hide Sitename",
|
|
||||||
type: :boolean,
|
|
||||||
description: "Hides instance name from PleromaFE banner"
|
|
||||||
},
|
|
||||||
%{
|
%{
|
||||||
key: :hideUserStats,
|
key: :hideUserStats,
|
||||||
label: "Hide user stats",
|
label: "Hide user stats",
|
||||||
|
@ -1350,6 +1343,42 @@ config :pleroma, :config_description, [
|
||||||
type: :string,
|
type: :string,
|
||||||
description: "Which theme to use. Available themes are defined in styles.json",
|
description: "Which theme to use. Available themes are defined in styles.json",
|
||||||
suggestions: ["pleroma-dark"]
|
suggestions: ["pleroma-dark"]
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
key: :showPanelNavShortcuts,
|
||||||
|
label: "Show timeline panel nav shortcuts",
|
||||||
|
type: :boolean,
|
||||||
|
description: "Whether to put timeline nav tabs on the top of the panel"
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
key: :showNavShortcuts,
|
||||||
|
label: "Show navbar shortcuts",
|
||||||
|
type: :boolean,
|
||||||
|
description: "Whether to put extra navigation options on the navbar"
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
key: :showWiderShortcuts,
|
||||||
|
label: "Increase navbar shortcut spacing",
|
||||||
|
type: :boolean,
|
||||||
|
description: "Whether to add extra space between navbar icons"
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
key: :hideSiteFavicon,
|
||||||
|
label: "Hide site favicon",
|
||||||
|
type: :boolean,
|
||||||
|
description: "Whether to hide the instance favicon from the navbar"
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
key: :hideSiteName,
|
||||||
|
label: "Hide site name",
|
||||||
|
type: :boolean,
|
||||||
|
description: "Whether to hide the site name from the navbar"
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
key: :renderMisskeyMarkdown,
|
||||||
|
label: "Render misskey markdown",
|
||||||
|
type: :boolean,
|
||||||
|
description: "Whether to render Misskey-flavoured markdown"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -119,7 +119,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidator do
|
||||||
{linked, _, _} =
|
{linked, _, _} =
|
||||||
Utils.format_input(content, "text/x.misskeymarkdown", mention_handler: mention_handler)
|
Utils.format_input(content, "text/x.misskeymarkdown", mention_handler: mention_handler)
|
||||||
|
|
||||||
Map.put(object, "content", linked)
|
put_in(object, ["source", "content"], linked)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp fix_misskey_content(%{"_misskey_content" => content} = object) when is_binary(content) do
|
defp fix_misskey_content(%{"_misskey_content" => content} = object) when is_binary(content) do
|
||||||
|
@ -132,10 +132,9 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidator do
|
||||||
|
|
||||||
object
|
object
|
||||||
|> Map.put("source", %{
|
|> Map.put("source", %{
|
||||||
"content" => content,
|
"content" => linked,
|
||||||
"mediaType" => "text/x.misskeymarkdown"
|
"mediaType" => "text/x.misskeymarkdown"
|
||||||
})
|
})
|
||||||
|> Map.put("content", linked)
|
|
||||||
|> Map.delete("_misskey_content")
|
|> Map.delete("_misskey_content")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
2
test/fixtures/misskey/mfm_x_format.json
vendored
2
test/fixtures/misskey/mfm_x_format.json
vendored
|
@ -3,7 +3,7 @@
|
||||||
"type": "Note",
|
"type": "Note",
|
||||||
"attributedTo": "https://misskey.local.live/users/92hzkskwgy",
|
"attributedTo": "https://misskey.local.live/users/92hzkskwgy",
|
||||||
"summary": null,
|
"summary": null,
|
||||||
"content": "this gets replaced",
|
"content": "this does not get replaced",
|
||||||
"source": {
|
"source": {
|
||||||
"content": "@akkoma_user @remote_user @full_tag_remote_user@misskey.local.live @oops_not_a_mention linkifylink #dancedance $[jelly mfm goes here] \n\n## aaa",
|
"content": "@akkoma_user @remote_user @full_tag_remote_user@misskey.local.live @oops_not_a_mention linkifylink #dancedance $[jelly mfm goes here] \n\n## aaa",
|
||||||
"mediaType": "text/x.misskeymarkdown"
|
"mediaType": "text/x.misskeymarkdown"
|
||||||
|
|
|
@ -96,10 +96,9 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest
|
||||||
%{
|
%{
|
||||||
valid?: true,
|
valid?: true,
|
||||||
changes: %{
|
changes: %{
|
||||||
content: content,
|
content: "this does not get replaced",
|
||||||
source: %{
|
source: %{
|
||||||
"content" =>
|
"content" => content,
|
||||||
"@akkoma_user @remote_user @full_tag_remote_user@misskey.local.live @oops_not_a_mention linkifylink #dancedance $[jelly mfm goes here] \n\n## aaa",
|
|
||||||
"mediaType" => "text/x.misskeymarkdown"
|
"mediaType" => "text/x.misskeymarkdown"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,22 +128,20 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest
|
||||||
|> File.read!()
|
|> File.read!()
|
||||||
|> Jason.decode!()
|
|> Jason.decode!()
|
||||||
|
|
||||||
expected_content =
|
|
||||||
"<span class=\"h-card\"><a class=\"u-url mention\" data-user=\"#{local_user.id}\" href=\"#{local_user.ap_id}\" rel=\"ugc\">@<span>akkoma_user</span></a></span> linkifylink <a class=\"hashtag\" data-tag=\"dancedance\" href=\"http://localhost:4001/tag/dancedance\">#dancedance</a> $[jelly mfm goes here] <br><br>## aaa"
|
|
||||||
|
|
||||||
changes = ArticleNotePageValidator.cast_and_validate(note)
|
changes = ArticleNotePageValidator.cast_and_validate(note)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
valid?: true,
|
valid?: true,
|
||||||
changes: %{
|
changes: %{
|
||||||
source: %{
|
source: %{
|
||||||
"content" => "@akkoma_user linkifylink #dancedance $[jelly mfm goes here] \n\n## aaa",
|
"content" => content,
|
||||||
"mediaType" => "text/x.misskeymarkdown"
|
"mediaType" => "text/x.misskeymarkdown"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} = changes
|
} = changes
|
||||||
|
|
||||||
assert changes.changes[:content] == expected_content
|
assert content =~
|
||||||
|
"<span class=\"h-card\"><a class=\"u-url mention\" data-user=\"#{local_user.id}\" href=\"#{local_user.ap_id}\" rel=\"ugc\">@<span>akkoma_user</span></a></span>"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue