more fixes

pull/139/head
Aevann 2023-03-15 06:47:47 +02:00
parent f768d81103
commit a068d22213
7 changed files with 2 additions and 12 deletions

View File

@ -7,6 +7,7 @@ from sqlalchemy.sql.sqltypes import *
from files.classes import Base from files.classes import Base
from files.helpers.lazy import lazy from files.helpers.lazy import lazy
from files.helpers.regex import censor_slurs from files.helpers.regex import censor_slurs
from files.helpers.config.const import *
class HatDef(Base): class HatDef(Base):
__tablename__ = "hat_defs" __tablename__ = "hat_defs"

View File

@ -106,7 +106,6 @@ class User(Base):
shadowbanned = Column(Integer, ForeignKey("users.id")) shadowbanned = Column(Integer, ForeignKey("users.id"))
chudded_by = Column(Integer, ForeignKey("users.id")) chudded_by = Column(Integer, ForeignKey("users.id"))
over_18 = Column(Boolean, default=False) over_18 = Column(Boolean, default=False)
hidevotedon = Column(Boolean, default=False)
slurreplacer = Column(Integer, default=1) slurreplacer = Column(Integer, default=1)
profanityreplacer = Column(Integer, default=1) profanityreplacer = Column(Integer, default=1)
flairchanged = Column(Integer) flairchanged = Column(Integer)
@ -491,7 +490,6 @@ class User(Base):
def referral_count(self): def referral_count(self):
return len(self.referrals) return len(self.referrals)
@lazy
def has_blocked(self, target): def has_blocked(self, target):
return db.query(UserBlock).filter_by(user_id=self.id, target_id=target.id).one_or_none() return db.query(UserBlock).filter_by(user_id=self.id, target_id=target.id).one_or_none()

View File

@ -2,6 +2,7 @@ from flask import g
from files.classes.badges import Badge from files.classes.badges import Badge
from files.helpers.alerts import send_repeatable_notification from files.helpers.alerts import send_repeatable_notification
from files.helpers.config.const import *
def badge_grant(user, badge_id, description=None, url=None, notify=True): def badge_grant(user, badge_id, description=None, url=None, notify=True):
assert user != None assert user != None

View File

@ -66,7 +66,6 @@ def front_all(v, sub=None, subdomain=None):
posts = get_posts(ids, v=v, eager=True) posts = get_posts(ids, v=v, eager=True)
if v: if v:
if v.hidevotedon: posts = [x for x in posts if not hasattr(x, 'voted') or not x.voted]
award_timers(v) award_timers(v)
if v and v.client: return {"data": [x.json for x in posts], "next_exists": next_exists} if v and v.client: return {"data": [x.json for x in posts], "next_exists": next_exists}
@ -79,11 +78,6 @@ LIMITED_WPD_HOLES = ('gore', 'aftermath', 'selfharm', 'meta', 'discussion', 'soc
def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='', gt=0, lt=0, sub=None, site=None, pins=True, holes=True): def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='', gt=0, lt=0, sub=None, site=None, pins=True, holes=True):
posts = db.query(Submission) posts = db.query(Submission)
if v and v.hidevotedon:
posts = posts.outerjoin(Vote,
and_(Vote.submission_id == Submission.id, Vote.user_id == v.id)
).filter(Vote.submission_id == None)
if sub: posts = posts.filter(Submission.sub == sub.name) if sub: posts = posts.filter(Submission.sub == sub.name)
elif v: posts = posts.filter(or_(Submission.sub == None, Submission.sub.notin_(v.all_blocks))) elif v: posts = posts.filter(or_(Submission.sub == None, Submission.sub.notin_(v.all_blocks)))

View File

@ -183,7 +183,6 @@ def settings_personal_post(v):
db.add(v) db.add(v)
return profanity_filter_updated return profanity_filter_updated
updated = updated or update_flag("hidevotedon", "hidevotedon")
updated = updated or update_flag("newtab", "newtab") updated = updated or update_flag("newtab", "newtab")
updated = updated or update_flag("newtabexternal", "newtabexternal") updated = updated or update_flag("newtabexternal", "newtabexternal")
updated = updated or update_flag("nitter", "nitter") updated = updated or update_flag("nitter", "nitter")

View File

@ -132,7 +132,6 @@
{% if FEATURES['NSFW_MARKING'] %} {% if FEATURES['NSFW_MARKING'] %}
{{common.toggle_section('Disable +18 Warnings', 'over_18', 'over_18', v.over_18, "Disable the warnings that appear when viewing +18 content.", false)}} {{common.toggle_section('Disable +18 Warnings', 'over_18', 'over_18', v.over_18, "Disable the warnings that appear when viewing +18 content.", false)}}
{% endif %} {% endif %}
{{common.toggle_section('Hide Posts Voted On', 'hidevotedon', 'hidevotedon', v.hidevotedon, 'Enable if you would like to automatically hide posts you have voted on from your frontpage.', false)}}
<div class="d-lg-flex border-bottom"> <div class="d-lg-flex border-bottom">
<div class="title w-lg-25"> <div class="title w-lg-25">
<label for="custom-filter">Custom Filters</label> <label for="custom-filter">Custom Filters</label>

View File

@ -984,7 +984,6 @@ CREATE TABLE public.users (
titlecolor character varying(6) NOT NULL, titlecolor character varying(6) NOT NULL,
profileurl character varying(65), profileurl character varying(65),
bannerurl character varying(65), bannerurl character varying(65),
hidevotedon boolean DEFAULT false NOT NULL,
newtab boolean DEFAULT false NOT NULL, newtab boolean DEFAULT false NOT NULL,
flairchanged integer, flairchanged integer,
defaultsortingcomments character varying(15) NOT NULL, defaultsortingcomments character varying(15) NOT NULL,
@ -2880,4 +2879,3 @@ ALTER TABLE ONLY public.comments
-- --
-- PostgreSQL database dump complete -- PostgreSQL database dump complete
-- --