stop using NOTIFICATION_THREAD
parent
5bc08e8cf9
commit
ef3564c1a1
|
@ -41,14 +41,14 @@ def send_repeatable_notification(uid, text):
|
|||
notif = Notification(comment_id=c.id, user_id=uid)
|
||||
g.db.add(notif)
|
||||
|
||||
push_notif({uid}, 'New notification', text, f'{SITE_FULL}/comment/{c.id}?read=true#context')
|
||||
push_notif({uid}, 'New notification', text, f'{SITE_FULL}/notification/{c.id}')
|
||||
return
|
||||
|
||||
cid = create_comment(text_html)
|
||||
notif = Notification(comment_id=cid, user_id=uid)
|
||||
g.db.add(notif)
|
||||
|
||||
push_notif({uid}, 'New notification', text, f'{SITE_FULL}/comment/{cid}?read=true#context')
|
||||
push_notif({uid}, 'New notification', text, f'{SITE_FULL}/notification/{cid}')
|
||||
|
||||
|
||||
def send_notification(uid, text):
|
||||
|
@ -111,7 +111,7 @@ def add_notif(cid, uid, text, pushnotif_url=''):
|
|||
g.db.add(notif)
|
||||
|
||||
if not pushnotif_url:
|
||||
pushnotif_url = f'{SITE_FULL}/comment/{cid}?read=true#context'
|
||||
pushnotif_url = f'{SITE_FULL}/notification/{cid}'
|
||||
|
||||
if ' has mentioned you: [' in text:
|
||||
text = text.split(':')[0] + '!'
|
||||
|
|
|
@ -600,7 +600,6 @@ LOTTERY_TICKET_COST = 12
|
|||
LOTTERY_SINK_RATE = 3
|
||||
LOTTERY_DURATION = 60 * 60 * 24 * 7
|
||||
|
||||
NOTIFICATION_THREAD = 1
|
||||
BUG_THREAD = 0
|
||||
|
||||
SIDEBAR_THREAD = 0
|
||||
|
@ -675,7 +674,6 @@ if SITE == 'rdrama.net':
|
|||
FEATURES['USERS_PERMANENT_WORD_FILTERS'] = True
|
||||
FEATURES['ASSET_SUBMISSIONS'] = True
|
||||
|
||||
NOTIFICATION_THREAD = 6489
|
||||
BUG_THREAD = 18459
|
||||
|
||||
SIDEBAR_THREAD = 37696
|
||||
|
@ -821,7 +819,6 @@ elif SITE == 'watchpeopledie.tv':
|
|||
|
||||
ERROR_MARSEYS[403] = "marseyconfused"
|
||||
|
||||
NOTIFICATION_THREAD = 27855
|
||||
BUG_THREAD = 56363
|
||||
|
||||
SIDEBAR_THREAD = 5403
|
||||
|
|
|
@ -123,4 +123,4 @@ def notify_mentions(mentions, send_to=None, mention_str='site mention'):
|
|||
notif = Notification(comment_id=new_comment.id, user_id=send_to)
|
||||
g.db.add(notif)
|
||||
|
||||
push_notif({send_to}, f'New mention of you on reddit by /u/{author}', '', f'{SITE_FULL}/comment/{new_comment.id}?read=true#context')
|
||||
push_notif({send_to}, f'New mention of you on reddit by /u/{author}', '', f'{SITE_FULL}/notification/{new_comment.id}')
|
||||
|
|
|
@ -54,7 +54,7 @@ def post_pid_comment_cid(cid, v, pid=None, anything=None, sub=None):
|
|||
elif comment.wall_user_id:
|
||||
return redirect(f"/id/{comment.wall_user_id}/wall/comment/{comment.id}")
|
||||
else:
|
||||
post = NOTIFICATION_THREAD
|
||||
return redirect(f"/notification/{comment.id}")
|
||||
|
||||
if v and request.values.get("read"):
|
||||
gevent.spawn(_mark_comment_as_read, comment.id, v.id)
|
||||
|
|
|
@ -9,6 +9,7 @@ from files.helpers.config.const import *
|
|||
from files.helpers.config.modaction_types import *
|
||||
from files.helpers.get import *
|
||||
from files.routes.wrappers import *
|
||||
from files.routes.comments import _mark_comment_as_read
|
||||
from files.__main__ import app
|
||||
|
||||
@app.post("/clear")
|
||||
|
@ -422,3 +423,26 @@ def notifications(v):
|
|||
standalone=True,
|
||||
render_replies=True,
|
||||
)
|
||||
|
||||
|
||||
@app.get("/notification//<int:cid>")
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||
@auth_required
|
||||
def notification(v, cid):
|
||||
comment = get_comment(cid, v=v)
|
||||
|
||||
if not User.can_see(v, comment): abort(403)
|
||||
|
||||
comment.unread = True
|
||||
|
||||
gevent.spawn(_mark_comment_as_read, comment.id, v.id)
|
||||
|
||||
return render_template("notifications.html",
|
||||
v=v,
|
||||
notifications=[comment],
|
||||
total=1,
|
||||
page=1,
|
||||
standalone=True,
|
||||
render_replies=True,
|
||||
)
|
||||
|
|
|
@ -93,7 +93,7 @@ def request_api_keys(v):
|
|||
notif = Notification(comment_id=new_comment.id, user_id=admin_id)
|
||||
g.db.add(notif)
|
||||
|
||||
push_notif(admin_ids, 'New notification', body, f'{SITE_FULL}/comment/{new_comment.id}?read=true#context')
|
||||
push_notif(admin_ids, 'New notification', body, f'{SITE_FULL}/admin/apps')
|
||||
|
||||
return {"message": "API keys requested successfully!"}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div class="col p-0 w-100">
|
||||
<ul class="nav settings-nav" style="padding:0 0 0 20px" id="notifications--nav-list">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link py-3{% if request.path == '/notifications' %} active{% endif %}" href="/notifications">
|
||||
<a class="nav-link py-3{% if request.path == '/notifications' or request.path.startswith('/notification/') %} active{% endif %}" href="/notifications">
|
||||
All {% if v.normal_notifications_count %}<span class="font-weight-bold" style="color:#dc3545">({{v.normal_notifications_count}})</span>{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
|
@ -50,7 +50,11 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-primary btn-rainbow ml-3 mt-4" data-nonce="{{g.nonce}}" data-onclick="postToastReload(this,'/clear')">Mark all notifications as read</button>
|
||||
{% if request.path.startswith('/notification/') %}
|
||||
<div class="mt-4 mb-5 ml-3 text-lg"><a href="/notifications">View all notifications <i class="fas fa-long-arrow-right ml-1"></i></a></div>
|
||||
{% else %}
|
||||
<button type="button" class="btn btn-primary btn-rainbow ml-3 mt-4" data-nonce="{{g.nonce}}" data-onclick="postToastReload(this,'/clear')">Mark all notifications as read</button>
|
||||
{% endif %}
|
||||
|
||||
<div class="notifs px-3 p-md-0">
|
||||
|
||||
|
|
Loading…
Reference in New Issue