Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jeff
pleroma
Commits
6e5b0406
Commit
6e5b0406
authored
6 years ago
by
kaniini
Browse files
Options
Downloads
Patches
Plain Diff
mrf: add no placeholder-text policy, strips pointless "." content from posts with images
parent
fbcb6f76
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/pleroma/web/activity_pub/mrf/no_placeholder_text_policy.ex
+29
-0
29 additions, 0 deletions
...leroma/web/activity_pub/mrf/no_placeholder_text_policy.ex
with
29 additions
and
0 deletions
lib/pleroma/web/activity_pub/mrf/no_placeholder_text_policy.ex
0 → 100644
+
29
−
0
View file @
6e5b0406
# Pleroma: A lightweight social networking server
# Copyright © 2019 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma
.
Web
.
ActivityPub
.
MRF
.
NoPlaceholderTextPolicy
do
@behaviour
Pleroma
.
Web
.
ActivityPub
.
MRF
@impl
true
def
filter
(
%{
"type"
=>
"Create"
,
"object"
=>
%{
"content"
=>
content
,
"attachment"
=>
_attachment
}
=
child_object
}
=
object
)
when
content
in
[
"."
,
"<p>.</p>"
]
do
child_object
=
child_object
|>
Map
.
put
(
"content"
,
""
)
object
=
object
|>
Map
.
put
(
"object"
,
child_object
)
{
:ok
,
object
}
end
@impl
true
def
filter
(
object
),
do
:
{
:ok
,
object
}
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment