unpin award
This commit is contained in:
parent
68510e964b
commit
b69daaabc9
8 changed files with 94 additions and 14 deletions
|
@ -64,6 +64,14 @@ if site_name == "Drama":
|
||||||
"color": "text-warning",
|
"color": "text-warning",
|
||||||
"price": 750
|
"price": 750
|
||||||
},
|
},
|
||||||
|
"unpin": {
|
||||||
|
"kind": "unpin",
|
||||||
|
"title": "1-Hour Unpin",
|
||||||
|
"description": "Removes 1 hour from the pin duration of the post.",
|
||||||
|
"icon": "fas fa-thumbtack",
|
||||||
|
"color": "text-black",
|
||||||
|
"price": 1000
|
||||||
|
},
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
AWARDS = {
|
AWARDS = {
|
||||||
|
@ -99,6 +107,14 @@ else:
|
||||||
"color": "text-warning",
|
"color": "text-warning",
|
||||||
"price": 750
|
"price": 750
|
||||||
},
|
},
|
||||||
|
"unpin": {
|
||||||
|
"kind": "unpin",
|
||||||
|
"title": "1-Hour Unpin",
|
||||||
|
"description": "Removes 1 hour from the pin duration of the post.",
|
||||||
|
"icon": "fas fa-thumbtack",
|
||||||
|
"color": "text-black",
|
||||||
|
"price": 1000
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,14 @@ if site_name == "Drama":
|
||||||
"color": "text-warning",
|
"color": "text-warning",
|
||||||
"price": 750
|
"price": 750
|
||||||
},
|
},
|
||||||
|
"unpin": {
|
||||||
|
"kind": "unpin",
|
||||||
|
"title": "1-Hour Unpin",
|
||||||
|
"description": "Removes 1 hour from the pin duration of the post.",
|
||||||
|
"icon": "fas fa-thumbtack",
|
||||||
|
"color": "text-black",
|
||||||
|
"price": 1000
|
||||||
|
},
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
AWARDS = {
|
AWARDS = {
|
||||||
|
@ -116,6 +124,14 @@ else:
|
||||||
"color": "text-warning",
|
"color": "text-warning",
|
||||||
"price": 750
|
"price": 750
|
||||||
},
|
},
|
||||||
|
"unpin": {
|
||||||
|
"kind": "unpin",
|
||||||
|
"title": "1-Hour Unpin",
|
||||||
|
"description": "Removes 1 hour from the pin duration of the post.",
|
||||||
|
"icon": "fas fa-thumbtack",
|
||||||
|
"color": "text-black",
|
||||||
|
"price": 1000
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
class User(Base):
|
class User(Base):
|
||||||
|
|
|
@ -192,12 +192,14 @@ def monthly(v):
|
||||||
grant_awards["fireflies"] = 10
|
grant_awards["fireflies"] = 10
|
||||||
grant_awards["train"] = 10
|
grant_awards["train"] = 10
|
||||||
grant_awards["ban"] = 5
|
grant_awards["ban"] = 5
|
||||||
|
grant_awards["pin"] = 1
|
||||||
elif u.patron == 5 or u.patron == 8:
|
elif u.patron == 5 or u.patron == 8:
|
||||||
grant_awards["shit"] = 20
|
grant_awards["shit"] = 20
|
||||||
grant_awards["fireflies"] = 20
|
grant_awards["fireflies"] = 20
|
||||||
grant_awards["train"] = 20
|
grant_awards["train"] = 20
|
||||||
grant_awards["ban"] = 10
|
grant_awards["ban"] = 10
|
||||||
|
grant_awards["pin"] = 2
|
||||||
|
grant_awards["unpin"] = 1
|
||||||
|
|
||||||
for name in grant_awards:
|
for name in grant_awards:
|
||||||
for count in range(grant_awards[name]):
|
for count in range(grant_awards[name]):
|
||||||
|
@ -439,12 +441,15 @@ def badge_grant_post(v):
|
||||||
grant_awards["fireflies"] = 10
|
grant_awards["fireflies"] = 10
|
||||||
grant_awards["train"] = 10
|
grant_awards["train"] = 10
|
||||||
grant_awards["ban"] = 5
|
grant_awards["ban"] = 5
|
||||||
|
grant_awards["pin"] = 1
|
||||||
elif badge_id == 25:
|
elif badge_id == 25:
|
||||||
if user.discord_id: add_role(user, "5")
|
if user.discord_id: add_role(user, "5")
|
||||||
grant_awards["shit"] = 20
|
grant_awards["shit"] = 20
|
||||||
grant_awards["fireflies"] = 20
|
grant_awards["fireflies"] = 20
|
||||||
grant_awards["train"] = 20
|
grant_awards["train"] = 20
|
||||||
grant_awards["ban"] = 10
|
grant_awards["ban"] = 10
|
||||||
|
grant_awards["pin"] = 2
|
||||||
|
grant_awards["unpin"] = 1
|
||||||
|
|
||||||
if len(grant_awards):
|
if len(grant_awards):
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,14 @@ def shop(v):
|
||||||
"color": "text-warning",
|
"color": "text-warning",
|
||||||
"price": 750
|
"price": 750
|
||||||
},
|
},
|
||||||
|
"unpin": {
|
||||||
|
"kind": "unpin",
|
||||||
|
"title": "1-Hour Unpin",
|
||||||
|
"description": "Removes 1 hour from the pin duration of the post.",
|
||||||
|
"icon": "fas fa-thumbtack",
|
||||||
|
"color": "text-black",
|
||||||
|
"price": 1000
|
||||||
|
},
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
AWARDS = {
|
AWARDS = {
|
||||||
|
@ -104,6 +112,14 @@ def shop(v):
|
||||||
"color": "text-warning",
|
"color": "text-warning",
|
||||||
"price": 750
|
"price": 750
|
||||||
},
|
},
|
||||||
|
"unpin": {
|
||||||
|
"kind": "unpin",
|
||||||
|
"title": "1-Hour Unpin",
|
||||||
|
"description": "Removes 1 hour from the pin duration of the post.",
|
||||||
|
"icon": "fas fa-thumbtack",
|
||||||
|
"color": "text-black",
|
||||||
|
"price": 1000
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
query = g.db.query(
|
query = g.db.query(
|
||||||
|
@ -194,6 +210,14 @@ def buy(v, award):
|
||||||
"color": "text-warning",
|
"color": "text-warning",
|
||||||
"price": 750
|
"price": 750
|
||||||
},
|
},
|
||||||
|
"unpin": {
|
||||||
|
"kind": "unpin",
|
||||||
|
"title": "1-Hour Unpin",
|
||||||
|
"description": "Removes 1 hour from the pin duration of the post.",
|
||||||
|
"icon": "fas fa-thumbtack",
|
||||||
|
"color": "text-black",
|
||||||
|
"price": 1000
|
||||||
|
},
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
AWARDS = {
|
AWARDS = {
|
||||||
|
@ -229,6 +253,14 @@ def buy(v, award):
|
||||||
"color": "text-warning",
|
"color": "text-warning",
|
||||||
"price": 750
|
"price": 750
|
||||||
},
|
},
|
||||||
|
"unpin": {
|
||||||
|
"kind": "unpin",
|
||||||
|
"title": "1-Hour Unpin",
|
||||||
|
"description": "Removes 1 hour from the pin duration of the post.",
|
||||||
|
"icon": "fas fa-thumbtack",
|
||||||
|
"color": "text-black",
|
||||||
|
"price": 1000
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if award not in AWARDS: abort(400)
|
if award not in AWARDS: abort(400)
|
||||||
|
@ -337,6 +369,14 @@ def award_post(pid, v):
|
||||||
post.stickied = f"t:{t}"
|
post.stickied = f"t:{t}"
|
||||||
g.db.add(post)
|
g.db.add(post)
|
||||||
cache.delete_memoized(frontlist)
|
cache.delete_memoized(frontlist)
|
||||||
|
elif kind == "unpin":
|
||||||
|
if not (post.stickied and post.stickied.startswith("t:")): abort(403)
|
||||||
|
t = int(post.stickied[2:]) - 3600
|
||||||
|
if time.time() > t:
|
||||||
|
post.stickied = None
|
||||||
|
cache.delete_memoized(frontlist)
|
||||||
|
else: post.stickied = f"t:{t}"
|
||||||
|
g.db.add(post)
|
||||||
|
|
||||||
post.author.received_award_count += 1
|
post.author.received_award_count += 1
|
||||||
g.db.add(post.author)
|
g.db.add(post.author)
|
||||||
|
|
|
@ -515,11 +515,11 @@ def submit_post(v):
|
||||||
# filtered = dict((k, v) for k, v in qd.items() if not k.startswith('utm_'))
|
# filtered = dict((k, v) for k, v in qd.items() if not k.startswith('utm_'))
|
||||||
|
|
||||||
# new_url = ParseResult(scheme="https",
|
# new_url = ParseResult(scheme="https",
|
||||||
# netloc=parsed_url.netloc,
|
# netloc=parsed_url.netloc,
|
||||||
# path=parsed_url.path,
|
# path=parsed_url.path,
|
||||||
# params=parsed_url.params,
|
# params=parsed_url.params,
|
||||||
# query=urlencode(filtered, doseq=True),
|
# query=urlencode(filtered, doseq=True),
|
||||||
# fragment=parsed_url.fragment)
|
# fragment=parsed_url.fragment)
|
||||||
# url = urlunparse(new_url)
|
# url = urlunparse(new_url)
|
||||||
|
|
||||||
repost = g.db.query(Submission).options(lazyload('*')).filter(
|
repost = g.db.query(Submission).options(lazyload('*')).filter(
|
||||||
|
|
|
@ -328,12 +328,15 @@ def gumroad(v):
|
||||||
grant_awards["fireflies"] = 10
|
grant_awards["fireflies"] = 10
|
||||||
grant_awards["train"] = 10
|
grant_awards["train"] = 10
|
||||||
grant_awards["ban"] = 5
|
grant_awards["ban"] = 5
|
||||||
|
grant_awards["pin"] = 1
|
||||||
elif tier == 5 or tier == 8:
|
elif tier == 5 or tier == 8:
|
||||||
if v.discord_id: add_role(v, "5")
|
if v.discord_id: add_role(v, "5")
|
||||||
grant_awards["shit"] = 20
|
grant_awards["shit"] = 20
|
||||||
grant_awards["fireflies"] = 20
|
grant_awards["fireflies"] = 20
|
||||||
grant_awards["train"] = 20
|
grant_awards["train"] = 20
|
||||||
grant_awards["ban"] = 10
|
grant_awards["ban"] = 10
|
||||||
|
grant_awards["pin"] = 2
|
||||||
|
grant_awards["unpin"] = 1
|
||||||
|
|
||||||
thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id
|
thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
@media (min-width: 767.98px) {
|
@media (min-width: 767.98px) {
|
||||||
.award-columns {
|
.award-columns {
|
||||||
column-count: 7 !important;
|
column-count: 8 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -823,10 +823,10 @@
|
||||||
window.localStorage.setItem("comment-counts", JSON.stringify(comments))
|
window.localStorage.setItem("comment-counts", JSON.stringify(comments))
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if p.stickied %}
|
{% if p.stickied %}
|
||||||
const pinned_info = document.getElementById('pinned-{{p.id}}')
|
const pinned_info = document.getElementById('pinned-{{p.id}}')
|
||||||
{% if p.stickied.startswith('t:') %}
|
{% if p.stickied.startswith('t:') %}
|
||||||
pinned_info.setAttribute("data-bs-original-title", `Pinned until ${Date({{p.stickied[2:]}}).toString()}`)
|
pinned_info.setAttribute("data-bs-original-title", `Pinned until ${new Date({{p.stickied[2:]}} * 1000).toString()}`)
|
||||||
{% else %}
|
{% else %}
|
||||||
pinned_info.setAttribute("data-bs-original-title", "Pinned by @{{p.stickied}}")
|
pinned_info.setAttribute("data-bs-original-title", "Pinned by @{{p.stickied}}")
|
||||||
{%endif%}
|
{%endif%}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue