minor adjustments

This commit is contained in:
Charlotte 🦝 Delenk 2022-11-04 11:13:14 +01:00
parent 2df57e751f
commit b988c1bb52
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122

View file

@ -804,7 +804,7 @@ index e57604b..050e87c 100644
Base.metadata.create_all(engine)
diff --git a/moa/toot.py b/moa/toot.py
index 08aa61d..29426a3 100644
index 08aa61d..02cee13 100644
--- a/moa/toot.py
+++ b/moa/toot.py
@@ -8,11 +8,11 @@ from moa.message import Message
@ -903,8 +903,8 @@ index 08aa61d..29426a3 100644
# We trust mastodon to return valid HTML
- self.content = re.sub(r'<a [^>]*href="([^"]+)">[^<]*</a>', '\g<1>', self.content)
+ self.content = re.sub(r'<a [^>]*href="([^"]+)">[^<]*</a>', '\g<1>',
+ self.content)
+ self.content = re.sub(r'<a [^>]*href="([^"]+)">([^<]*)</a>',
+ '\g<1> (\g<2>)', self.content)
# We replace html br with new lines
- self.content = "\n".join(re.compile(r'<br ?/?>', re.IGNORECASE).split(self.content))
@ -980,7 +980,7 @@ index 08aa61d..29426a3 100644
else:
logger.info('Truncating toot')
diff --git a/moa/tweet.py b/moa/tweet.py
index b156967..0eeeaae 100644
index b156967..95d4a96 100644
--- a/moa/tweet.py
+++ b/moa/tweet.py
@@ -20,6 +20,7 @@ HANDLE_SUFFIX = ''
@ -1079,16 +1079,17 @@ index b156967..0eeeaae 100644
else:
content = self.data.full_text
@@ -271,6 +276,8 @@ class Tweet(Message):
@@ -271,6 +276,9 @@ class Tweet(Message):
content = re.sub(url.url, url.expanded_url, content)
if self.is_retweet:
+ self.media = []
+ self.__content = f"RT @{self.data.retweeted_status.user.screen_name}{HANDLE_SUFFIX}\n{self.url}"
+ return self.__content
if len(content) > 0:
content = f"RT @{self.data.retweeted_status.user.screen_name}{HANDLE_SUFFIX}\n{content}"
else:
@@ -366,13 +373,16 @@ class Tweet(Message):
@@ -366,13 +374,16 @@ class Tweet(Message):
except (ConnectionError, NewConnectionError) as e:
logger.error(f"{e}")
attachment_url = None