master
Aevann1 2021-10-25 15:55:56 +02:00
parent cf189c604a
commit 24385ad618
3 changed files with 25 additions and 14 deletions

View File

@ -59,12 +59,21 @@ def publish(pid, v):
post.private = False post.private = False
g.db.add(post) g.db.add(post)
cache.delete_memoized(frontlist) notify_users = set()
soup = BeautifulSoup(post.body_html, features="html.parser")
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
username = mention["href"].split("@")[1]
user = g.db.query(User).options(lazyload('*')).filter_by(username=username).first()
if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user)
for x in notify_users: send_notification(x.id, f"@{v.username} has mentioned you: http://{site}{new_post.permalink}")
for follow in v.followers: for follow in v.followers:
user = get_account(follow.user_id) user = get_account(follow.user_id)
send_notification(user.id, f"@{v.username} has made a new post: [{post.title}](http://{site}{post.permalink})", True) send_notification(user.id, f"@{v.username} has made a new post: [{post.title}](http://{site}{post.permalink})", True)
cache.delete_memoized(frontlist)
g.db.commit() g.db.commit()
return {"message": "Post published!"} return {"message": "Post published!"}
@ -101,7 +110,7 @@ def post_id(pid, anything=None, v=None):
post = get_post(pid, v=v) post = get_post(pid, v=v)
if post.club and not (v and v.paid_dues): abort(403) if post.club and not (v and v.paid_dues) or post.is_private and not (v and v.id == post.author_id): abort(403)
if v: if v:
votes = g.db.query(CommentVote).options(lazyload('*')).filter_by(user_id=v.id).subquery() votes = g.db.query(CommentVote).options(lazyload('*')).filter_by(user_id=v.id).subquery()
@ -725,17 +734,17 @@ def submit_post(v):
if (new_post.url or request.files.get('file')) and (v.is_activated or request.headers.get('cf-ipcountry')!="T1"): if (new_post.url or request.files.get('file')) and (v.is_activated or request.headers.get('cf-ipcountry')!="T1"):
gevent.spawn( thumbnail_thread, new_post.id) gevent.spawn( thumbnail_thread, new_post.id)
notify_users = set()
soup = BeautifulSoup(body_html, features="html.parser")
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
username = mention["href"].split("@")[1]
user = g.db.query(User).options(lazyload('*')).filter_by(username=username).first()
if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user)
for x in notify_users: send_notification(x.id, f"@{v.username} has mentioned you: http://{site}{new_post.permalink}")
if not new_post.private: if not new_post.private:
notify_users = set()
soup = BeautifulSoup(body_html, features="html.parser")
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
username = mention["href"].split("@")[1]
user = g.db.query(User).options(lazyload('*')).filter_by(username=username).first()
if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user)
for x in notify_users: send_notification(x.id, f"@{v.username} has mentioned you: http://{site}{new_post.permalink}")
for follow in v.followers: for follow in v.followers:
user = get_account(follow.user_id) user = get_account(follow.user_id)
send_notification(user.id, f"@{v.username} has made a new post: [{title}](http://{site}{new_post.permalink})", True) send_notification(user.id, f"@{v.username} has made a new post: [{title}](http://{site}{new_post.permalink})", True)

View File

@ -126,7 +126,7 @@
<div class="px-3 text-truncate"> <div class="px-3 text-truncate">
<h5 class="text-truncate text-black">{{c.author.username}}</h5> <h5 class="text-truncate text-black">{{c.author.username}}</h5>
</div> </div>
</div>.replace(/data-src/g, 'src') </div>
<div class="px-3"> <div class="px-3">
<span class="popover-bio text-black">{% if c.author.bio_html %}{{c.author.bio_html_eager | safe}}{% endif %}</span> <span class="popover-bio text-black">{% if c.author.bio_html %}{{c.author.bio_html_eager | safe}}{% endif %}</span>
</div> </div>

View File

@ -2725,4 +2725,6 @@ Aaaaand unsubed. Really a lack of empathy from all these assholes. We knew this
{[para]} {[para]}
Oh man...do U even realize,the substance of the question U were asking?If U do ,then U will realize why,U failed 2 receive a reply. I mean really,what dimension are U from?Did the Stargate U materialized from suffer an incomplete transmission,leaving some essential particles scattered about,in the wormhole?🤔 Oh man...do U even realize,the substance of the question U were asking?If U do ,then U will realize why,U failed 2 receive a reply. I mean really,what dimension are U from?Did the Stargate U materialized from suffer an incomplete transmission,leaving some essential particles scattered about,in the wormhole?🤔
{[para]} {[para]}
Really wish we could speed up this timeline and get to the part where you get thrown in prison for child porn. Really wish we could speed up this timeline and get to the part where you get thrown in prison for child porn.
{[para]}
I dont know what to make of any of this, waiting for the Contrapoints rebuttal video.