forked from rDrama/rDrama
Merge branch 'frost' of https://github.com/Aevann1/Drama into frost
commit
42ca4cc7c0
|
@ -295,8 +295,6 @@ class Comment(Base):
|
||||||
|
|
||||||
if self.level >= 2: data['parent_comment_id'] = self.parent_comment_id
|
if self.level >= 2: data['parent_comment_id'] = self.parent_comment_id
|
||||||
|
|
||||||
data['replies'] = [x.json_core for x in self.replies()]
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -313,6 +311,7 @@ class Comment(Base):
|
||||||
if self.level >= 2:
|
if self.level >= 2:
|
||||||
data["parent"]=self.parent.json_core
|
data["parent"]=self.parent.json_core
|
||||||
|
|
||||||
|
data['replies'] = [x.json_core for x in self.replies()]
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
|
@ -282,7 +282,7 @@ class Submission(Base):
|
||||||
|
|
||||||
|
|
||||||
if "replies" in self.__dict__:
|
if "replies" in self.__dict__:
|
||||||
data["replies"]=[x.json_core for x in self.replies]
|
data["replies"]=[x.json for x in self.replies]
|
||||||
|
|
||||||
if "voted" in self.__dict__:
|
if "voted" in self.__dict__:
|
||||||
data["voted"] = self.voted
|
data["voted"] = self.voted
|
||||||
|
|
|
@ -129,6 +129,7 @@ class User(Base):
|
||||||
total_held_lottery_tickets = Column(Integer, default=0)
|
total_held_lottery_tickets = Column(Integer, default=0)
|
||||||
total_lottery_winnings = Column(Integer, default=0)
|
total_lottery_winnings = Column(Integer, default=0)
|
||||||
last_viewed_post_notifs = Column(Integer, default=0)
|
last_viewed_post_notifs = Column(Integer, default=0)
|
||||||
|
pronouns = Column(String, default='they/them')
|
||||||
|
|
||||||
badges = relationship("Badge", order_by="Badge.created_utc", back_populates="user")
|
badges = relationship("Badge", order_by="Badge.created_utc", back_populates="user")
|
||||||
subscriptions = relationship("Subscription", back_populates="user")
|
subscriptions = relationship("Subscription", back_populates="user")
|
||||||
|
|
|
@ -101,6 +101,8 @@ search_token_regex = re.compile('"([^"]*)"|(\S+)', flags=re.A)
|
||||||
|
|
||||||
git_regex = re.compile("ref: (refs/.+)", flags=re.A)
|
git_regex = re.compile("ref: (refs/.+)", flags=re.A)
|
||||||
|
|
||||||
|
pronouns_regex = re.compile("[a-z]{1-5}\/[a-z]{1-5}", flags=re.A)
|
||||||
|
|
||||||
def sub_matcher(match, upper=False):
|
def sub_matcher(match, upper=False):
|
||||||
if match.group(0).startswith('<'):
|
if match.group(0).startswith('<'):
|
||||||
return match.group(0)
|
return match.group(0)
|
||||||
|
|
|
@ -30,7 +30,7 @@ def unread(v):
|
||||||
n.read = True
|
n.read = True
|
||||||
g.db.add(n)
|
g.db.add(n)
|
||||||
|
|
||||||
return {"data":[x[1].json for x in listing]}
|
return {"data":[x[1].json_core for x in listing]}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -880,6 +880,26 @@ def settings_title_change(v):
|
||||||
return redirect("/settings/profile")
|
return redirect("/settings/profile")
|
||||||
|
|
||||||
|
|
||||||
|
@app.post("/settings/pronouns_change")
|
||||||
|
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||||
|
@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{request.host}-{session.get("lo_user")}')
|
||||||
|
@auth_required
|
||||||
|
def settings_pronouns_change(v):
|
||||||
|
|
||||||
|
pronouns = request.values.get("pronouns").replace("𒐪","").lower().strip()
|
||||||
|
|
||||||
|
if pronouns == v.pronouns:
|
||||||
|
return render_template("settings_profile.html", v=v, error="You didn't change anything")
|
||||||
|
|
||||||
|
if not pronouns_regex.fullmatch(pronouns):
|
||||||
|
return render_template("settings_profile.html", v=v, error="The pronouns you entered don't match the required format {1-5 characters}/{1-5 characters}")
|
||||||
|
|
||||||
|
v.pronouns = pronouns
|
||||||
|
g.db.add(v)
|
||||||
|
|
||||||
|
return redirect("/settings/profile")
|
||||||
|
|
||||||
|
|
||||||
@app.post("/settings/checkmark_text")
|
@app.post("/settings/checkmark_text")
|
||||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||||
@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{request.host}-{session.get("lo_user")}')
|
@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{request.host}-{session.get("lo_user")}')
|
||||||
|
|
|
@ -206,6 +206,9 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span {% if c.author.patron and not c.distinguish_level %}class="patron" style="background-color:#{{c.author.namecolor}};"{% elif c.distinguish_level %}class="mod"{% endif %}>{{c.author_name}}</span>
|
<span {% if c.author.patron and not c.distinguish_level %}class="patron" style="background-color:#{{c.author.namecolor}};"{% elif c.distinguish_level %}class="mod"{% endif %}>{{c.author_name}}</span>
|
||||||
</a>
|
</a>
|
||||||
|
{% if SITE_NAME == 'rDrama' %}
|
||||||
|
<span class="pronouns" style="background-color:#{{c.author.titlecolor}}">{{c.author.pronouns}}</span>
|
||||||
|
{% endif %}
|
||||||
{% if c.author.customtitle %}
|
{% if c.author.customtitle %}
|
||||||
<bdi style="color: #{{c.author.titlecolor}}"> {{c.author.customtitle | safe}}</bdi>
|
<bdi style="color: #{{c.author.titlecolor}}"> {{c.author.customtitle | safe}}</bdi>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -154,6 +154,27 @@
|
||||||
<a class="nav-link" href="/shop" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Shop"><i class="fas fa-store"></i></a>
|
<a class="nav-link" href="/shop" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Shop"><i class="fas fa-store"></i></a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
<li class="nav-item d-flex align-items-center justify-content-center text-center mx-1">
|
||||||
|
<a class="nav-link" href="/marseys" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Marseys"><i class="fas fa-cat"></i></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item d-flex align-items-center justify-content-center text-center mx-1">
|
||||||
|
<a class="nav-link" href="/badges" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Badges"><i class="fas fa-hexagon"></i></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item d-flex align-items-center justify-content-center text-center mx-1">
|
||||||
|
<a class="nav-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item d-flex align-items-center justify-content-center text-center mx-1">
|
||||||
|
<a class="nav-link" href="/transfers" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Transfers"><i class="fas fa-arrow-right-arrow-left"></i></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item d-flex align-items-center justify-content-center text-center mx-1">
|
||||||
|
<a class="nav-link" href="/random_post" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Random Post"><i class="fas fa-random"></i></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item d-flex align-items-center justify-content-center text-center mx-1">
|
||||||
|
<a class="nav-link" href="/comments" data-bs-toggle="tooltip" data-bs-placement="bottom" title="All Comments"><i class="fas fa-comment-dots"></i></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
<li class="nav-item d-flex align-items-center justify-content-center text-center">
|
<li class="nav-item d-flex align-items-center justify-content-center text-center">
|
||||||
<div class="dropdown" id="header--dropdown">
|
<div class="dropdown" id="header--dropdown">
|
||||||
<a class="nav-link bg-transparent py-0 pr-0" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown"
|
<a class="nav-link bg-transparent py-0 pr-0" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown"
|
||||||
|
|
|
@ -458,6 +458,25 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="body d-lg-flex border-bottom">
|
||||||
|
|
||||||
|
<label class="text-black w-lg-25">Pronouns</label>
|
||||||
|
|
||||||
|
<div class="w-lg-100">
|
||||||
|
<form id="profile-settings" action="/settings/pronoun_change" method="post">
|
||||||
|
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||||
|
<input maxlength=9 autocomplete="off" id="pronounbody" type="text" name="pronouns" class="form-control" placeholder='Enter pronouns here' value="{% if v.pronouns %}{{v.pronouns}}{% endif %}">
|
||||||
|
<div class="d-flex mt-2">
|
||||||
|
<small>{1-5 characters} / {1-5 characters}</small>
|
||||||
|
<input autocomplete="off" class="btn btn-primary ml-auto" id="pronounsSave" type="submit" onclick="disable(this)" value="Change Pronouns">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="body d-lg-flex border-bottom">
|
<div class="body d-lg-flex border-bottom">
|
||||||
|
|
||||||
<label class="text-black w-lg-25">Flair</label>
|
<label class="text-black w-lg-25">Flair</label>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<img class="mb-4" alt="sidebar image" role="button" onclick="expandDesktopImage()" loading="lazy" src="{{image}}" width=100%>
|
<img class="mb-4" alt="sidebar image" role="button" onclick="expandDesktopImage()" loading="lazy" src="{{image}}" width=100%>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<p class="text-center text-md mb-4">
|
<p class="text-center text-md mb-4 d-md-none">
|
||||||
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
|
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
|
||||||
<a class="sidebar-link" href="/transfers" data-bs-toggle="tooltip" data-bs-placement="top" title="Transfers"><i class="fas fa-arrow-right-arrow-left"></i></a>
|
<a class="sidebar-link" href="/transfers" data-bs-toggle="tooltip" data-bs-placement="top" title="Transfers"><i class="fas fa-arrow-right-arrow-left"></i></a>
|
||||||
<a class="sidebar-link" href="/random_post/" data-bs-toggle="tooltip" data-bs-placement="top" title="Random Post"><i class="fas fa-random"></i></a>
|
<a class="sidebar-link" href="/random_post/" data-bs-toggle="tooltip" data-bs-placement="top" title="Random Post"><i class="fas fa-random"></i></a>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="text-center text-md mb-4">
|
<p class="text-center text-md mb-4 d-md-none">
|
||||||
<a class="sidebar-link" href="/admins" data-bs-toggle="tooltip" data-bs-placement="top" title="Admins"><i class="fas fa-crown"></i></a>
|
<a class="sidebar-link" href="/admins" data-bs-toggle="tooltip" data-bs-placement="top" title="Admins"><i class="fas fa-crown"></i></a>
|
||||||
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
|
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
|
||||||
<a class="sidebar-link" href="/transfers" data-bs-toggle="tooltip" data-bs-placement="top" title="Transfers"><i class="fas fa-arrow-right-arrow-left"></i></a>
|
<a class="sidebar-link" href="/transfers" data-bs-toggle="tooltip" data-bs-placement="top" title="Transfers"><i class="fas fa-arrow-right-arrow-left"></i></a>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="col sidebar text-left {% if '/sidebar' not in request.path %}d-none d-lg-block{% endif %} pt-3 bg-white" style="max-width:300px">
|
<div class="col sidebar text-left {% if '/sidebar' not in request.path %}d-none d-lg-block{% endif %} pt-3 bg-white" style="max-width:300px">
|
||||||
|
|
||||||
<p class="text-center text-md mb-4">
|
<p class="text-center text-md mb-4 d-md-none">
|
||||||
{% if v and v.can_gamble and LOTTERY_ENABLED -%}
|
{% if v and v.can_gamble and LOTTERY_ENABLED -%}
|
||||||
<a class="sidebar-link" href="/lottery" data-bs-toggle="tooltip" data-bs-placement="top" title="Lottery"><i class="fas fa-ticket"></i></a>
|
<a class="sidebar-link" href="/lottery" data-bs-toggle="tooltip" data-bs-placement="top" title="Lottery"><i class="fas fa-ticket"></i></a>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<img class="mb-4" alt="sidebar image" role="button" onclick="expandDesktopImage()" loading="lazy" src="{{image}}" width=100%>
|
<img class="mb-4" alt="sidebar image" role="button" onclick="expandDesktopImage()" loading="lazy" src="{{image}}" width=100%>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<p class="text-center text-md mb-4">
|
<p class="text-center text-md mb-4 d-md-none">
|
||||||
<a class="sidebar-link" href="/admins" data-bs-toggle="tooltip" data-bs-placement="top" title="Admins"><i class="fas fa-crown"></i></a>
|
<a class="sidebar-link" href="/admins" data-bs-toggle="tooltip" data-bs-placement="top" title="Admins"><i class="fas fa-crown"></i></a>
|
||||||
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
|
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
|
||||||
<a class="sidebar-link" href="/random_post/" data-bs-toggle="tooltip" data-bs-placement="top" title="Random Post"><i class="fas fa-random"></i></a>
|
<a class="sidebar-link" href="/random_post/" data-bs-toggle="tooltip" data-bs-placement="top" title="Random Post"><i class="fas fa-random"></i></a>
|
||||||
|
|
|
@ -54,7 +54,7 @@ set VISITORS_HERE_FLAVOR = [
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="text-center text-md mb-4">
|
<p class="text-center text-md mb-4 d-md-none">
|
||||||
<a class="sidebar-link" href="/marseys" data-bs-toggle="tooltip" data-bs-placement="top" title="Marseys"><i class="fas fa-cat"></i></a>
|
<a class="sidebar-link" href="/marseys" data-bs-toggle="tooltip" data-bs-placement="top" title="Marseys"><i class="fas fa-cat"></i></a>
|
||||||
<a class="sidebar-link" href="/badges" data-bs-toggle="tooltip" data-bs-placement="top" title="Badges"><i class="fas fa-hexagon"></i></a>
|
<a class="sidebar-link" href="/badges" data-bs-toggle="tooltip" data-bs-placement="top" title="Badges"><i class="fas fa-hexagon"></i></a>
|
||||||
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
|
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
|
||||||
|
|
|
@ -676,6 +676,9 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.namecolor}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span>
|
<span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.namecolor}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span>
|
||||||
</a>
|
</a>
|
||||||
|
{% if SITE_NAME == 'rDrama' %}
|
||||||
|
<span class="pronouns" style="background-color:#{{p.author.titlecolor}}">{{p.author.pronouns}}</span>
|
||||||
|
{% endif %}
|
||||||
{% if p.author.customtitle %}
|
{% if p.author.customtitle %}
|
||||||
<bdi style="color: #{{p.author.titlecolor}}"> {{p.author.customtitle | safe}}</bdi>
|
<bdi style="color: #{{p.author.titlecolor}}"> {{p.author.customtitle | safe}}</bdi>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -207,6 +207,9 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.namecolor}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span>
|
<span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.namecolor}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span>
|
||||||
</a>
|
</a>
|
||||||
|
{% if SITE_NAME == 'rDrama' %}
|
||||||
|
<span class="pronouns" style="background-color:#{{p.author.titlecolor}}">{{p.author.pronouns}}</span>
|
||||||
|
{% endif %}
|
||||||
{% if p.author.customtitle %}
|
{% if p.author.customtitle %}
|
||||||
<bdi style="color: #{{p.author.titlecolor}}"> {{p.author.customtitle | safe}}</bdi>
|
<bdi style="color: #{{p.author.titlecolor}}"> {{p.author.customtitle | safe}}</bdi>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{%-
|
{%-
|
||||||
set CACHE_VER = {
|
set CACHE_VER = {
|
||||||
'css/main.css': 385,
|
'css/main.css': 387,
|
||||||
|
|
||||||
'css/4chan.css': 61,
|
'css/4chan.css': 61,
|
||||||
'css/classic.css': 61,
|
'css/classic.css': 61,
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
alter table users add column pronouns varchar(11) not null default 'they/them';
|
||||||
|
alter table users alter column pronouns drop default;
|
Loading…
Reference in New Issue