diff --git a/CHANGELOG.md b/CHANGELOG.md index 40a4377..be61e29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,9 @@ - Moderators (and admins) have now access to mod tools + Allowed operations: change display name, description, restriction status, and exile (guild-local ban) members + Site administrators and guild owners can add moderators -- Administrators can claim ownership of abandoned guilds - Guilds can have restricted posting/commenting now. Unmoderated guilds always have. +- Administrators can claim ownership of abandoned guilds +- Admins can now suspend users from admin panel - Implemented guild subscriptions (not as in $$$, yes as in the follow button) - Minimum karma requirement for creating a guild is now configurable via env variable `FREAK_CREATE_GUILD_THRESHOLD` (previously hardcoded at 15) - Users can now set their display name, biography and color theme in `/settings` diff --git a/freak/models.py b/freak/models.py index 6e68213..caf4e72 100644 --- a/freak/models.py +++ b/freak/models.py @@ -54,7 +54,7 @@ post_report_reasons = [ REPORT_REASON_STRINGS = { **{x.num_code: x.description for x in post_report_reasons}, **{x.code: x.description for x in post_report_reasons} } -REPORT_REASONS = {x.code: x.num_code for x in post_report_reasons} +REPORT_REASONS: dict[str, int] = {x.code: x.num_code for x in post_report_reasons} REPORT_TARGET_POST = 1 REPORT_TARGET_COMMENT = 2 @@ -66,21 +66,22 @@ REPORT_UPDATE_ON_HOLD = 3 USERNAME_RE = r'[a-z2-9_-][a-z0-9_-]+' -ILLEGAL_USERNAMES = ( +ILLEGAL_USERNAMES = tuple(( ## masspings and administrative claims - 'me', 'everyone', 'here', 'room', 'all', 'any', 'founder', 'owner', - 'admin', 'administrator', 'mod', 'modteam', 'moderator', 'sysop', 'server', 'app' + 'me everyone here room all any server app dev devel develop nil none ' + 'founder owner admin administrator mod modteam moderator sysop some ' ## fictitious users and automations - 'nobody', 'deleted', 'suspended', 'default', 'bot', 'developer', 'undefined', 'null', - 'ai', 'automod', 'automoderator', 'assistant', 'privacy', 'anonymous', 'removed' + 'nobody deleted suspended default bot developer undefined null ' + 'ai automod automoderator assistant privacy anonymous removed assistance ' ## law enforcement corps and slurs because yes - 'pedo', 'rape', 'rapist', 'nigger', 'retard', 'ncmec', 'police', 'cops', '911', 'childsafety', - 'report', 'dmca', 'login', 'logout', 'security', 'order66', 'gestapo', 'ss', 'hitler', - 'pedophile', 'lolicon', 'giphy', 'tenor', 'csam', 'cp', 'pedobear', 'lolita', - 'loli', 'kkk', 'pnf', 'adl', 'cop', 'tranny', 'google', 'trustandsafety', 'safety', 'ice', + 'pedo rape rapist nigger retard ncmec police cops 911 childsafety ' + 'report dmca login logout security order66 gestapo ss hitler heilhitler kgb ' + 'pedophile lolicon giphy tenor csam cp pedobear lolita lolice thanos ' + 'loli kkk pnf adl cop tranny google trustandsafety safety ice fbi nsa it ' ## VVVVIP - 'potus', 'realdonaldtrump', 'elonmusk', 'teddysphotos', 'mrbeast', 'jkrowling', 'pewdiepie' -) + 'potus realdonaldtrump elonmusk teddysphotos mrbeast jkrowling pewdiepie ' + 'elizabethii king queen pontifex hogwarts lumos alohomora isis daesh ' +).split()) def username_is_legal(username: str) -> bool: if len(username) < 2 or len(username) > 100: @@ -175,7 +176,13 @@ class User(Base): @property def is_disabled(self): - return (self.banned_at is not None and (self.banned_until is None or self.banned_until <= datetime.datetime.now())) or self.is_disabled_by_user + now = datetime.datetime.now() + return ( + # suspended + (self.banned_at is not None and (self.banned_until is None or self.banned_until >= now)) or + # self-disabled + self.is_disabled_by_user + ) @property def is_active(self): diff --git a/freak/static/js/lib.js b/freak/static/js/lib.js index 450d97c..a9d7557 100644 --- a/freak/static/js/lib.js +++ b/freak/static/js/lib.js @@ -45,7 +45,7 @@ usernameInputMessage.className = 'username-input-message error'; return; } - if (!resp.is_legal) { + if (resp.is_valid === false) { usernameInputMessage.innerHTML = "You can't use this username."; usernameInputMessage.className = 'username-input-message error'; return; diff --git a/freak/static/sass/layout.sass b/freak/static/sass/layout.sass index 9325fb7..ae79fd1 100644 --- a/freak/static/sass/layout.sass +++ b/freak/static/sass/layout.sass @@ -310,6 +310,12 @@ button, [type="submit"], [type="reset"], [type="button"] &[disabled] opacity: .5 cursor: not-allowed + border: var(--border) + color: var(--border) + + &.primary[disabled] + color: var(--background) + background-color: var(--border) &:first-child margin-inline-start: 0 diff --git a/freak/templates/403.html b/freak/templates/403.html index f13fb50..ee4f511 100644 --- a/freak/templates/403.html +++ b/freak/templates/403.html @@ -2,7 +2,7 @@ {% from "macros/title.html" import title_tag with context %} {% block title %} -