diff --git a/files/__main__.py b/files/__main__.py
index e90ac9eb75..550bfb785d 100644
--- a/files/__main__.py
+++ b/files/__main__.py
@@ -57,7 +57,7 @@ app.config["RATELIMIT_ENABLED"] = True
app.config["RATELIMIT_DEFAULTS_DEDUCT_WHEN"]=lambda:True
app.config["RATELIMIT_DEFAULTS_EXEMPT_WHEN"]=lambda:False
app.config["RATELIMIT_HEADERS_ENABLED"]=True
-app.config["CACHE_TYPE"] = "redis"
+app.config["CACHE_TYPE"] = "filesystem"
app.config["CACHE_DIR"] = "cache"
app.config["RATELIMIT_STORAGE_URL"] = environ.get("REDIS_URL", "redis://localhost")
app.config['MAIL_SERVER'] = 'smtp.gmail.com'
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 1ca388280c..3e5d6bf67d 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -1029,14 +1029,14 @@ def api_sticky_post(post_id, v):
post = g.db.query(Submission).filter_by(id=post_id).first()
if post:
if post.stickied:
- if post.stickied.startswith("t:"): return {"error": "Can't unpin temporary pins!"}, 403
+ if post.stickied.startswith("t:"): return {"error": "Can't unpin award pins!"}, 403
else: post.stickied = None
else:
pins = g.db.query(Submission.id).filter(Submission.stickied != None, Submission.is_banned == False).count()
if pins > 2:
if v.admin_level > 2:
t = int(time.time()) + 3600
- post.stickied = f"t:{t}"
+ post.stickied = f"j:{t}"
else: return {"error": "Can't exceed 3 pinned posts limit!"}, 403
else: post.stickied = v.username
g.db.add(post)
diff --git a/files/routes/front.py b/files/routes/front.py
index 47841003fc..54757a2442 100644
--- a/files/routes/front.py
+++ b/files/routes/front.py
@@ -276,10 +276,20 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
blocked = [x[0] for x in g.db.query(UserBlock.user_id).filter_by(target_id=v.id).all()]
pins = pins.filter(Submission.author_id.notin_(blocking), Submission.author_id.notin_(blocked))
- posts = pins.all() + posts
+ pins = pins.all()
+
+ for pin in pins:
+ if (pin.stickied.startswith("t:") or pin.stickied.startswith("j:")) and int(time.time()) > int(pin.stickied[2:]):
+ pin.stickied = None
+ g.db.add(pin)
+ pins.remove(pin)
+
+ posts = pins + posts
if ids_only: posts = [x.id for x in posts]
+ g.db.commit()
+
return posts, next_exists
diff --git a/files/routes/posts.py b/files/routes/posts.py
index 36176934e4..a029bcf37a 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -217,6 +217,12 @@ def post_id(pid, anything=None, v=None):
if len(comments) == len(comments2): offset = None
comments = comments2
+ for pin in pinned:
+ if pin.is_pinned.startswith("t:") and int(time.time()) > int(pin.is_pinned[2:]):
+ pin.is_pinned = None
+ g.db.add(pin)
+ pinned.remove(pin)
+
post.replies = pinned + comments
post.views += 1
diff --git a/files/routes/votes.py b/files/routes/votes.py
index 34093b4b59..52680c90bb 100644
--- a/files/routes/votes.py
+++ b/files/routes/votes.py
@@ -5,7 +5,6 @@ from files.classes import *
from flask import *
from files.__main__ import app, limiter, cache
from sqlalchemy.orm import joinedload
-from .front import frontlist
from os import environ
defaultcolor = environ.get("DEFAULT_COLOR").strip()
@@ -114,11 +113,6 @@ def api_vote_post(post_id, new, v):
real = real
)
g.db.add(vote)
-
- if post.stickied and post.stickied.startswith("t:") and int(time.time()) > int(post.stickied[2:]):
- post.stickied = None
- g.db.add(post)
- cache.delete_memoized(frontlist)
try:
g.db.flush()
@@ -187,10 +181,6 @@ def api_vote_comment(comment_id, new, v):
g.db.add(vote)
- if comment.is_pinned and comment.is_pinned.startswith("t:") and int(time.time()) > int(comment.is_pinned[2:]):
- comment.is_pinned = None
- g.db.add(comment)
-
try:
g.db.flush()
comment.upvotes = g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=1).count()
diff --git a/files/templates/submission.html b/files/templates/submission.html
index 147dc51529..9cf0341ab6 100644
--- a/files/templates/submission.html
+++ b/files/templates/submission.html
@@ -323,7 +323,7 @@
{% endif %}
{% if v and v.admin_level > 1 and p.author.shadowbanned %}{% endif %}
- {% if p.stickied and p.stickied.startswith('t:') %}
+ {% if p.stickied and (p.stickied.startswith('t:') or p.stickied.startswith('j:')) %}
{% elif p.stickied %}
diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html
index 3c312bf54e..6a1c7941a5 100644
--- a/files/templates/submission_listing.html
+++ b/files/templates/submission_listing.html
@@ -166,7 +166,7 @@
{% endif %}
{% if v and v.admin_level > 1 and p.author.shadowbanned %}{% endif %}
- {% if p.stickied and p.stickied.startswith('t:') %}
+ {% if p.stickied and (p.stickied.startswith('t:') or p.stickied.startswith('j:')) %}
{% elif p.stickied %}
diff --git a/seed-db.sql b/seed-db.sql
index 2e5ee11a24..5ca86d0bae 100644
--- a/seed-db.sql
+++ b/seed-db.sql
@@ -34,5 +34,4 @@ INSERT INTO public.users (
'', 'dark', '30409f', false, false, '', '', 0, false, 0,
0, 0, '', true, 0);
-
-SELECT pg_catalog.setval('public.users_id_seq', 6, true);
\ No newline at end of file
+SELECT pg_catalog.setval('public.users_id_seq', 7, true);
\ No newline at end of file