mirror of https://gitlab.com/brutaldon/brutaldon
Fix formatting problem with redrafts and tags
Plus misc. redraft problems
This commit is contained in:
parent
3407aa8086
commit
ccb21b0cdc
2
Pipfile
2
Pipfile
|
@ -23,6 +23,8 @@ six = "*"
|
||||||
webencodings = "*"
|
webencodings = "*"
|
||||||
Django = "*"
|
Django = "*"
|
||||||
django-html_sanitizer = "*"
|
django-html_sanitizer = "*"
|
||||||
|
inscriptis = "*"
|
||||||
|
lxml = "*"
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,8 @@
|
||||||
ic-get-from="{% url "redraft" toot.id %}"
|
ic-get-from="{% url "redraft" toot.id %}"
|
||||||
ic-indicator="#page-load-indicator"
|
ic-indicator="#page-load-indicator"
|
||||||
ic-target="#main"
|
ic-target="#main"
|
||||||
ic-select-from-response="#main">
|
ic-select-from-response="#main"
|
||||||
|
ic-push-url="true">
|
||||||
redraft
|
redraft
|
||||||
</a>
|
</a>
|
||||||
<a class="level-item" href="{% url "delete" toot.id %}"
|
<a class="level-item" href="{% url "delete" toot.id %}"
|
||||||
|
|
|
@ -10,8 +10,9 @@ from brutaldon.models import Client, Account, Preference, Theme
|
||||||
from mastodon import Mastodon, AttribAccessDict, MastodonError, MastodonAPIError
|
from mastodon import Mastodon, AttribAccessDict, MastodonError, MastodonAPIError
|
||||||
from urllib import parse
|
from urllib import parse
|
||||||
from pdb import set_trace
|
from pdb import set_trace
|
||||||
from bs4 import BeautifulSoup
|
from inscriptis import get_text
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
import re
|
||||||
|
|
||||||
class NotLoggedInException(Exception):
|
class NotLoggedInException(Exception):
|
||||||
pass
|
pass
|
||||||
|
@ -436,7 +437,8 @@ def redraft(request, id):
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
account, mastodon = get_usercontext(request)
|
account, mastodon = get_usercontext(request)
|
||||||
toot = mastodon.status(id)
|
toot = mastodon.status(id)
|
||||||
toot_content = BeautifulSoup(toot.content).get_text("\n")
|
toot_content = get_text(toot.content)
|
||||||
|
toot_content = re.sub("(^\n)|(\n$)", '', re.sub("\n\n", "\n", toot_content))
|
||||||
form = PostForm({'status': toot_content,
|
form = PostForm({'status': toot_content,
|
||||||
'visibility': toot.visibility,
|
'visibility': toot.visibility,
|
||||||
'spoiler_text': toot.spoiler_text,
|
'spoiler_text': toot.spoiler_text,
|
||||||
|
|
Loading…
Reference in New Issue