forked from MarseyWorld/MarseyWorld
master
parent
51880e3aae
commit
1f885af866
|
@ -267,6 +267,11 @@ class User(Base):
|
|||
|
||||
return [x[0] for x in posts]
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def follow_count(self):
|
||||
return g.db.query(Follow.id).filter_by(user_id=self.id).count()
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def bio_html_eager(self):
|
||||
|
|
|
@ -1126,7 +1126,9 @@ def api_unban_comment(c_id, v):
|
|||
|
||||
comment = g.db.query(Comment).filter_by(id=c_id).first()
|
||||
if not comment: abort(404)
|
||||
g.db.add(comment)
|
||||
|
||||
if comment.author.agendaposter and 'trans lives matters' not in comment.body.lower():
|
||||
return {"error": "You can't bypass the agendaposter award!"}
|
||||
|
||||
if comment.is_banned:
|
||||
ma=ModAction(
|
||||
|
@ -1139,6 +1141,8 @@ def api_unban_comment(c_id, v):
|
|||
comment.is_banned = False
|
||||
comment.is_approved = v.id
|
||||
|
||||
g.db.add(comment)
|
||||
|
||||
g.db.commit()
|
||||
|
||||
return {"message": "Comment approved!"}
|
||||
|
|
|
@ -300,6 +300,22 @@ def sign_up_post(v):
|
|||
|
||||
ref_id = int(request.values.get("referred_by", 0))
|
||||
|
||||
|
||||
if ref_id:
|
||||
ref_user = g.db.query(User).filter_by(id=ref_id).one_or_none()
|
||||
|
||||
if ref_user:
|
||||
if ref_user.referral_count > 0:
|
||||
new_badge = Badge(user_id=ref_user.id, badge_id=10)
|
||||
g.db.add(new_badge)
|
||||
if ref_user.referral_count > 9:
|
||||
new_badge = Badge(user_id=ref_user.id, badge_id=11)
|
||||
g.db.add(new_badge)
|
||||
if ref_user.referral_count > 99:
|
||||
new_badge = Badge(user_id=ref_user.id, badge_id=12)
|
||||
g.db.add(new_badge)
|
||||
|
||||
|
||||
id_1 = g.db.query(User.id).filter_by(id=7).count()
|
||||
users_count = g.db.query(User.id).count()
|
||||
if id_1 == 0 and users_count == 7: admin_level=3
|
||||
|
|
|
@ -140,6 +140,10 @@ def cached_chart(days):
|
|||
comment_stats,
|
||||
color='gold')
|
||||
|
||||
signup_chart.set_ylim(ymin=0)
|
||||
posts_chart.set_ylim(ymin=0)
|
||||
comments_chart.set_ylim(ymin=0)
|
||||
|
||||
signup_chart.set_ylabel("Signups")
|
||||
posts_chart.set_ylabel("Posts")
|
||||
comments_chart.set_ylabel("Comments")
|
||||
|
|
|
@ -522,10 +522,9 @@ def redditor_moment_redirect(username):
|
|||
return redirect(f"/@{username}")
|
||||
|
||||
@app.get("/@<username>/followers")
|
||||
@auth_required
|
||||
@auth_desired
|
||||
def followers(username, v):
|
||||
u = get_user(username, v=v)
|
||||
# if request.host == 'rdrama.net' and u.id == 147: abort(404)
|
||||
ids = [x[0] for x in g.db.query(Follow.user_id).filter_by(target_id=u.id).all()]
|
||||
users = g.db.query(User).filter(User.id.in_(ids)).all()
|
||||
if not v or v.oldsite: template = ''
|
||||
|
@ -533,10 +532,9 @@ def followers(username, v):
|
|||
return render_template(f"{template}followers.html", v=v, u=u, users=users)
|
||||
|
||||
@app.get("/@<username>/following")
|
||||
@auth_required
|
||||
@auth_desired
|
||||
def following(username, v):
|
||||
u = get_user(username, v=v)
|
||||
# if request.host == 'rdrama.net' and u.id == 147: abort(404)
|
||||
ids = [x[0] for x in g.db.query(Follow.target_id).filter_by(user_id=u.id).all()]
|
||||
users = g.db.query(User).filter(User.id.in_(ids)).all()
|
||||
if not v or v.oldsite: template = ''
|
||||
|
|
|
@ -459,9 +459,9 @@
|
|||
|
||||
<button id="pin-{{c.id}}" class="btn caction py-0 nobackground px-1 {% if not c.is_pinned %}d-md-inline-block{% endif %} text-muted d-none text-info" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3('/sticky_comment/{{c.id}}','pin-{{c.id}}','unpin-{{c.id}}')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Pin</button>
|
||||
{% elif v.id == c.post.author_id %}
|
||||
<button id="unpin-{{c.id}}" class="btn caction py-0 nobackground {% if c.is_pinned %}d-md-inline-block{% endif %} text-muted d-none text-info" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3('/unpin_comment/{{c.id}}','pin-{{c.id}}','unpin-{{c.id}}')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Unpin</button>
|
||||
<button id="unpin-{{c.id}}-op" class="btn caction py-0 nobackground {% if c.is_pinned %}d-md-inline-block{% endif %} text-muted d-none text-info" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3('/unpin_comment/{{c.id}}','pin-{{c.id}}-op','unpin-{{c.id}}-op')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Unpin</button>
|
||||
|
||||
<button id="pin-{{c.id}}" class="btn caction py-0 nobackground px-1 {% if not c.is_pinned %}d-md-inline-block{% endif %} text-muted d-none text-info" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3('/pin_comment/{{c.id}}','pin-{{c.id}}','unpin-{{c.id}}')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Pin</button>
|
||||
<button id="pin-{{c.id}}-op" class="btn caction py-0 nobackground px-1 {% if not c.is_pinned %}d-md-inline-block{% endif %} text-muted d-none text-info" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3('/pin_comment/{{c.id}}','pin-{{c.id}}-op','unpin-{{c.id}}-op')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Pin</button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
@ -607,8 +607,8 @@
|
|||
|
||||
|
||||
{% if c.post and v.id == c.post.author_id and not v.admin_level %}
|
||||
<a id="pin2-{{c.id}}" class="list-group-item {% if c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2('/pin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info"></i>Pin</a>
|
||||
<a id="unpin2-{{c.id}}" class="list-group-item {% if not c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2('/unpin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info"></i>Unpin</a>
|
||||
<a id="pin2-{{c.id}}-op" class="list-group-item {% if c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2('/pin_comment/{{c.id}}','pin2-{{c.id}}-op','unpin2-{{c.id}}-op')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info"></i>Pin</a>
|
||||
<a id="unpin2-{{c.id}}-op" class="list-group-item {% if not c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2('/unpin_comment/{{c.id}}','pin2-{{c.id}}-op','unpin2-{{c.id}}-op')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info"></i>Unpin</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
|
|
@ -111,6 +111,10 @@
|
|||
<img alt="marseybux" class="ml-1 mb-1" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Marseybux" height="20" src="/static/assets/images/emojis/marseybux.webp?a=3">
|
||||
|
||||
{% if u.stored_subscriber_count >=1 and not u.is_nofollow %}<a href="/@{{u.username}}/followers">{{u.stored_subscriber_count}} follower{{'s' if u.stored_subscriber_count != 1 else ''}}</a> {% endif %}
|
||||
|
||||
{% if u.follow_count > 0 %}<a href="/@{{u.username}}/following">follows {{u.follow_count}} user{{'s' if u.follow_count != 1 else ''}}</a> {% endif %}
|
||||
|
||||
|
||||
joined <span data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{u.created_datetime}}">{{u.created_date}}</span>
|
||||
</div>
|
||||
{% if u.basedcount %}<p class="text-muted">Based Count: {{u.basedcount}}</p>{% endif %}
|
||||
|
@ -155,7 +159,12 @@
|
|||
<a class="btn btn-primary" role="button" onclick="toggleElement('profile-toggleable', 'coin-transfer')">Gift {{'COINS_NAME' | app_config}}</a>
|
||||
<a class="btn btn-primary" role="button" onclick="toggleElement('profile-toggleable', 'bux-transfer')">Gift Marseybux</a>
|
||||
|
||||
{% if v.admin_level > 2 %}
|
||||
{% if v.admin_level > 2 %}
|
||||
{% if request.host != "rdrama.net" %}
|
||||
<a id="admin" class="{% if u.admin_level > 1 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/make_admin','admin','unadmin')">Make admin</a>
|
||||
<a id="unadmin" class="{% if u.admin_level < 2 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/remove_admin','admin','unadmin')">Remove admin</a>
|
||||
{% endif %}
|
||||
|
||||
<a id="memeadmin" class="{% if u.admin_level == 1%}d-none{% endif %} btn btn-primary" role="button" onclick="post_toast2('/@{{u.username}}/make_meme_admin','memeadmin','unmemeadmin')">Make meme admin</a>
|
||||
<a id="unmemeadmin" class="{% if u.admin_level != 1 %}d-none{% endif %} btn btn-primary" role="button" onclick="post_toast2('/@{{u.username}}/remove_meme_admin','memeadmin','unmemeadmin')">Remove meme admin</a>
|
||||
|
||||
|
@ -377,6 +386,9 @@
|
|||
<img alt="marseybux" class="ml-1 mb-1" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="Marseybux" height="15" src="/static/assets/images/emojis/marseybux.webp?a=3">
|
||||
|
||||
{% if u.stored_subscriber_count >=1 and not u.is_nofollow %}<a href="/@{{u.username}}/followers" class="font-weight-bold">{{u.stored_subscriber_count}} follower{{'s' if u.stored_subscriber_count != 1 else ''}}</a> {% endif %}
|
||||
|
||||
{% if u.follow_count > 0 %}<a href="/@{{u.username}}/following" class="font-weight-bold">follows {{u.follow_count}} user{{'s' if u.follow_count != 1 else ''}}</a> {% endif %}
|
||||
|
||||
{% if u.basedcount %}
|
||||
<br>Based count: {{u.basedcount}}
|
||||
{% endif %}
|
||||
|
@ -437,6 +449,11 @@
|
|||
<a class="btn btn-primary" role="button" onclick="toggleElement('profile-toggleable', 'bux-transfer-mobile')">Gift Marseybux</a>
|
||||
|
||||
{% if v.admin_level > 2 %}
|
||||
{% if request.host != "rdrama.net" %}
|
||||
<a id="admin2" class="{% if u.admin_level > 1 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/make_admin','admin2','unadmin2')">Make admin</a>
|
||||
<a id="unadmin2" class="{% if u.admin_level < 2 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/remove_admin','admin2','unadmin2')">Remove admin</a>
|
||||
{% endif %}
|
||||
|
||||
<a id="memeadmin2" class="{% if u.admin_level == 1%}d-none{% endif %} btn btn-primary" role="button" onclick="post_toast2('/@{{u.username}}/make_meme_admin','memeadmin2','unmemeadmin2')">Make meme admin</a>
|
||||
<a id="unmemeadmin2" class="{% if u.admin_level != 1 %}d-none{% endif %} btn btn-primary" role="button" onclick="post_toast2('/@{{u.username}}/remove_meme_admin','memeadmin2','unmemeadmin2')">Remove meme admin</a>
|
||||
|
||||
|
|
Loading…
Reference in New Issue