Implement #380: remove signatures feature.
This commit is contained in:
parent
c85cd469a1
commit
010c56a35e
9 changed files with 32 additions and 94 deletions
|
@ -375,9 +375,6 @@ class Comment(Base):
|
|||
g.db.add(self)
|
||||
g.db.commit()
|
||||
|
||||
if self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and v.sigs_disabled))):
|
||||
body += f"<hr>{self.author.sig_html}"
|
||||
|
||||
return body
|
||||
|
||||
def plainbody(self, v):
|
||||
|
|
|
@ -377,9 +377,6 @@ class Submission(Base):
|
|||
g.db.add(self)
|
||||
g.db.commit()
|
||||
|
||||
if self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and v.sigs_disabled))):
|
||||
body += f"<hr>{self.author.sig_html}"
|
||||
|
||||
return body
|
||||
|
||||
def plainbody(self, v):
|
||||
|
|
|
@ -95,10 +95,7 @@ class User(Base):
|
|||
controversial = Column(Boolean, default=False, nullable=False)
|
||||
bio = deferred(Column(String))
|
||||
bio_html = Column(String)
|
||||
sig = deferred(Column(String))
|
||||
sig_html = Column(String)
|
||||
fp = Column(String)
|
||||
sigs_disabled = Column(Boolean)
|
||||
fish = Column(Boolean)
|
||||
progressivestack = Column(Integer)
|
||||
deflector = Column(Integer)
|
||||
|
|
|
@ -35,7 +35,6 @@ PIZZA_VOTERS = ()
|
|||
IDIO_ID = 0
|
||||
CARP_ID = 0
|
||||
JOAN_ID = 0
|
||||
MOOSE_ID = 0
|
||||
AEVANN_ID = 9
|
||||
HOMO_ID = 0
|
||||
SOREN_ID = 0
|
||||
|
|
|
@ -61,7 +61,6 @@ def inject_constants():
|
|||
"CC":CC,
|
||||
"CC_TITLE":CC_TITLE,
|
||||
"listdir":listdir,
|
||||
"MOOSE_ID":MOOSE_ID,
|
||||
"AEVANN_ID":AEVANN_ID,
|
||||
"PIZZASHILL_ID":PIZZASHILL_ID,
|
||||
"config":app.config.get,
|
||||
|
|
|
@ -78,10 +78,6 @@ def settings_profile_post(v):
|
|||
updated = True
|
||||
v.controversial = request.values.get("controversial") == 'true'
|
||||
|
||||
elif request.values.get("sigs_disabled", v.sigs_disabled) != v.sigs_disabled:
|
||||
updated = True
|
||||
v.sigs_disabled = request.values.get("sigs_disabled") == 'true'
|
||||
|
||||
elif request.values.get("over18", v.over_18) != v.over_18:
|
||||
updated = True
|
||||
v.over_18 = request.values.get("over18") == 'true'
|
||||
|
@ -101,13 +97,6 @@ def settings_profile_post(v):
|
|||
g.db.commit()
|
||||
return render_template("settings_profile.html", v=v, msg="Your bio has been updated.")
|
||||
|
||||
elif request.values.get("sig") == "":
|
||||
v.sig = None
|
||||
v.sig_html = None
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
return render_template("settings_profile.html", v=v, msg="Your sig has been updated.")
|
||||
|
||||
elif request.values.get("friends") == "":
|
||||
v.friends = None
|
||||
v.friends_html = None
|
||||
|
@ -122,27 +111,6 @@ def settings_profile_post(v):
|
|||
g.db.commit()
|
||||
return render_template("settings_profile.html", v=v, msg="Your enemies list has been updated.")
|
||||
|
||||
elif (v.patron or v.id == MOOSE_ID) and request.values.get("sig"):
|
||||
sig = request.values.get("sig")[:200]
|
||||
|
||||
sig_html = sanitize(sig)
|
||||
|
||||
if len(sig_html) > 1000:
|
||||
return render_template("settings_profile.html",
|
||||
v=v,
|
||||
error="Your sig is too long")
|
||||
|
||||
v.sig = sig[:200]
|
||||
v.sig_html=sig_html
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
return render_template("settings_profile.html",
|
||||
v=v,
|
||||
msg="Your sig has been updated.")
|
||||
|
||||
|
||||
|
||||
|
||||
elif request.values.get("friends"):
|
||||
friends = request.values.get("friends")[:500]
|
||||
|
||||
|
|
|
@ -219,28 +219,6 @@
|
|||
|
||||
<div class="settings-section rounded">
|
||||
|
||||
|
||||
<div class="d-lg-flex border-bottom">
|
||||
|
||||
<div class="title w-lg-25">
|
||||
<label for="sigs_disabled">Disable signatures</label>
|
||||
</div>
|
||||
|
||||
<div class="body w-lg-100">
|
||||
|
||||
<div class="custom-control custom-switch">
|
||||
<input autocomplete="off" type="checkbox" class="custom-control-input" id="sigs_disabled" name="sigs_disabled"{% if v.sigs_disabled %} checked{% endif %} onchange="post_toast(this,'/settings/profile?sigs_disabled='+document.getElementById('sigs_disabled').checked);">
|
||||
<label class="custom-control-label" for="sigs_disabled"></label>
|
||||
</div>
|
||||
|
||||
<span class="text-small-extra text-muted">Hide user signatures.</span>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="d-lg-flex border-bottom">
|
||||
|
||||
<div class="title w-lg-25">
|
||||
|
|
|
@ -421,35 +421,6 @@
|
|||
|
||||
</div>
|
||||
|
||||
{% if v.patron or v.id == MOOSE_ID %}
|
||||
<div class="body d-lg-flex border-bottom">
|
||||
<label class="text-black w-lg-25">Signature</label>
|
||||
|
||||
<div class="w-lg-100">
|
||||
<form id="profile-sig" action="/settings/profile" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
<div class="input-group mb-2">
|
||||
<textarea autocomplete="off" id="sig-text" class="form-control rounded" aria-label="With textarea" placeholder="Enter a signature..." rows="3" name="sig" form="profile-sig" maxlength="200">{% if v.sig %}{{v.sig}}{% endif %}</textarea>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<pre style="padding-top:0.7rem" class="btn btn-secondary format d-inline-block m-0 fas fa-bold" aria-hidden="true" onclick="makeBold('sig-text')" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Bold"></pre>
|
||||
|
||||
<pre style="padding-top:0.7rem" class="btn btn-secondary format d-inline-block m-0 fas fa-italic" aria-hidden="true" onclick="makeItalics('sig-text')" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Italicize"></pre>
|
||||
|
||||
<pre style="padding-top:0.7rem" class="btn btn-secondary format d-inline-block m-0 fas fa-quote-right" aria-hidden="true" onclick="makeQuote('sig-text')" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Quote"></pre>
|
||||
|
||||
<pre style="padding-top:0.7rem;line-height:1" class="btn btn-secondary format d-inline-block m-0 font-weight-bolder text-uppercase" onclick="commentForm('sig-text');getGif()" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#gifModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add GIF">GIF</pre>
|
||||
</div>
|
||||
<pre></pre>
|
||||
<div class="d-flex">
|
||||
<small>Limit of 200 characters</small>
|
||||
<input autocomplete="off" class="btn btn-primary ml-auto" id="sigSave" type="submit" value="Save Changes">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="d-lg-flex border-bottom">
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
"""remove signatures feature
|
||||
|
||||
Revision ID: 61c6f838c5c6
|
||||
Revises: 44a40481ca2b
|
||||
Create Date: 2022-11-06 22:06:07.735203+00:00
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '61c6f838c5c6'
|
||||
down_revision = '44a40481ca2b'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('users', 'sigs_disabled')
|
||||
op.drop_column('users', 'sig_html')
|
||||
op.drop_column('users', 'sig')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('users', sa.Column('sig', sa.VARCHAR(length=200), autoincrement=False, nullable=True))
|
||||
op.add_column('users', sa.Column('sig_html', sa.VARCHAR(length=1000), autoincrement=False, nullable=True))
|
||||
op.add_column('users', sa.Column('sigs_disabled', sa.BOOLEAN(), autoincrement=False, nullable=True))
|
||||
# ### end Alembic commands ###
|
Loading…
Add table
Add a link
Reference in a new issue