forked from MarseyWorld/MarseyWorld
add !followers
parent
166f6fb4ee
commit
5eb2c0dc27
|
@ -164,7 +164,9 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False, log_cost=None):
|
||||||
elif i.group(1) == 'jannies':
|
elif i.group(1) == 'jannies':
|
||||||
group = None
|
group = None
|
||||||
member_ids = set([x[0] for x in g.db.query(User.id).filter(User.admin_level > 0, User.id != AEVANN_ID)])
|
member_ids = set([x[0] for x in g.db.query(User.id).filter(User.admin_level > 0, User.id != AEVANN_ID)])
|
||||||
coin_receivers.update(member_ids)
|
elif i.group(1) == 'followers':
|
||||||
|
group = None
|
||||||
|
member_ids = set([x[0] for x in g.db.query(Follow.user_id).filter_by(target_id=v.id)])
|
||||||
else:
|
else:
|
||||||
group = g.db.get(Group, i.group(1))
|
group = g.db.get(Group, i.group(1))
|
||||||
if not group: continue
|
if not group: continue
|
||||||
|
@ -174,7 +176,7 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False, log_cost=None):
|
||||||
|
|
||||||
notify_users.update(members)
|
notify_users.update(members)
|
||||||
|
|
||||||
if ghost or v.id not in member_ids:
|
if (ghost or v.id not in member_ids) and i.group(1) != 'followers':
|
||||||
if group and group.name == 'verifiedrich':
|
if group and group.name == 'verifiedrich':
|
||||||
abort(403, f"Only !verifiedrich members can mention it!")
|
abort(403, f"Only !verifiedrich members can mention it!")
|
||||||
cost += len(members) * 10
|
cost += len(members) * 10
|
||||||
|
@ -184,7 +186,7 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False, log_cost=None):
|
||||||
if log_cost:
|
if log_cost:
|
||||||
log_cost.ping_cost = cost
|
log_cost.ping_cost = cost
|
||||||
|
|
||||||
if group and group.name in {'biofoids','neofoids'}:
|
if i.group(1) in {'biofoids','neofoids','jannies'}:
|
||||||
coin_receivers.update(member_ids)
|
coin_receivers.update(member_ids)
|
||||||
|
|
||||||
if cost:
|
if cost:
|
||||||
|
|
|
@ -18,6 +18,7 @@ from files.classes.domains import BannedDomain
|
||||||
from files.classes.mod_logs import ModAction
|
from files.classes.mod_logs import ModAction
|
||||||
from files.classes.notifications import Notification
|
from files.classes.notifications import Notification
|
||||||
from files.classes.group import Group
|
from files.classes.group import Group
|
||||||
|
from files.classes.follows import Follow
|
||||||
|
|
||||||
from files.helpers.config.const import *
|
from files.helpers.config.const import *
|
||||||
from files.helpers.const_stateful import *
|
from files.helpers.const_stateful import *
|
||||||
|
@ -487,6 +488,8 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis
|
||||||
return f'<a href="/users">!{name}</a>'
|
return f'<a href="/users">!{name}</a>'
|
||||||
elif name == 'jannies':
|
elif name == 'jannies':
|
||||||
return f'<a href="/admins">!{name}</a>'
|
return f'<a href="/admins">!{name}</a>'
|
||||||
|
elif name == 'followers':
|
||||||
|
return f'<a href="/id/{g.v.id}/followers">!{name}</a>'
|
||||||
elif g.db.get(Group, name):
|
elif g.db.get(Group, name):
|
||||||
return f'<a href="/!{name}">!{name}</a>'
|
return f'<a href="/!{name}">!{name}</a>'
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -32,7 +32,7 @@ def create_group(v):
|
||||||
if not valid_sub_regex.fullmatch(name):
|
if not valid_sub_regex.fullmatch(name):
|
||||||
return redirect(f"/ping_groups?error=Name does not match the required format!")
|
return redirect(f"/ping_groups?error=Name does not match the required format!")
|
||||||
|
|
||||||
if name in {'everyone', 'jannies'} or g.db.get(Group, name):
|
if name in {'everyone', 'jannies', 'followers'} or g.db.get(Group, name):
|
||||||
return redirect(f"/ping_groups?error=This group already exists!")
|
return redirect(f"/ping_groups?error=This group already exists!")
|
||||||
|
|
||||||
if not v.charge_account('combined', GROUP_COST)[0]:
|
if not v.charge_account('combined', GROUP_COST)[0]:
|
||||||
|
|
Loading…
Reference in New Issue