diff --git a/env b/env index 27a5fb312..4d8b5c95f 100644 --- a/env +++ b/env @@ -2,8 +2,8 @@ export FLASK_APP="/rDrama/files/cli:app" export SITE="localhost" export SITE_NAME="rDrama" export SECRET_KEY="blahblahblah" -export DATABASE_URL="postgresql://postgres@localhost:5432" -export REDIS_URL="redis://localhost:6379" +export DATABASE_URL="postgresql://postgres@postgres:5432" +export REDIS_URL="redis://redis:6379" export PROXY_URL="http://localhost:18080" export LOG_DIRECTORY="/var/log/rdrama" export SETTINGS_FILENAME="/site_settings.json" diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 80702b306..254ebd957 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -3925,7 +3925,7 @@ ul.comment-section { border-left: none; top: -0.1px; left: -3px; - font-size: 10px; + font-size: 14px; } .comment.collapsed .comment-collapse-icon:hover::before { color: var(--primary); @@ -4774,7 +4774,7 @@ video { width: 10px; content: "\f056"; position: static; - font-size: 10px; + font-size: 14px; font-weight: 900; border: none; margin-left: 0.25rem; diff --git a/files/assets/css/midnight.css b/files/assets/css/midnight.css index 7bf953da5..86d17e0c8 100644 --- a/files/assets/css/midnight.css +++ b/files/assets/css/midnight.css @@ -66,5 +66,5 @@ h5.post-title a:visited { } .modal-content { - border: 3px var(--gray-500) solid; + border: 1px var(--gray-500) solid; } diff --git a/files/assets/css/transparent.css b/files/assets/css/transparent.css index c4ceb7c9b..a97d8ef43 100644 --- a/files/assets/css/transparent.css +++ b/files/assets/css/transparent.css @@ -16,6 +16,6 @@ background-color: #21262d !important; } -.App-side, .flaggers { +.App-side, .flaggers, .comment-section { background: transparent !important; } diff --git a/files/assets/images/PCM/app-chromium-lo-1.webp b/files/assets/images/PCM/app-chromium-lo-1.webp new file mode 100644 index 000000000..cbab3a0f9 Binary files /dev/null and b/files/assets/images/PCM/app-chromium-lo-1.webp differ diff --git a/files/assets/images/PCM/app-chromium-lo-2.webp b/files/assets/images/PCM/app-chromium-lo-2.webp new file mode 100644 index 000000000..8521b8e2c Binary files /dev/null and b/files/assets/images/PCM/app-chromium-lo-2.webp differ diff --git a/files/assets/images/PCM/banners_event/2022christmas1.webp b/files/assets/images/PCM/banners_event/2022christmas1.webp new file mode 100644 index 000000000..0e464b8ba Binary files /dev/null and b/files/assets/images/PCM/banners_event/2022christmas1.webp differ diff --git a/files/assets/images/WPD/app-chromium-lo-1.webp b/files/assets/images/WPD/app-chromium-lo-1.webp new file mode 100644 index 000000000..6ebd6ab91 Binary files /dev/null and b/files/assets/images/WPD/app-chromium-lo-1.webp differ diff --git a/files/assets/images/WPD/app-chromium-lo-2.webp b/files/assets/images/WPD/app-chromium-lo-2.webp new file mode 100644 index 000000000..0dfd768ea Binary files /dev/null and b/files/assets/images/WPD/app-chromium-lo-2.webp differ diff --git a/files/assets/images/rDrama/app-chromium-lo-1.webp b/files/assets/images/rDrama/app-chromium-lo-1.webp new file mode 100644 index 000000000..3b1d09db8 Binary files /dev/null and b/files/assets/images/rDrama/app-chromium-lo-1.webp differ diff --git a/files/assets/images/rDrama/app-chromium-lo-2.webp b/files/assets/images/rDrama/app-chromium-lo-2.webp new file mode 100644 index 000000000..48d77b380 Binary files /dev/null and b/files/assets/images/rDrama/app-chromium-lo-2.webp differ diff --git a/files/assets/images/rDrama/banner_error.webp b/files/assets/images/rDrama/banner_error.webp new file mode 100644 index 000000000..1a25c228f Binary files /dev/null and b/files/assets/images/rDrama/banner_error.webp differ diff --git a/files/assets/images/rDrama/sidebar/867.webp b/files/assets/images/rDrama/sidebar/867.webp new file mode 100644 index 000000000..4e45dc299 Binary files /dev/null and b/files/assets/images/rDrama/sidebar/867.webp differ diff --git a/files/assets/images/rDrama/sidebar/868.webp b/files/assets/images/rDrama/sidebar/868.webp new file mode 100644 index 000000000..8893f325c Binary files /dev/null and b/files/assets/images/rDrama/sidebar/868.webp differ diff --git a/files/assets/images/rDrama/sidebar/869.webp b/files/assets/images/rDrama/sidebar/869.webp new file mode 100644 index 000000000..edb708a39 Binary files /dev/null and b/files/assets/images/rDrama/sidebar/869.webp differ diff --git a/files/classes/user.py b/files/classes/user.py index db3b652d2..a52d693b4 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -1,12 +1,12 @@ import random from operator import * -from typing import Union +from typing import Any, Union import pyotp from sqlalchemy import Column, ForeignKey from sqlalchemy.orm import aliased, deferred from sqlalchemy.sql import func -from sqlalchemy.sql.expression import not_, and_, or_ +from sqlalchemy.sql.expression import not_, and_, or_, ColumnOperators from sqlalchemy.sql.sqltypes import * from files.classes import Base @@ -129,6 +129,7 @@ class User(Base): total_lottery_winnings = Column(Integer, default=0) last_viewed_post_notifs = Column(Integer, default=0) last_viewed_log_notifs = Column(Integer, default=0) + last_viewed_reddit_notifs = Column(Integer, default=0) pronouns = Column(String, default='they/them') bite = Column(Integer) earlylife = Column(Integer) @@ -413,6 +414,13 @@ class User(Base): def can_view_offsitementions(self): return self.offsitementions or self.admin_level >= PERMS['NOTIFICATIONS_REDDIT'] + @lazy + def can_edit(self, target:Union[Submission, Comment]) -> bool: + if isinstance(target, Comment) and not target.post: return False + if self.id == target.author_id: return True + if not isinstance(target, Submission): return False + return bool(self.admin_level >= PERMS['POST_EDITING']) + @property @lazy def user_awards(self): @@ -632,7 +640,7 @@ class User(Base): if not self.can_see_shadowbanned: notifs = notifs.filter(User.shadowbanned == None) - return notifs.count() + self.post_notifications_count + self.modaction_notifications_count + return notifs.count() + self.post_notifications_count + self.modaction_notifications_count + self.reddit_notifications_count @property @lazy @@ -701,9 +709,9 @@ class User(Base): @property @lazy def reddit_notifications_count(self): - if not self.can_view_offsitementions: return 0 - return g.db.query(Notification).join(Comment).filter( - Notification.user_id == self.id, Notification.read == False, + if not self.can_view_offsitementions or self.id == AEVANN_ID: return 0 + return g.db.query(Comment).filter( + Comment.created_utc > self.last_viewed_reddit_notifs, Comment.is_banned == False, Comment.deleted_utc == 0, Comment.body_html.like('%

New site mention%= const.PERMS['NOTIFICATIONS_REDDIT'], - User.id != const.AEVANN_ID, - ).all() - - send_to = [x[0] for x in row_send_to] - send_to = set(send_to) - - site_mentions = get_mentions(cache, const.REDDIT_NOTIFS_SITE) - notify_mentions(send_to, site_mentions) + site_mentions = get_mentions(cache, const.REDDIT_NOTIFS_SITE) + notify_mentions(site_mentions) if const.REDDIT_NOTIFS_USERS: for query, send_user in const.REDDIT_NOTIFS_USERS.items(): user_mentions = get_mentions(cache, [query], reddit_notifs_users=True) - notify_mentions([send_user], user_mentions, mention_str='mention of you') + notify_mentions(user_mentions, send_to=send_user, mention_str='mention of you') + + g.db.commit() # commit early otherwise localhost testing fails to commit def get_mentions(cache:Cache, queries:Iterable[str], reddit_notifs_users=False): kinds = ['submission', 'comment'] @@ -90,7 +81,7 @@ def get_mentions(cache:Cache, queries:Iterable[str], reddit_notifs_users=False): print("Failed to set cache value; there may be duplication of reddit notifications") return mentions -def notify_mentions(send_to, mentions, mention_str='site mention'): +def notify_mentions(mentions, send_to=None, mention_str='site mention'): for m in mentions: author = m['author'] permalink = m['permalink'] @@ -119,6 +110,6 @@ def notify_mentions(send_to, mentions, mention_str='site mention'): g.db.flush() new_comment.top_comment_id = new_comment.id - for user_id in send_to: - notif = Notification(comment_id=new_comment.id, user_id=user_id) + if send_to: + notif = Notification(comment_id=new_comment.id, user_id=send_to) g.db.add(notif) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 6a156e486..5fa797015 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -38,7 +38,7 @@ TLDS = ( # Original gTLDs and ccTLDs # New gTLDs 'app','cleaning','club','dev','farm','florist','fun','gay','lgbt','life','lol', 'moe','mom','monster','new','news','online','pics','press','pub','site', - 'vip','win','world','wtf','xyz','video','host','art', + 'vip','win','world','wtf','xyz','video','host','art','media' ) allowed_tags = ('b','blockquote','br','code','del','em','h1','h2','h3','h4','h5','h6','hr','i', diff --git a/files/routes/allroutes.py b/files/routes/allroutes.py index 649f11493..59bb74738 100644 --- a/files/routes/allroutes.py +++ b/files/routes/allroutes.py @@ -32,13 +32,6 @@ def before_request(): g.webview = '; wv) ' in ua - if ' firefox/' in ua: - g.type = 'firefox' - elif 'iphone' in ua or 'ipad' in ua or 'ipod' in ua or 'mac os' in ua: - g.type = 'apple' - else: - g.type = 'chromium' - g.is_tor = request.headers.get("cf-ipcountry") == "T1" request.path = request.path.rstrip('/') diff --git a/files/routes/notifications.py b/files/routes/notifications.py index 80be4d52c..c66adb425 100644 --- a/files/routes/notifications.py +++ b/files/routes/notifications.py @@ -224,28 +224,20 @@ def notifications_reddit(v:User): if not v.can_view_offsitementions: abort(403) - notifications = g.db.query(Notification, Comment).join(Notification.comment).filter( - Notification.user_id == v.id, + listing = g.db.query(Comment).filter( Comment.body_html.like('%

New site mention%New site mention% 7*24*60*60 and not p.private @@ -924,9 +923,11 @@ def submit_post(v:User, sub=None): execute_lawlz_actions(v, post) - if SITE == 'rdrama.net' and v.id in (IMPASSIONATA_ID, PIZZASHILL_ID, 2008): + if (SITE == 'rdrama.net' + and v.id in (IMPASSIONATA_ID, PIZZASHILL_ID, 2008) + and not (post.sub and post.sub.stealth)): post.stickied_utc = int(time.time()) + 3600 - post.stickied = AUTOJANNY_ID + post.stickied = "AutoJanny" cache.delete_memoized(frontlist) cache.delete_memoized(userpagelisting) @@ -941,7 +942,7 @@ def submit_post(v:User, sub=None): if v.client: return post.json(g.db) else: post.voted = 1 - if post.new or 'megathread' in post.title.lower(): sort = 'new' + if post.new: sort = 'new' else: sort = v.defaultsortingcomments return render_template('submission.html', v=v, p=post, sort=sort, render_replies=True, offset=0, success=True, sub=post.subr) @@ -1073,6 +1074,16 @@ def pin_post(post_id, v): else: return {"message": "Post unpinned!"} return abort(404, "Post not found!") +@app.route("/post//new", methods=["PUT", "DELETE"]) +@limiter.limit(DEFAULT_RATELIMIT_SLOWER) +@auth_required +def toggle_new_sort(post_id:int, v:User): + post = get_post(post_id) + if not v.can_edit(post): abort(403, "Only the post author can do that!") + post.new = request.method == "PUT" + g.db.add(post) + return {"message": f"Turned {'on' if post.new else 'off'} sort by new"} + extensions = IMAGE_FORMATS + VIDEO_FORMATS + AUDIO_FORMATS diff --git a/files/routes/users.py b/files/routes/users.py index a98727d8b..a0acb0957 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -1135,27 +1135,33 @@ kofi_tiers={ @auth_required def settings_kofi(v:User): if not KOFI_TOKEN or KOFI_TOKEN == DEFAULT_CONFIG_VALUE: abort(404) + if not (v.email and v.is_activated): abort(400, f"You must have a verified email to verify {patron} status and claim your rewards!") - transaction = g.db.query(Transaction).filter_by(email=v.email).order_by(Transaction.created_utc.desc()).first() - if not transaction: - abort(404, "Email not found") - if transaction.claimed: + + transactions = g.db.query(Transaction).filter_by(email=v.email, claimed=None).all() + + if not transactions: abort(400, f"{patron} rewards already claimed") - tier = kofi_tiers[transaction.amount] + highest_tier = 0 + marseybux = 0 + + for transaction in transactions: + tier = kofi_tiers[transaction.amount] + marseybux += marseybux_li[tier] + if tier > highest_tier: highest_tier = tier + transaction.claimed = True + g.db.add(transaction) - marseybux = marseybux_li[tier] v.pay_account('marseybux', marseybux) send_repeatable_notification(v.id, f"You have received {marseybux} Marseybux! You can use them to buy awards in the [shop](/shop).") g.db.add(v) - if tier > v.patron: - v.patron = tier + if highest_tier > v.patron: + v.patron = highest_tier for badge in g.db.query(Badge).filter(Badge.user_id == v.id, Badge.badge_id > 20, Badge.badge_id < 28).all(): g.db.delete(badge) - badge_grant(badge_id=20+tier, user=v) + badge_grant(badge_id=20+highest_tier, user=v) - transaction.claimed = True - g.db.add(transaction) return {"message": f"{patron} rewards claimed!"} diff --git a/files/routes/votes.py b/files/routes/votes.py index 240ebdfae..3f2d6f98b 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -17,20 +17,40 @@ def vote_info_get(v, link): if thing.ghost and v.id != AEVANN_ID: abort(403) if isinstance(thing, Submission): - if thing.author.shadowbanned and not (v and v.admin_level >= PERMS['USER_SHADOWBAN']): - thing_id = g.db.query(Submission.id).filter_by(upvotes=thing.upvotes, downvotes=thing.downvotes).order_by(Submission.id).first()[0] + if (thing.author.shadowbanned + and not (v and v.admin_level >= PERMS['USER_SHADOWBAN'])): + thing_id = g.db.query(Submission.id) \ + .filter_by(upvotes=thing.upvotes, downvotes=thing.downvotes) \ + .order_by(Submission.id).first()[0] else: thing_id = thing.id - ups = g.db.query(Vote).filter_by(submission_id=thing_id, vote_type=1).order_by(Vote.created_utc).all() - downs = g.db.query(Vote).filter_by(submission_id=thing_id, vote_type=-1).order_by(Vote.created_utc).all() + query = g.db.query(Vote).join(Vote.user).filter( + Vote.submission_id == thing_id, + ).order_by(Vote.created_utc) + + if not v.can_see_shadowbanned: + query = query.filter(User.shadowbanned == None) + + ups = query.filter(Vote.vote_type == 1).all() + downs = query.filter(Vote.vote_type == -1).all() elif isinstance(thing, Comment): - if thing.author.shadowbanned and not (v and v.admin_level >= PERMS['USER_SHADOWBAN']): - thing_id = g.db.query(Comment.id).filter_by(upvotes=thing.upvotes, downvotes=thing.downvotes).order_by(Comment.id).first()[0] + if (thing.author.shadowbanned + and not (v and v.admin_level >= PERMS['USER_SHADOWBAN'])): + thing_id = g.db.query(Comment.id) \ + .filter_by(upvotes=thing.upvotes, downvotes=thing.downvotes) \ + .order_by(Comment.id).first()[0] else: thing_id = thing.id - ups = g.db.query(CommentVote).filter_by(comment_id=thing_id, vote_type=1).order_by(CommentVote.created_utc).all() - downs = g.db.query(CommentVote).filter_by(comment_id=thing_id, vote_type=-1 ).order_by(CommentVote.created_utc).all() + query = g.db.query(CommentVote).join(CommentVote.user).filter( + CommentVote.comment_id == thing_id, + ).order_by(CommentVote.created_utc) + + if not v.can_see_shadowbanned: + query = query.filter(User.shadowbanned == None) + + ups = query.filter(CommentVote.vote_type == 1).all() + downs = query.filter(CommentVote.vote_type == -1).all() else: abort(400) @@ -40,6 +60,7 @@ def vote_info_get(v, link): ups=ups, downs=downs) + def vote_post_comment(target_id, new, v, cls, vote_cls): if new == "-1" and DISABLE_DOWNVOTES: abort(403) if new not in {"-1", "0", "1"}: abort(400) @@ -91,7 +112,8 @@ def vote_post_comment(target_id, new, v, cls, vote_cls): existing.coins = coin_value g.db.add(existing) elif existing.vote_type != 0 and new == 0: - target.author.charge_account('coins', existing.coins, should_check_balance=False) + target.author.charge_account('coins', existing.coins, + should_check_balance=False) target.author.truescore -= coin_delta g.db.add(target.author) g.db.delete(existing) @@ -126,16 +148,17 @@ def vote_post_comment(target_id, new, v, cls, vote_cls): # this is hacky but it works, we should probably do better later def get_vote_count(dir, real_instead_of_dir): - votes = g.db.query(vote_cls) + votes = g.db.query(vote_cls).join(vote_cls.user) \ + .filter(User.shadowbanned == None) if real_instead_of_dir: - votes = votes.filter_by(real=True) + votes = votes.filter(vote_cls.real == True) else: - votes = votes.filter_by(vote_type=dir) + votes = votes.filter(vote_cls.vote_type == dir) if vote_cls == Vote: - votes = votes.filter_by(submission_id=target.id) + votes = votes.filter(vote_cls.submission_id == target.id) elif vote_cls == CommentVote: - votes = votes.filter_by(comment_id=target.id) + votes = votes.filter(vote_cls.comment_id == target.id) else: return 0 return votes.count() @@ -150,9 +173,13 @@ def vote_post_comment(target_id, new, v, cls, vote_cls): if target.author.progressivestack or target.author.id in BOOSTED_USERS: mul = 2 elif cls == Submission: - if target.domain.endswith('.win') or (target.domain in BOOSTED_SITES and not target.url.startswith('/')) or target.sub in BOOSTED_HOLES: + if (target.domain.endswith('.win') + or (target.domain in BOOSTED_SITES and not target.url.startswith('/')) + or target.sub in BOOSTED_HOLES): mul = 2 - elif not target.sub and target.body_html and target.author.id not in {8768,3402,5214,12719}: + elif (not target.sub + and target.body_html + and target.author.id not in {8768,3402,5214,12719}): x = target.body_html.count('" target="_blank" rel="nofollow noopener">') x += target.body_html.count('/") @limiter.limit("5/second;60/minute;1000/hour;2000/day") @is_not_permabanned diff --git a/files/routes/wrappers.py b/files/routes/wrappers.py index bbbfe5937..b2b312680 100644 --- a/files/routes/wrappers.py +++ b/files/routes/wrappers.py @@ -61,7 +61,8 @@ def get_logged_in_user(): if AEVANN_ID and request.headers.get("Cf-Ipcountry") == 'EG': if v and not v.username.startswith('Aev') and v.truescore > 0: - with open(f"{LOG_DIRECTORY}/eg.log", "r+", encoding="utf-8") as f: + with open(f"{LOG_DIRECTORY}/eg.log", "a+", encoding="utf-8") as f: + f.seek(0) ip = request.headers.get('CF-Connecting-IP') if f'@{v.username}, ' not in f.read(): t = time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time())) diff --git a/files/templates/app.html b/files/templates/app.html index b685680c2..c14d697e5 100644 --- a/files/templates/app.html +++ b/files/templates/app.html @@ -4,10 +4,21 @@

How to install {{SITE_NAME}}'s mobile app + {% set ua = g.agent.lower() %} + {% if ' firefox/' in ua %} + {% set type = 'firefox' %} + {% elif 'iphone' in ua or 'ipad' in ua or 'ipod' in ua or 'mac os' in ua %} + {% set type = 'apple' %} + {% elif v %} + {% set type = 'chromium' %} + {% else %} + {% set type = 'chromium-lo' %} + {% endif %} +
First step:
- First step + First step
Second step:
- Second step + Second step
{% endblock %} diff --git a/files/templates/default.html b/files/templates/default.html index 2675ccd73..70a3fa022 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -3,18 +3,21 @@ {% block body %} {% block banner %} {% include "modals/expanded_image.html" %} - - {% if '@' not in request.path %} + {% if err or '@' not in request.path %} {% if EVENT_BANNER and not sub %} {% include 'event/' + EVENT_BANNER %} {% else %} - {% if sub and SITE_NAME != WPD %} + {% if err and SITE_NAME == 'rDrama' %} + {% set src = "banner_error.webp" | asset_siteimg %} + {% elif sub %} {% set src = sub.banner_url %} {% set alt = ['/h/', sub, 'banner']|join %} {% set class = 'site-banner-hole' %} {% elif SITE_NAME == "rDrama" %} {% set href = "https://secure.transequality.org/site/Donation2?df_id=1480" %} {% set expand = false %} + {% elif SITE_NAME == 'PCM' %}{# special case: christmas #} + {% set src = "/i/PCM/banners_event/2022christmas1.webp" %} {% endif %} {{macros.banner(src, href, alt, expand, class)}} {% endif %} diff --git a/files/templates/header.html b/files/templates/header.html index 0d29c152d..a26700515 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -63,7 +63,7 @@ {% if sub %} - = 17 %}style="font-size:max(10px,1.2vw)"{% else %}style="font-size:max(10px,1.2vw)"{% endif %}>{% if not HOLE_STYLE_FLAIR %}/h/{% endif %}{{sub}} + = 17 %}style="font-size:max(10px,1.2vw)"{% else %}style="font-size:max(14px,1.2vw)"{% endif %}>{% if not HOLE_STYLE_FLAIR %}/h/{% endif %}{{sub}} {% elif has_logo %} diff --git a/files/templates/login/sign_up.html b/files/templates/login/sign_up.html index 5e63bd09c..5464c960f 100644 --- a/files/templates/login/sign_up.html +++ b/files/templates/login/sign_up.html @@ -26,35 +26,6 @@ {% block content %}
- {% if not ref_user and SITE_NAME == 'rDrama' and site_settings['login_required'] %} -

- Hiiiiii it’s your favorite user Carp! We’re currently on Login Required mode for one of a few reasons: -

-
    -
  1. The site is running really slowly and we think it might be miscreants up to no good, or
  2. -
  3. It’s our monthly 24 hours of login-required-mode to encourage lovely lurkers to become lovely new friends of ours, or
  4. -
  5. Someone clicked the toggle by mistake lol oops sorry!
  6. -
-

- But that’s all fine. Signing up is easy. It takes literally like 4 seconds if you’re slow. You don’t even need an email! Just pick a username, make up some neat new password where you replace all the e’s with 3s or whatever and bam, done, you’re in.
- Remember to click “Follow” on my profile! -

-

- I love you.
- xoxo carp 💋 -

-
- {% elif not ref_user and SITE_NAME == 'WPD' and site_settings['login_required'] %} -

- Hi you!watchpeopledie.tv is currently doing our monthly 24(ish) hours of "everyone needs to have an account" — sorry about that! But making an account is actually super easy. You don't even need an email address! Literally just pick a username, set a password, and that's that. Bam, done, like 8 seconds, tops.
-

-

- We WANT you with us 💖
- Please join! -

-
- {% endif %} -
{% if error %}
{{error}}
{% endif %} diff --git a/files/templates/post_actions.html b/files/templates/post_actions.html index 6ad239f20..eb49f845c 100644 --- a/files/templates/post_actions.html +++ b/files/templates/post_actions.html @@ -17,9 +17,7 @@ {% if v %} -{% endif %} -{% if v %} @@ -35,72 +33,60 @@ - {% endif %} +{% endif %} - {% if v %} - - +{% endif %} diff --git a/files/templates/post_admin_actions_mobile.html b/files/templates/post_admin_actions_mobile.html index d0598e4a2..54959b3c5 100644 --- a/files/templates/post_admin_actions_mobile.html +++ b/files/templates/post_admin_actions_mobile.html @@ -21,6 +21,10 @@ {%- endif %} + {% if v.can_edit(p) %} + + + {% endif %} {% if v.admin_level >= PERMS['POST_COMMENT_DISTINGUISH'] and (v.id == p.author.id or v.admin_level >= PERMS['POST_COMMENT_MODERATION']) %} diff --git a/files/templates/submission.html b/files/templates/submission.html index 2f22bfc44..38bdcc20b 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -178,7 +178,7 @@
{% endif %} - {% if v and (v.id==p.author_id or v.admin_level >= PERMS['POST_EDITING']) and not v.is_suspended %} + {% if v and v.can_edit(p) and not v.is_suspended %} - - {% if v and v.id != p.author_id and p.body and not v_forbid_deleted %} @@ -334,7 +332,7 @@