Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

feat(badges): remove the custom badge limit (#3730)

Hampus1031d21a3ce2
diff --git a/fluxer_admin/openapi-admin.json b/fluxer_admin/openapi-admin.json
index ffb0287dc..1ec3bb16c 100644
--- a/fluxer_admin/openapi-admin.json
+++ b/fluxer_admin/openapi-admin.json
@@ -1195,8 +1195,55 @@
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
}
},
- "description": "Lists the user and guild badges defined on this instance, in display order. Requires BADGE_LIST permission.",
- "security": [{"adminApiKey": []}]
+ "description": "Lists one page of the user and guild badges defined on this instance, in display order, with the badge settings and the built-in badge images. Pass next as after to get the following page. With query, it lists badges whose ID is the query or whose name holds it, and looks at up to 5,000 badges for each page. Requires BADGE_LIST permission.",
+ "security": [{"adminApiKey": []}],
+ "parameters": [
+ {
+ "name": "type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "description": "Only list badges of this type. Without it the list holds every user badge, then every guild badge",
+ "allOf": [{"$ref": "#/components/schemas/CustomBadgeTypeSchema"}]
+ },
+ "description": "Only list badges of this type. Without it the list holds every user badge, then every guild badge"
+ },
+ {
+ "name": "query",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "description": "Only list badges with this ID, or with this text anywhere in the name, ignoring case",
+ "type": "string"
+ },
+ "description": "Only list badges with this ID, or with this text anywhere in the name, ignoring case"
+ },
+ {
+ "name": "ids",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "description": "Up to 100 badge IDs separated by commas. Only these badges are listed, and the page has no next. Cannot be sent with query or after",
+ "type": "string",
+ "pattern": "^[0-9]{1,20}(?:,[0-9]{1,20}){0,99}$"
+ },
+ "description": "Up to 100 badge IDs separated by commas. Only these badges are listed, and the page has no next. Cannot be sent with query or after"
+ },
+ {
+ "name": "after",
+ "in": "query",
+ "required": false,
+ "schema": {"allOf": [{"$ref": "#/components/schemas/CustomBadgeCursorType"}]},
+ "description": "Opaque cursor from the next field of a previous page"
+ },
+ {
+ "name": "limit",
+ "in": "query",
+ "required": false,
+ "schema": {"description": "Most badges to return, from 1 to 200", "default": "100", "type": "string"},
+ "description": "Most badges to return, from 1 to 200"
+ }
+ ]
},
"post": {
"operationId": "create_admin_badge",
@@ -1246,7 +1293,7 @@
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
}
},
- "description": "Creates a user or guild badge and uploads its image to the media proxy. Each type has at most 10 badges. Creates audit log entry. Requires BADGE_CREATE permission.",
+ "description": "Creates a user or guild badge and uploads its image to the media proxy. The new badge is shown after every other badge of its type. Creates audit log entry. Requires BADGE_CREATE permission.",
"security": [{"adminApiKey": []}],
"requestBody": {
"required": true,
@@ -1429,12 +1476,126 @@
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
}
},
- "description": "Sets the display order of the custom badges. The body lists every user and guild badge on this instance exactly once, in the new order. Creates audit log entry. Requires BADGE_UPDATE permission.",
+ "description": "Sets the display order of the custom badges. The body lists every user and guild badge on this instance exactly once, in the new order. It works on instances with up to 1,000 badges. Larger instances move badges one at a time with PATCH /admin/badges/order. The badges are written in groups. A failed request can leave part of the new order. Sending the same request again finishes it. Responds with the first page of badges. Creates audit log entry. Requires BADGE_UPDATE permission.",
"security": [{"adminApiKey": []}],
"requestBody": {
"required": true,
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ReorderCustomBadgesRequest"}}}
}
+ },
+ "patch": {
+ "operationId": "move_admin_badge",
+ "summary": "Move custom badge",
+ "tags": ["Admin"],
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AdminCustomBadgeResponse"}}}
+ },
+ "400": {
+ "description": "Bad Request - The request was malformed or contained invalid data",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
+ },
+ "401": {
+ "description": "Unauthorized - Authentication is required or the token is invalid",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
+ },
+ "403": {
+ "description": "Forbidden - You do not have permission to perform this action",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
+ },
+ "429": {
+ "description": "Too Many Requests - You are being rate limited",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ThrottledError"}}},
+ "headers": {
+ "Retry-After": {
+ "description": "Number of seconds to wait before retrying (only on 429)",
+ "schema": {"type": "integer"}
+ },
+ "X-RateLimit-Limit": {
+ "description": "The number of requests that can be made in the current window",
+ "schema": {"type": "integer"}
+ },
+ "X-RateLimit-Remaining": {
+ "description": "The number of remaining requests that can be made",
+ "schema": {"type": "integer"}
+ },
+ "X-RateLimit-Reset": {
+ "description": "Unix timestamp when the rate limit resets",
+ "schema": {"type": "integer"}
+ }
+ }
+ },
+ "500": {
+ "description": "Internal Server Error - An unexpected error occurred",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
+ }
+ },
+ "description": "Moves one badge within the badges of its type. Send direction to move it up or down one place or to the first or last place, or send after_id to show it right after another badge of the same type. Creates audit log entry. Requires BADGE_UPDATE permission.",
+ "security": [{"adminApiKey": []}],
+ "requestBody": {
+ "required": true,
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MoveCustomBadgeRequest"}}}
+ }
+ }
+ },
+ "/admin/badges/settings": {
+ "patch": {
+ "operationId": "update_admin_badge_settings",
+ "summary": "Update custom badge settings",
+ "tags": ["Admin"],
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "application/json": {"schema": {"$ref": "#/components/schemas/AdminCustomBadgeSettingsResponse"}}
+ }
+ },
+ "400": {
+ "description": "Bad Request - The request was malformed or contained invalid data",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
+ },
+ "401": {
+ "description": "Unauthorized - Authentication is required or the token is invalid",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
+ },
+ "403": {
+ "description": "Forbidden - You do not have permission to perform this action",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
+ },
+ "429": {
+ "description": "Too Many Requests - You are being rate limited",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ThrottledError"}}},
+ "headers": {
+ "Retry-After": {
+ "description": "Number of seconds to wait before retrying (only on 429)",
+ "schema": {"type": "integer"}
+ },
+ "X-RateLimit-Limit": {
+ "description": "The number of requests that can be made in the current window",
+ "schema": {"type": "integer"}
+ },
+ "X-RateLimit-Remaining": {
+ "description": "The number of remaining requests that can be made",
+ "schema": {"type": "integer"}
+ },
+ "X-RateLimit-Reset": {
+ "description": "Unix timestamp when the rate limit resets",
+ "schema": {"type": "integer"}
+ }
+ }
+ },
+ "500": {
+ "description": "Internal Server Error - An unexpected error occurred",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
+ }
+ },
+ "description": "Sets how many custom badges one user or one community can be given. Users can have up to 1,000 and communities up to 200. Lowering a limit keeps badges already given. A change that adds a badge to a user or community over the limit fails with MAX_BADGES. Creates audit log entry. Requires BADGE_UPDATE permission.",
+ "security": [{"adminApiKey": []}],
+ "requestBody": {
+ "required": false,
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UpdateCustomBadgeSettingsRequest"}}}
+ }
}
},
"/admin/badges/{badge_id}": {
@@ -8603,7 +8764,7 @@
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
}
},
- "description": "Replaces the custom badges assigned to a user. Every ID must be a user badge, and a user can have at most 10. Creates audit log entry. Requires USER_UPDATE_BADGES permission.",
+ "description": "Replaces the custom badges assigned to a user. Every ID must be a user badge. A change that adds a badge fails with MAX_BADGES when the user would have more than the max_per_user badge setting allows. Creates audit log entry. Requires USER_UPDATE_BADGES permission.",
"security": [{"adminApiKey": []}],
"parameters": [
{
@@ -19725,6 +19886,7 @@
"properties": {
"id": {"description": "The ID of the badge", "allOf": [{"$ref": "#/components/schemas/SnowflakeStringType"}]},
"type": {"allOf": [{"$ref": "#/components/schemas/CustomBadgeTypeSchema"}]},
+ "position": {"allOf": [{"$ref": "#/components/schemas/CustomBadgePositionType"}]},
"name": {"type": "string", "description": "The name of the badge"},
"description": {
"nullable": true,
@@ -19734,17 +19896,69 @@
"asset_url": {"type": "string", "description": "URL of the badge image, served as WebP by the media proxy"},
"href": {"nullable": true, "description": "URL opened when the badge is clicked, or null", "type": "string"}
},
- "required": ["id", "type", "name", "description", "asset_url", "href"],
+ "required": ["id", "type", "position", "name", "description", "asset_url", "href"],
+ "additionalProperties": false
+ },
+ "UpdateCustomBadgeSettingsRequest": {
+ "type": "object",
+ "properties": {
+ "max_per_user": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 1000,
+ "description": "Most custom badges one user can be given"
+ },
+ "max_per_guild": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 200,
+ "description": "Most custom badges one community can be given"
+ }
+ }
+ },
+ "AdminCustomBadgeSettingsResponse": {
+ "type": "object",
+ "properties": {
+ "max_per_user": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 1000,
+ "description": "Most custom badges one user can be given"
+ },
+ "max_per_guild": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 200,
+ "description": "Most custom badges one community can be given"
+ }
+ },
+ "required": ["max_per_user", "max_per_guild"],
"additionalProperties": false
},
+ "MoveCustomBadgeRequest": {
+ "type": "object",
+ "properties": {
+ "badge_id": {
+ "description": "The ID of the badge to move",
+ "allOf": [{"$ref": "#/components/schemas/SnowflakeType"}]
+ },
+ "direction": {"allOf": [{"$ref": "#/components/schemas/CustomBadgeMoveDirectionSchema"}]},
+ "after_id": {
+ "description": "Show the badge right after this badge of the same type, or first when null. Send either this or direction",
+ "nullable": true,
+ "allOf": [{"$ref": "#/components/schemas/SnowflakeType"}]
+ }
+ },
+ "required": ["badge_id"]
+ },
"ReorderCustomBadgesRequest": {
"type": "object",
"properties": {
"badge_ids": {
- "maxItems": 200,
+ "maxItems": 1000,
"type": "array",
"items": {"$ref": "#/components/schemas/SnowflakeType"},
- "description": "IDs of every custom badge on this instance, user and guild, in the new display order"
+ "description": "IDs of every custom badge on this instance, user and guild, in the new display order. Instances with more than 1000 badges move badges one at a time"
}
},
"required": ["badge_ids"]
@@ -19755,8 +19969,18 @@
"badges": {
"type": "array",
"items": {"$ref": "#/components/schemas/AdminCustomBadgeResponse"},
- "description": "Badges defined on this instance, in display order"
+ "description": "One page of badges, in display order"
+ },
+ "next": {
+ "nullable": true,
+ "description": "Pass this as after to get the next page, or null when there are no more badges to look at. A search page can hold fewer badges than the limit and still have a next page",
+ "allOf": [{"$ref": "#/components/schemas/CustomBadgeCursorType"}]
},
+ "version": {
+ "type": "string",
+ "description": "Version of the badge catalog. It changes whenever a badge is created, edited, deleted or moved"
+ },
+ "settings": {"$ref": "#/components/schemas/AdminCustomBadgeSettingsResponse"},
"built_in": {
"maxItems": 5,
"type": "array",
@@ -19764,7 +19988,7 @@
"description": "Every built-in badge and the image this instance shows for it"
}
},
- "required": ["badges", "built_in"],
+ "required": ["badges", "next", "version", "settings", "built_in"],
"additionalProperties": false
},
"BuiltInBadgeKindSchema": {
@@ -19802,6 +20026,21 @@
},
"required": ["type", "name", "image"]
},
+ "CustomBadgeCursorType": {
+ "type": "string",
+ "pattern": "^[gu]-?[0-9]{1,19}$",
+ "description": "Opaque cursor from the next field of a previous page"
+ },
+ "CustomBadgeTypeSchema": {
+ "description": "Where the badge is shown",
+ "x-enumNames": ["User", "Guild"],
+ "x-enumDescriptions": [
+ "Shown on the profiles of the users it is assigned to",
+ "Shown next to the names of the communities it is assigned to"
+ ],
+ "enum": ["user", "guild"],
+ "type": "string"
+ },
"AdminAuditLogResponseSchema": {
"type": "object",
"properties": {
@@ -20310,16 +20549,6 @@
"Personal notes DM channel"
]
},
- "CustomBadgeTypeSchema": {
- "description": "Where the badge is shown",
- "x-enumNames": ["User", "Guild"],
- "x-enumDescriptions": [
- "Shown on the profiles of the users it is assigned to",
- "Shown next to the names of the communities it is assigned to"
- ],
- "enum": ["user", "guild"],
- "type": "string"
- },
"AdminBuiltInBadgeImageResponse": {
"type": "object",
"properties": {
@@ -20338,6 +20567,23 @@
"required": ["kind", "asset_url", "built_in_asset"],
"additionalProperties": false
},
+ "CustomBadgeMoveDirectionSchema": {
+ "description": "Where to move the badge",
+ "x-enumNames": ["Up", "Down", "First", "Last"],
+ "x-enumDescriptions": [
+ "Swap places with the badge shown before it",
+ "Swap places with the badge shown after it",
+ "Show it before every other badge of its type",
+ "Show it after every other badge of its type"
+ ],
+ "enum": ["up", "down", "first", "last"],
+ "type": "string"
+ },
+ "CustomBadgePositionType": {
+ "type": "string",
+ "pattern": "^-?[0-9]{1,19}$",
+ "description": "Display position of the badge. Badges are shown in ascending order of this value"
+ },
"BanProfileSubstringRequest": {
"type": "object",
"properties": {
@@ -22618,16 +22864,16 @@
]
},
"CustomBadgeIdListResponse": {
- "maxItems": 10,
+ "maxItems": 1000,
"type": "array",
"items": {"$ref": "#/components/schemas/SnowflakeStringType"},
"description": "IDs of the custom badges assigned to it"
},
"CustomBadgeIdsType": {
- "maxItems": 10,
+ "maxItems": 1000,
"type": "array",
"items": {"$ref": "#/components/schemas/SnowflakeType"},
- "description": "IDs of the badges to assign, replacing the current ones"
+ "description": "IDs of the badges to assign, replacing the current ones. The badge settings set how many a user or community can have"
},
"GuildOperations": {
"type": "integer",
@@ -26376,7 +26622,7 @@
"This IP address cannot be added to the blocklist.",
"This network block belongs to an enforcement decision. End the decision to remove it.",
"You've reached the maximum of {limit, plural, one {# application} other {# applications}}.",
- "You've reached the maximum of {count, plural, one {# badge} other {# badges}} for this type.",
+ "The limit is {count, plural, one {# badge} other {# badges}}.",
"You've reached the maximum of {count, plural, one {# bookmark} other {# bookmarks}}.",
"This community has reached its active thread limit of {count}.",
"You've reached the maximum of {count, plural, one {# category channel} other {# category channels}}.",
diff --git a/fluxer_admin/src/api/badges.rs b/fluxer_admin/src/api/badges.rs
index 9cc681d6f..b29c2b40a 100644
--- a/fluxer_admin/src/api/badges.rs
+++ b/fluxer_admin/src/api/badges.rs
@@ -4,10 +4,38 @@ use crate::api::generated::{snowflake, types as generated_types};
use super::client::{AdminApiClient, ApiError, ApiResult};
use super::types::{
- AdminCustomBadge, AdminCustomBadgeList, AdminUser, CustomBadgeFields, CustomBadgeType,
- UserMutationResponse,
+ AdminCustomBadge, AdminCustomBadgeList, AdminUser, BadgeAssignment, BadgeListQuery, BadgeMove,
+ BadgeSettings, CustomBadgeFields, CustomBadgeType, UserMutationResponse,
};
+const LOOKUP_CHUNK: usize = 100;
+const ASSIGNMENT_CANDIDATES: usize = 25;
+const ASSIGNMENT_CANDIDATE_PAGE: u32 = 50;
+const ASSIGNMENT_SEARCH_PAGES: usize = 4;
+const ASSIGNMENT_PICKS_MAX: usize = 100;
+
+pub fn parse_badge_picks(value: Option<&str>) -> Vec<String> {
+ let mut picks: Vec<String> = Vec::new();
+ for id in value.unwrap_or("").split(',').map(str::trim) {
+ let valid =
+ !id.is_empty() && id.len() <= 20 && id.bytes().all(|byte| byte.is_ascii_digit());
+ if valid && !picks.iter().any(|pick| pick == id) {
+ picks.push(id.to_owned());
+ }
+ if picks.len() >= ASSIGNMENT_PICKS_MAX {
+ break;
+ }
+ }
+ picks
+}
+
+fn generated_type(badge_type: CustomBadgeType) -> generated_types::CustomBadgeTypeSchema {
+ match badge_type {
+ CustomBadgeType::User => generated_types::CustomBadgeTypeSchema::User,
+ CustomBadgeType::Guild => generated_types::CustomBadgeTypeSchema::Guild,
+ }
+}
+
fn badge_ids(ids: &[String]) -> generated_types::CustomBadgeIdsType {
generated_types::CustomBadgeIdsType(ids.iter().map(|id| snowflake(id)).collect())
}
@@ -17,10 +45,148 @@ fn parse_error(error: impl std::fmt::Display) -> ApiError {
}
impl AdminApiClient {
- pub async fn list_badges(&self) -> ApiResult<AdminCustomBadgeList> {
+ pub async fn list_badges(&self, query: &BadgeListQuery) -> ApiResult<AdminCustomBadgeList> {
+ let after = query
+ .after
+ .as_deref()
+ .map(str::parse::<generated_types::CustomBadgeCursorType>)
+ .transpose()
+ .map_err(parse_error)?;
+ let limit = query.limit.map(|limit| limit.to_string());
+ let response = self
+ .generated()
+ .list_admin_badges(
+ after.as_ref(),
+ None,
+ limit.as_deref(),
+ query.query.as_deref(),
+ query.badge_type.map(generated_type),
+ )
+ .await
+ .map_err(|e| self.generated_error(e))?;
+ self.generated_value(response.into_inner())
+ }
+
+ pub async fn find_badges(
+ &self,
+ badge_type: CustomBadgeType,
+ ids: &[String],
+ ) -> ApiResult<Vec<AdminCustomBadge>> {
+ let mut found = Vec::new();
+ for chunk in ids.chunks(LOOKUP_CHUNK) {
+ let ids: generated_types::ListAdminBadgesIds =
+ chunk.join(",").parse().map_err(parse_error)?;
+ let response = self
+ .generated()
+ .list_admin_badges(
+ None,
+ Some(&ids),
+ None,
+ None,
+ Some(generated_type(badge_type)),
+ )
+ .await
+ .map_err(|e| self.generated_error(e))?;
+ let list: AdminCustomBadgeList = self.generated_value(response.into_inner())?;
+ found.extend(list.badges);
+ }
+ Ok(found)
+ }
+
+ pub async fn load_badge_assignment(
+ &self,
+ badge_type: CustomBadgeType,
+ assigned_ids: &[String],
+ query: Option<&str>,
+ picked_ids: &[String],
+ ) -> ApiResult<BadgeAssignment> {
+ let query = query
+ .map(str::trim)
+ .filter(|query| !query.is_empty())
+ .map(|query| query.chars().take(64).collect::<String>());
+ let assigned = self.find_badges(badge_type, assigned_ids).await?;
+ let wanted: Vec<String> = picked_ids
+ .iter()
+ .filter(|id| !assigned.iter().any(|held| &held.id == *id))
+ .cloned()
+ .collect();
+ let found = self.find_badges(badge_type, &wanted).await?;
+ let picked: Vec<AdminCustomBadge> = wanted
+ .iter()
+ .filter_map(|id| found.iter().find(|badge| &badge.id == id).cloned())
+ .collect();
+ let mut candidates: Vec<AdminCustomBadge> = Vec::new();
+ let mut after = None;
+ let mut next = None;
+ let mut settings = None;
+ for _ in 0..ASSIGNMENT_SEARCH_PAGES {
+ let list = self
+ .list_badges(&BadgeListQuery {
+ badge_type: Some(badge_type),
+ query: query.clone(),
+ after: after.take(),
+ limit: Some(ASSIGNMENT_CANDIDATE_PAGE),
+ })
+ .await?;
+ settings.get_or_insert(list.settings);
+ candidates.extend(list.badges.into_iter().filter(|badge| {
+ !assigned.iter().any(|held| held.id == badge.id)
+ && !picked.iter().any(|pick| pick.id == badge.id)
+ }));
+ next = list.next;
+ if candidates.len() > ASSIGNMENT_CANDIDATES || next.is_none() {
+ break;
+ }
+ after.clone_from(&next);
+ }
+ let settings = settings.unwrap_or_default();
+ let more_candidates = next.is_some() || candidates.len() > ASSIGNMENT_CANDIDATES;
+ Ok(BadgeAssignment {
+ assigned,
+ picked,
+ search_incomplete: next.is_some() && candidates.len() <= ASSIGNMENT_CANDIDATES,
+ candidates: candidates.into_iter().take(ASSIGNMENT_CANDIDATES).collect(),
+ more_candidates,
+ query,
+ limit: match badge_type {
+ CustomBadgeType::User => settings.max_per_user,
+ CustomBadgeType::Guild => settings.max_per_guild,
+ },
+ })
+ }
+
+ pub async fn move_badge(
+ &self,
+ badge_id: &str,
+ direction: BadgeMove,
+ ) -> ApiResult<AdminCustomBadge> {
+ let body = generated_types::MoveCustomBadgeRequest {
+ badge_id: snowflake(badge_id),
+ direction: Some(match direction {
+ BadgeMove::Up => generated_types::CustomBadgeMoveDirectionSchema::Up,
+ BadgeMove::Down => generated_types::CustomBadgeMoveDirectionSchema::Down,
+ BadgeMove::First => generated_types::CustomBadgeMoveDirectionSchema::First,
+ BadgeMove::Last => generated_types::CustomBadgeMoveDirectionSchema::Last,
+ }),
+ after_id: None,
+ };
+ let response = self
+ .generated()
+ .move_admin_badge(&body)
+ .await
+ .map_err(|e| self.generated_error(e))?;
+ self.generated_value(response.into_inner())
+ }
+
+ pub async fn update_badge_settings(&self, settings: BadgeSettings) -> ApiResult<BadgeSettings> {
+ let limit = |value: u32| std::num::NonZeroU64::new(u64::from(value));
+ let body = generated_types::UpdateCustomBadgeSettingsRequest {
+ max_per_user: limit(settings.max_per_user),
+ max_per_guild: limit(settings.max_per_guild),
+ };
let response = self
.generated()
- .list_admin_badges()
+ .update_admin_badge_settings(&body)
.await
.map_err(|e| self.generated_error(e))?;
self.generated_value(response.into_inner())
@@ -35,10 +201,7 @@ impl AdminApiClient {
.image
.ok_or_else(|| ApiError::Parse("Choose an image to upload".to_owned()))?;
let body = generated_types::CreateCustomBadgeRequest {
- type_: match badge_type {
- CustomBadgeType::User => generated_types::CustomBadgeTypeSchema::User,
- CustomBadgeType::Guild => generated_types::CustomBadgeTypeSchema::Guild,
- },
+ type_: generated_type(badge_type),
name: fields.name,
description: fields.description,
href: fields.href,
@@ -111,18 +274,6 @@ impl AdminApiClient {
self.generated_value(response.into_inner())
}
- pub async fn reorder_badges(&self, ids: &[String]) -> ApiResult<AdminCustomBadgeList> {
- let body = generated_types::ReorderCustomBadgesRequest {
- badge_ids: ids.iter().map(|id| snowflake(id)).collect(),
- };
- let response = self
- .generated()
- .reorder_admin_badges(&body)
- .await
- .map_err(|e| self.generated_error(e))?;
- self.generated_value(response.into_inner())
- }
-
pub async fn update_user_badges(&self, user_id: &str, ids: &[String]) -> ApiResult<AdminUser> {
let body = generated_types::UpdateUserCustomBadgesRequest {
badge_ids: badge_ids(ids),
diff --git a/fluxer_admin/src/api/types/badges.rs b/fluxer_admin/src/api/types/badges.rs
index b023b037a..f69959edc 100644
--- a/fluxer_admin/src/api/types/badges.rs
+++ b/fluxer_admin/src/api/types/badges.rs
@@ -12,9 +12,10 @@ pub const BADGE_IMAGE_TYPES: &[&str] = &[
"image/svg+xml",
];
-#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
+#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum CustomBadgeType {
+ #[default]
User,
Guild,
}
@@ -41,6 +42,8 @@ pub struct AdminCustomBadge {
pub id: String,
#[serde(rename = "type")]
pub badge_type: CustomBadgeType,
+ #[serde(default)]
+ pub position: String,
pub name: String,
pub description: Option<String>,
pub asset_url: String,
@@ -86,10 +89,32 @@ impl BuiltInBadgeImage {
}
}
+#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
+pub struct BadgeSettings {
+ pub max_per_user: u32,
+ pub max_per_guild: u32,
+}
+
+impl Default for BadgeSettings {
+ fn default() -> Self {
+ Self {
+ max_per_user: 100,
+ max_per_guild: 50,
+ }
+ }
+}
+
+pub const BADGES_PER_USER_CEILING: u32 = 1000;
+pub const BADGES_PER_GUILD_CEILING: u32 = 200;
+
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct AdminCustomBadgeList {
pub badges: Vec<AdminCustomBadge>,
#[serde(default)]
+ pub next: Option<String>,
+ #[serde(default)]
+ pub settings: BadgeSettings,
+ #[serde(default)]
pub built_in: Vec<BuiltInBadgeImage>,
}
@@ -97,6 +122,8 @@ pub struct AdminCustomBadgeList {
pub enum BadgeMove {
Up,
Down,
+ First,
+ Last,
}
impl BadgeMove {
@@ -104,6 +131,8 @@ impl BadgeMove {
match value {
"up" => Some(Self::Up),
"down" => Some(Self::Down),
+ "first" => Some(Self::First),
+ "last" => Some(Self::Last),
_ => None,
}
}
@@ -112,8 +141,27 @@ impl BadgeMove {
match self {
Self::Up => "up",
Self::Down => "down",
+ Self::First => "first",
+ Self::Last => "last",
}
}
+
+ pub fn label(self) -> &'static str {
+ match self {
+ Self::Up => "Move up",
+ Self::Down => "Move down",
+ Self::First => "Move to top",
+ Self::Last => "Move to bottom",
+ }
+ }
+}
+
+#[derive(Clone, Debug, Default)]
+pub struct BadgeListQuery {
+ pub badge_type: Option<CustomBadgeType>,
+ pub query: Option<String>,
+ pub after: Option<String>,
+ pub limit: Option<u32>,
}
impl AdminCustomBadgeList {
@@ -125,25 +173,17 @@ impl AdminCustomBadgeList {
.iter()
.filter(move |badge| badge.badge_type() == badge_type)
}
+}
- pub fn of_type(&self, badge_type: CustomBadgeType) -> impl Iterator<Item = &AdminCustomBadge> {
- self.badges
- .iter()
- .filter(move |badge| badge.badge_type == badge_type)
- }
-
- pub fn moved_order(&self, badge_id: &str, direction: BadgeMove) -> Option<Vec<String>> {
- let index = self.badges.iter().position(|badge| badge.id == badge_id)?;
- let badge_type = self.badges[index].badge_type;
- let same_type = |candidate: &AdminCustomBadge| candidate.badge_type == badge_type;
- let neighbour = match direction {
- BadgeMove::Up => self.badges[..index].iter().rposition(same_type)?,
- BadgeMove::Down => index + 1 + self.badges[index + 1..].iter().position(same_type)?,
- };
- let mut order: Vec<String> = self.badges.iter().map(|badge| badge.id.clone()).collect();
- order.swap(index, neighbour);
- Some(order)
- }
+#[derive(Clone, Debug, Default)]
+pub struct BadgeAssignment {
+ pub assigned: Vec<AdminCustomBadge>,
+ pub picked: Vec<AdminCustomBadge>,
+ pub candidates: Vec<AdminCustomBadge>,
+ pub more_candidates: bool,
+ pub search_incomplete: bool,
+ pub query: Option<String>,
+ pub limit: u32,
}
pub struct CustomBadgeFields {
diff --git a/fluxer_admin/src/routes/badges.rs b/fluxer_admin/src/routes/badges.rs
index a2e6c783c..83b2fe5f1 100644
--- a/fluxer_admin/src/routes/badges.rs
+++ b/fluxer_admin/src/routes/badges.rs
@@ -4,7 +4,8 @@ use crate::{
api::{
client::{AdminApiClient, ApiError},
types::{
- BADGE_IMAGE_MAX_BYTES, BADGE_IMAGE_TYPES, BadgeMove, CustomBadgeFields, CustomBadgeType,
+ BADGE_IMAGE_MAX_BYTES, BADGE_IMAGE_TYPES, BadgeListQuery, BadgeMove, BadgeSettings,
+ CustomBadgeFields, CustomBadgeType,
},
},
middleware::{
@@ -13,19 +14,63 @@ use crate::{
flash::{self, FlashData},
},
state::AppState,
- templates,
+ templates::{
+ self,
+ pages::badges::{BADGE_PAGE_SIZE, BadgePageState},
+ },
};
use axum::{
- Router,
- extract::{DefaultBodyLimit, Multipart, Path, Request, State},
+ Form, Router,
+ extract::{DefaultBodyLimit, Multipart, Path, Query, Request, State},
response::{Html, IntoResponse, Response},
routing::{get, post},
};
use base64::{Engine as _, engine::general_purpose::STANDARD};
+use serde::Deserialize;
+
+#[derive(Debug, Default, Deserialize)]
+pub struct BadgePageQuery {
+ #[serde(default, rename = "type")]
+ badge_type: Option<String>,
+ #[serde(default)]
+ q: Option<String>,
+ #[serde(default)]
+ after: Option<String>,
+ #[serde(default)]
+ trail: Option<String>,
+}
+
+impl BadgePageQuery {
+ fn back(&self, config: &crate::config::AdminConfig) -> String {
+ format!(
+ "{}/badges{}",
+ config.base_path,
+ self.state().current_query()
+ )
+ }
+
+ fn state(&self) -> BadgePageState {
+ BadgePageState::parse(
+ self.badge_type.as_deref(),
+ self.q.as_deref(),
+ self.after.as_deref(),
+ self.trail.as_deref(),
+ )
+ }
+}
+
+#[derive(Debug, Deserialize)]
+struct BadgeSettingsForm {
+ #[serde(default)]
+ max_per_user: Option<String>,
+ #[serde(default)]
+ max_per_guild: Option<String>,
+}
pub fn router() -> Router<AppState> {
Router::new()
.route("/badges", get(badges_page).post(create_badge))
+ .route("/badges/settings", post(update_settings))
.route("/badges/{badge_id}", post(update_badge))
.route("/badges/{badge_id}/delete", post(delete_badge))
.route("/badges/{badge_id}/move/{direction}", post(move_badge))
@@ -37,20 +82,79 @@ pub fn router() -> Router<AppState> {
async fn badges_page(
State(state): State<AppState>,
auth: axum::Extension<AuthContext>,
+ Query(query): Query<BadgePageQuery>,
request: Request,
) -> Response {
let config = state.config();
let csrf_token = csrf::get_csrf_token(&request);
+ let page = query.state();
let client = AdminApiClient::new(state.http_client(), config, &auth.0.session);
- let result = client.list_badges().await;
+ let result = client
+ .list_badges(&BadgeListQuery {
+ badge_type: Some(page.badge_type),
+ query: page.query.clone(),
+ after: page.after.clone(),
+ limit: Some(BADGE_PAGE_SIZE),
+ })
+ .await;
if let Err(error) = &result {
tracing::warn!(%error, "admin API request failed: list badges");
}
- let markup =
- templates::pages::badges::badges_page(config, &auth.0, result.as_ref().ok(), &csrf_token);
+ let markup = templates::pages::badges::badges_page(
+ config,
+ &auth.0,
+ result.as_ref().ok(),
+ &page,
+ &csrf_token,
+ );
Html(markup.into_string()).into_response()
}
+fn parse_limit(value: Option<&str>, ceiling: u32) -> Option<u32> {
+ value
+ .map(str::trim)
+ .and_then(|value| value.parse::<u32>().ok())
+ .filter(|value| (1..=ceiling).contains(value))
+}
+
+async fn update_settings(
+ State(state): State<AppState>,
+ auth: axum::Extension<AuthContext>,
+ Query(query): Query<BadgePageQuery>,
+ Form(form): Form<BadgeSettingsForm>,
+) -> Response {
+ let config = state.config();
+ let back = query.back(config);
+ let (Some(max_per_user), Some(max_per_guild)) = (
+ parse_limit(
+ form.max_per_user.as_deref(),
+ crate::api::types::BADGES_PER_USER_CEILING,
+ ),
+ parse_limit(
+ form.max_per_guild.as_deref(),
+ crate::api::types::BADGES_PER_GUILD_CEILING,
+ ),
+ ) else {
+ return flash::redirect_error(
+ config,
+ &back,
+ "Enter a limit from 1 to 1000 for users and from 1 to 200 for guilds",
+ );
+ };
+ let client = AdminApiClient::new(state.http_client(), config, &auth.0.session);
+ let flash = match client
+ .update_badge_settings(BadgeSettings {
+ max_per_user,
+ max_per_guild,
+ })
+ .await
+ {
+ Ok(_) => FlashData::success("Badge limits saved"),
+ Err(error) => failure("save the limits of", &error),
+ };
+ flash::redirect_with_flash(&back, flash, config.secure_cookies())
+}
+
struct BadgeForm {
badge_type: Option<CustomBadgeType>,
fields: CustomBadgeFields,
@@ -128,10 +232,11 @@ fn failure(action: &str, error: &ApiError) -> FlashData {
async fn create_badge(
State(state): State<AppState>,
auth: axum::Extension<AuthContext>,
+ Query(query): Query<BadgePageQuery>,
multipart: Multipart,
) -> Response {
let config = state.config();
- let back = format!("{}/badges", config.base_path);
+ let back = query.back(config);
let form = match read_badge_form(multipart).await {
Ok(form) => form,
Err(message) => return flash::redirect_error(config, &back, message),
@@ -154,10 +259,11 @@ async fn update_badge(
State(state): State<AppState>,
auth: axum::Extension<AuthContext>,
Path(badge_id): Path<String>,
+ Query(query): Query<BadgePageQuery>,
multipart: Multipart,
) -> Response {
let config = state.config();
- let back = format!("{}/badges", config.base_path);
+ let back = query.back(config);
let form = match read_badge_form(multipart).await {
Ok(form) => form,
Err(message) => return flash::redirect_error(config, &back, message),
@@ -174,9 +280,10 @@ async fn delete_badge(
State(state): State<AppState>,
auth: axum::Extension<AuthContext>,
Path(badge_id): Path<String>,
+ Query(query): Query<BadgePageQuery>,
) -> Response {
let config = state.config();
- let back = format!("{}/badges", config.base_path);
+ let back = query.back(config);
let client = AdminApiClient::new(state.http_client(), config, &auth.0.session);
let flash = match client.delete_badge(&badge_id).await {
Ok(()) => FlashData::success("Badge deleted"),
@@ -189,10 +296,11 @@ async fn replace_built_in_image(
State(state): State<AppState>,
auth: axum::Extension<AuthContext>,
Path(kind): Path<String>,
+ Query(query): Query<BadgePageQuery>,
mut multipart: Multipart,
) -> Response {
let config = state.config();
- let back = format!("{}/badges", config.base_path);
+ let back = query.back(config);
let mut image = None;
while let Ok(Some(field)) = multipart.next_field().await {
if field.name() != Some("image") {
@@ -232,9 +340,10 @@ async fn reset_built_in_image(
State(state): State<AppState>,
auth: axum::Extension<AuthContext>,
Path(kind): Path<String>,
+ Query(query): Query<BadgePageQuery>,
) -> Response {
let config = state.config();
- let back = format!("{}/badges", config.base_path);
+ let back = query.back(config);
let client = AdminApiClient::new(state.http_client(), config, &auth.0.session);
let flash = match client.reset_built_in_badge_image(&kind).await {
Ok(_) => FlashData::success("Badge uses the built-in image again"),
@@ -247,27 +356,15 @@ async fn move_badge(
State(state): State<AppState>,
auth: axum::Extension<AuthContext>,
Path((badge_id, direction)): Path<(String, String)>,
+ Query(query): Query<BadgePageQuery>,
) -> Response {
let config = state.config();
- let back = format!("{}/badges", config.base_path);
+ let back = query.back(config);
let Some(direction) = BadgeMove::parse(&direction) else {
- return flash::redirect_error(config, &back, "Choose up or down");
+ return flash::redirect_error(config, &back, "Choose up, down, top or bottom");
};
let client = AdminApiClient::new(state.http_client(), config, &auth.0.session);
- let badges = match client.list_badges().await {
- Ok(badges) => badges,
- Err(error) => {
- return flash::redirect_with_flash(
- &back,
- failure("move", &error),
- config.secure_cookies(),
- );
- }
- };
- let Some(order) = badges.moved_order(&badge_id, direction) else {
- return flash::redirect_error(config, &back, "This badge cannot move any further");
- };
- let flash = match client.reorder_badges(&order).await {
+ let flash = match client.move_badge(&badge_id, direction).await {
Ok(_) => FlashData::success("Badge moved"),
Err(error) => failure("move", &error),
};
diff --git a/fluxer_admin/src/routes/guild_tabs.rs b/fluxer_admin/src/routes/guild_tabs.rs
index af201ce1c..3e1503c93 100644
--- a/fluxer_admin/src/routes/guild_tabs.rs
+++ b/fluxer_admin/src/routes/guild_tabs.rs
@@ -5,6 +5,7 @@ use crate::{
api::{
audit::SearchAuditLogsParams,
client::{AdminApiClient, ApiResultExt},
+ types::CustomBadgeType,
},
config::AdminConfig,
templates::{
@@ -23,6 +24,8 @@ pub struct GuildTabQuery {
pub members_page: Option<u32>,
pub reports_page: Option<u32>,
pub audit_before: Option<String>,
+ pub badge_query: Option<String>,
+ pub badge_picks: Vec<String>,
}
pub async fn render(
@@ -43,23 +46,26 @@ pub async fn render(
if !acl::has_permission(admin_acls, acl::BADGE_LIST) {
return None;
}
- let (detail, badges) = tokio::join!(
- async {
- client
- .lookup_guild(guild_id)
- .await
- .log_error("load guild badges")
- .flatten()
- },
- async {
- client
- .list_badges()
- .await
- .log_error("load badges for guild")
- }
- );
+ let detail = client
+ .lookup_guild(guild_id)
+ .await
+ .log_error("load guild badges")
+ .flatten()?;
+ let assignment = client
+ .load_badge_assignment(
+ CustomBadgeType::Guild,
+ &detail.badge_ids,
+ query.badge_query.as_deref(),
+ &query.badge_picks,
+ )
+ .await
+ .log_error("load badges for guild")?;
Some(tabs::badges::badges_tab(
- config, &detail?, &badges?, csrf_token, admin_acls,
+ config,
+ &detail,
+ &assignment,
+ csrf_token,
+ admin_acls,
))
}
"members" => {
diff --git a/fluxer_admin/src/routes/guilds.rs b/fluxer_admin/src/routes/guilds.rs
index 156fc75b2..ffb45656f 100644
--- a/fluxer_admin/src/routes/guilds.rs
+++ b/fluxer_admin/src/routes/guilds.rs
@@ -43,6 +43,8 @@ struct GuildDetailQuery {
page: Option<u32>,
reports_page: Option<u32>,
before: Option<String>,
+ badge_q: Option<String>,
+ badge_pick: Option<String>,
}
#[derive(Deserialize)]
@@ -580,6 +582,8 @@ fn to_tab_query(q: &GuildDetailQuery) -> guild_tabs::GuildTabQuery {
members_page: q.page,
reports_page: q.reports_page,
audit_before: q.before.clone(),
+ badge_query: q.badge_q.clone(),
+ badge_picks: crate::api::badges::parse_badge_picks(q.badge_pick.as_deref()),
}
}
diff --git a/fluxer_admin/src/routes/user_tabs.rs b/fluxer_admin/src/routes/user_tabs.rs
index aa2966cf5..7396ebc02 100644
--- a/fluxer_admin/src/routes/user_tabs.rs
+++ b/fluxer_admin/src/routes/user_tabs.rs
@@ -5,7 +5,7 @@ use crate::{
api::{
audit::SearchAuditLogsParams,
client::{AdminApiClient, ApiResultExt},
- types::AccountIdentitySettings,
+ types::{AccountIdentitySettings, CustomBadgeType},
},
config::AdminConfig,
templates::{
@@ -27,6 +27,8 @@ pub struct TabQuery {
pub delete_all_messages_message_count: Option<u64>,
pub report_id: Option<String>,
pub message: Option<String>,
+ pub badge_query: Option<String>,
+ pub badge_picks: Vec<String>,
}
#[allow(clippy::too_many_arguments)]
@@ -64,7 +66,12 @@ pub async fn render(
async {
if acl::has_permission(admin_acls, acl::BADGE_LIST) {
client
- .list_badges()
+ .load_badge_assignment(
+ CustomBadgeType::User,
+ &u.badge_ids,
+ query.badge_query.as_deref(),
+ &query.badge_picks,
+ )
.await
.log_error("load badges for user overview")
} else {
diff --git a/fluxer_admin/src/routes/users.rs b/fluxer_admin/src/routes/users.rs
index b3490a924..4102dca6c 100644
--- a/fluxer_admin/src/routes/users.rs
+++ b/fluxer_admin/src/routes/users.rs
@@ -54,6 +54,8 @@ struct UserDetailQuery {
delete_all_messages_message_count: Option<u64>,
report_id: Option<String>,
message: Option<String>,
+ badge_q: Option<String>,
+ badge_pick: Option<String>,
}
#[derive(Deserialize)]
@@ -331,6 +333,8 @@ async fn user_tab(
delete_all_messages_message_count: None,
report_id: None,
message: None,
+ badge_query: None,
+ badge_picks: Vec::new(),
};
let admin_acls = auth.0.acls();
let account_identity = state.account_identity_settings(&client).await;
@@ -390,6 +394,8 @@ fn to_tab_query(q: &UserDetailQuery) -> user_tabs::TabQuery {
delete_all_messages_message_count: q.delete_all_messages_message_count,
report_id: q.report_id.clone(),
message: q.message.clone(),
+ badge_query: q.badge_q.clone(),
+ badge_picks: crate::api::badges::parse_badge_picks(q.badge_pick.as_deref()),
}
}
diff --git a/fluxer_admin/src/templates/components/form.rs b/fluxer_admin/src/templates/components/form.rs
index ea952cbd0..b75fbdb49 100644
--- a/fluxer_admin/src/templates/components/form.rs
+++ b/fluxer_admin/src/templates/components/form.rs
@@ -155,6 +155,22 @@ pub fn secondary_button(label: &str) -> Markup {
button_markup(label, "submit", SECONDARY_BUTTON_CLASS)
}
+fn subject_button_markup(label: &str, subject: &str, variant_class: &str) -> Markup {
+ html! {
+ button type="submit" class={(BUTTON_BASE_CLASS) " " (variant_class)} {
+ span { (label) span class="sr-only" { ", " (subject) } }
+ }
+ }
+}
+
+pub fn secondary_button_for(label: &str, subject: &str) -> Markup {
+ subject_button_markup(label, subject, SECONDARY_BUTTON_CLASS)
+}
+
+pub fn danger_button_for(label: &str, subject: &str) -> Markup {
+ subject_button_markup(label, subject, DANGER_BUTTON_CLASS)
+}
+
pub fn form_field_group(
label: &str,
name: &str,
diff --git a/fluxer_admin/src/templates/components/user_profile_badges.rs b/fluxer_admin/src/templates/components/user_profile_badges.rs
index 95f5fcf3c..692bd2598 100644
--- a/fluxer_admin/src/templates/components/user_profile_badges.rs
+++ b/fluxer_admin/src/templates/components/user_profile_badges.rs
@@ -26,6 +26,13 @@ impl BadgeSize {
}
}
+ fn shown(self) -> usize {
+ match self {
+ BadgeSize::Detail => 15,
+ BadgeSize::Dense => 7,
+ }
+ }
+
fn caption_class(self) -> &'static str {
match self {
BadgeSize::Detail => "inline-flex h-6 items-center text-base",
@@ -51,9 +58,11 @@ pub fn user_profile_badges(
return html! {};
}
let cdn = static_cdn_endpoint.trim_end_matches('/');
+ let shown = &badges[..badges.len().min(size.shown())];
+ let hidden = badges.len() - shown.len();
html! {
- div class="flex items-center gap-1.5" {
- @for badge in badges {
+ div class="flex flex-wrap items-center gap-1.5" {
+ @for badge in shown {
@let title = badge_title(badge);
@let opacity = if badge.suppressed { " opacity-50" } else { "" };
@if let Some(asset) = size.asset(badge) {
@@ -71,6 +80,14 @@ pub fn user_profile_badges(
}
}
}
+ @if hidden > 0 {
+ @let more = format!("{hidden} more badges");
+ span title=(more)
+ class={(size.caption_class()) " rounded bg-neutral-200 px-1.5 font-semibold tabular-nums text-neutral-700"} {
+ span aria-hidden="true" { "+" (hidden) }
+ span class="sr-only" { (more) }
+ }
+ }
}
}
}
diff --git a/fluxer_admin/src/templates/pages/badges.rs b/fluxer_admin/src/templates/pages/badges.rs
index 23d037c1d..b228a1fc7 100644
--- a/fluxer_admin/src/templates/pages/badges.rs
+++ b/fluxer_admin/src/templates/pages/badges.rs
@@ -4,7 +4,8 @@ use crate::{
acl,
api::types::{
AdminCustomBadge, AdminCustomBadgeList, BADGE_IMAGE_MAX_BYTES, BADGE_IMAGE_TYPES,
- BadgeMove, BuiltInBadgeImage, CustomBadgeType,
+ BADGES_PER_GUILD_CEILING, BADGES_PER_USER_CEILING, BadgeAssignment, BadgeMove,
+ BuiltInBadgeImage, CustomBadgeType,
},
config::AdminConfig,
middleware::auth::AuthContext,
@@ -13,8 +14,9 @@ use crate::{
empty_state::empty_state_full,
error_display::error_alert,
form::{
- FORM_INPUT_CLASS, FORM_LABEL_CLASS, FORM_SELECT_CLASS, csrf_input, danger_button,
- secondary_button, submit_button,
+ FORM_INPUT_CLASS, FORM_LABEL_CLASS, FORM_SELECT_CLASS, csrf_input,
+ danger_button_for, form_actions, secondary_button, secondary_button_for,
+ submit_button,
},
page_container::{card_with_header, page_header},
},
@@ -29,10 +31,95 @@ struct BadgePermissions {
delete: bool,
}
+pub const BADGE_PAGE_SIZE: u32 = 50;
+
+#[derive(Clone, Debug, Default)]
+pub struct BadgePageState {
+ pub badge_type: CustomBadgeType,
+ pub query: Option<String>,
+ pub after: Option<String>,
+ pub trail: Vec<Option<String>>,
+}
+
+fn is_cursor(value: &str) -> bool {
+ let rest = value.strip_prefix(['g', 'u']).unwrap_or("");
+ let digits = rest.strip_prefix('-').unwrap_or(rest);
+ !digits.is_empty() && digits.len() <= 19 && digits.bytes().all(|byte| byte.is_ascii_digit())
+}
+
+impl BadgePageState {
+ pub fn parse(
+ badge_type: Option<&str>,
+ query: Option<&str>,
+ after: Option<&str>,
+ trail: Option<&str>,
+ ) -> Self {
+ let cursor = |value: &str| is_cursor(value).then(|| value.to_owned());
+ Self {
+ badge_type: badge_type
+ .and_then(CustomBadgeType::parse)
+ .unwrap_or(CustomBadgeType::User),
+ query: query
+ .map(str::trim)
+ .filter(|query| !query.is_empty())
+ .map(|query| query.chars().take(64).collect()),
+ after: after.and_then(cursor),
+ trail: trail
+ .unwrap_or("")
+ .split(',')
+ .filter(|entry| !entry.is_empty())
+ .map(cursor)
+ .collect(),
+ }
+ }
+
+ fn encode(&self, after: Option<&str>, trail: &[Option<String>]) -> String {
+ let mut url = format!("?type={}", self.badge_type.as_str());
+ if let Some(query) = &self.query {
+ url.push_str("&q=");
+ url.push_str(&urlencoding::encode(query));
+ }
+ if let Some(after) = after {
+ url.push_str("&after=");
+ url.push_str(after);
+ }
+ if !trail.is_empty() {
+ let joined: Vec<&str> = trail
+ .iter()
+ .map(|entry| entry.as_deref().unwrap_or("-"))
+ .collect();
+ url.push_str("&trail=");
+ url.push_str(&joined.join(","));
+ }
+ url
+ }
+
+ pub fn current_query(&self) -> String {
+ self.encode(self.after.as_deref(), &self.trail)
+ }
+
+ fn next_query(&self, next: &str) -> String {
+ let mut trail = self.trail.clone();
+ trail.push(self.after.clone());
+ self.encode(Some(next), &trail)
+ }
+
+ fn previous_query(&self) -> Option<String> {
+ let mut trail = self.trail.clone();
+ let previous = trail.pop()?;
+ Some(self.encode(previous.as_deref(), &trail))
+ }
+
+ fn type_query(badge_type: CustomBadgeType) -> String {
+ format!("?type={}", badge_type.as_str())
+ }
+}
+
pub fn badges_page(
config: &AdminConfig,
auth: &AuthContext,
badges: Option<&AdminCustomBadgeList>,
+ state: &BadgePageState,
csrf_token: &str,
) -> Markup {
let acls = auth.acls();
@@ -44,18 +131,18 @@ pub fn badges_page(
let content = html! {
(page_header(
"Badges",
- Some("Badges that you give to users and guilds. Users show them on their profile, and guilds show them next to their name. You can make up to 100 badges of each type."),
+ Some("Badges that you give to users and guilds. Users show them on their profile, and guilds show them next to their name."),
))
@match badges {
None => (error_alert("Failed to load badges.")),
Some(list) => {
div class="space-y-6" {
- (badge_section(config, list, CustomBadgeType::User, &permissions, csrf_token))
- (badge_section(config, list, CustomBadgeType::Guild, &permissions, csrf_token))
- (built_in_section(config, list, CustomBadgeType::User, &permissions, csrf_token))
- (built_in_section(config, list, CustomBadgeType::Guild, &permissions, csrf_token))
+ (badge_section(config, list, state, &permissions, csrf_token))
+ (limits_card(config, list, state, &permissions, csrf_token))
+ (built_in_section(config, list, CustomBadgeType::User, state, &permissions, csrf_token))
+ (built_in_section(config, list, CustomBadgeType::Guild, state, &permissions, csrf_token))
@if permissions.create {
- (create_form(config, csrf_token))
+ (create_form(config, state, csrf_token))
}
}
}
@@ -64,6 +151,103 @@ pub fn badges_page(
admin_layout(config, auth, "Badges", "badges", None, content)
}
+const TAB_CLASS: &str = "rounded-lg px-3 py-2 font-medium text-sm";
+const TAB_ACTIVE_CLASS: &str = "rounded-lg bg-neutral-900 px-3 py-2 font-medium text-sm text-white";
+
+fn type_tabs(config: &AdminConfig, state: &BadgePageState) -> Markup {
+ html! {
+ nav class="mb-4 flex flex-wrap gap-2" aria-label="Badge type" {
+ @for badge_type in [CustomBadgeType::User, CustomBadgeType::Guild] {
+ a href={(config.base_path) "/badges" (BadgePageState::type_query(badge_type))}
+ class=(if badge_type == state.badge_type { TAB_ACTIVE_CLASS } else { TAB_CLASS })
+ aria-current=[(badge_type == state.badge_type).then_some("page")] {
+ (section_title(badge_type))
+ }
+ }
+ }
+ }
+}
+
+fn search_form(config: &AdminConfig, state: &BadgePageState) -> Markup {
+ html! {
+ form method="get" action={(config.base_path) "/badges"} class="mb-4 flex flex-wrap items-end gap-2" {
+ input type="hidden" name="type" value=(state.badge_type.as_str());
+ label class="flex min-w-0 flex-1 flex-col gap-1" for="badge-search" {
+ span class=(FORM_LABEL_CLASS) { "Search" }
+ input type="search" id="badge-search" name="q" value=(state.query.as_deref().unwrap_or(""))
+ maxlength="64" placeholder="Name or ID" class=(FORM_INPUT_CLASS);
+ }
+ (secondary_button("Search"))
+ @if state.query.is_some() {
+ a href={(config.base_path) "/badges" (BadgePageState::type_query(state.badge_type))}
+ class=(BADGE_ACTION_BUTTON_CLASS) { "Clear" }
+ }
+ }
+ }
+}
+
+fn pagination(config: &AdminConfig, list: &AdminCustomBadgeList, state: &BadgePageState) -> Markup {
+ let previous = state.previous_query();
+ html! {
+ @if previous.is_some() || list.next.is_some() || state.after.is_some() {
+ nav class="mt-4 flex flex-wrap gap-2" aria-label="Pages" {
+ @if state.after.is_some() {
+ a href={(config.base_path) "/badges" (state.encode(None, &[]))} class=(BADGE_ACTION_BUTTON_CLASS) { "First page" }
+ }
+ @if let Some(previous) = previous {
+ a href={(config.base_path) "/badges" (previous)} class=(BADGE_ACTION_BUTTON_CLASS) { "Previous" }
+ }
+ @if let Some(next) = &list.next {
+ a href={(config.base_path) "/badges" (state.next_query(next))} class=(BADGE_ACTION_BUTTON_CLASS) { "Next" }
+ }
+ }
+ }
+ }
+}
+
+fn limits_card(
+ config: &AdminConfig,
+ list: &AdminCustomBadgeList,
+ state: &BadgePageState,
+ permissions: &BadgePermissions,
+ csrf_token: &str,
+) -> Markup {
+ let settings = list.settings;
+ card_with_header(
+ "Limits",
+ html! {
+ p class="mb-4 text-sm text-neutral-600" {
+ "How many badges one user or one guild can be given. Lowering a limit keeps badges already given. A user or guild over the limit can lose badges but cannot get new ones."
+ }
+ p class="mb-4 text-sm text-neutral-600" {
+ "Profiles and guild data list every badge given, and older app versions show them all in one row. High limits make that data larger."
+ }
+ @if permissions.update {
+ form method="post" action={(config.base_path) "/badges/settings" (state.current_query())} class="flex flex-col gap-3" {
+ (csrf_input(csrf_token))
+ label class="flex flex-col gap-1" for="badge-limit-user" {
+ span class=(FORM_LABEL_CLASS) { "Badges per user" }
+ input type="number" id="badge-limit-user" name="max_per_user" required
+ min="1" max=(BADGES_PER_USER_CEILING) value=(settings.max_per_user) class=(FORM_INPUT_CLASS);
+ span class="text-neutral-500 text-xs" { "From 1 to " (BADGES_PER_USER_CEILING) "." }
+ }
+ label class="flex flex-col gap-1" for="badge-limit-guild" {
+ span class=(FORM_LABEL_CLASS) { "Badges per guild" }
+ input type="number" id="badge-limit-guild" name="max_per_guild" required
+ min="1" max=(BADGES_PER_GUILD_CEILING) value=(settings.max_per_guild) class=(FORM_INPUT_CLASS);
+ span class="text-neutral-500 text-xs" { "From 1 to " (BADGES_PER_GUILD_CEILING) "." }
+ }
+ div { (submit_button("Save limits")) }
+ }
+ } @else {
+ p class="text-sm text-neutral-800" {
+ "Users can have up to " (settings.max_per_user) " badges and guilds up to " (settings.max_per_guild) "."
+ }
+ }
+ },
+ )
+}
+
fn section_title(badge_type: CustomBadgeType) -> &'static str {
match badge_type {
CustomBadgeType::User => "User badges",
@@ -74,26 +258,35 @@ fn section_title(badge_type: CustomBadgeType) -> &'static str {
fn badge_section(
config: &AdminConfig,
list: &AdminCustomBadgeList,
- badge_type: CustomBadgeType,
+ state: &BadgePageState,
permissions: &BadgePermissions,
csrf_token: &str,
) -> Markup {
- let badges: Vec<&AdminCustomBadge> = list.of_type(badge_type).collect();
+ let badges = &list.badges;
+ let empty_text = if state.query.is_some() {
+ "No badges on this page match the search."
+ } else {
+ "No badges of this type yet."
+ };
card_with_header(
- section_title(badge_type),
+ "Custom badges",
html! {
+ (type_tabs(config, state))
+ (search_form(config, state))
@if badges.is_empty() {
- (empty_state_full(None, "No badges of this type yet.", None))
+ (empty_state_full(None, empty_text, None))
} @else {
div class="divide-y divide-neutral-100" {
@for (index, badge) in badges.iter().enumerate() {
- (badge_row(config, badge, permissions, csrf_token, BadgePosition {
- first: index == 0,
- last: index + 1 == badges.len(),
+ (badge_row(config, badge, state, permissions, csrf_token, BadgePosition {
+ first: index == 0 && state.after.is_none(),
+ last: index + 1 == badges.len() && list.next.is_none(),
+ reorder: state.query.is_none(),
}))
}
}
}
+ (pagination(config, list, state))
},
)
}
@@ -146,6 +339,7 @@ fn built_in_section(
config: &AdminConfig,
list: &AdminCustomBadgeList,
badge_type: CustomBadgeType,
+ state: &BadgePageState,
permissions: &BadgePermissions,
csrf_token: &str,
) -> Markup {
@@ -161,7 +355,7 @@ fn built_in_section(
}
div class="divide-y divide-neutral-100" {
@for badge in list.built_in_of_type(badge_type) {
- (built_in_row(config, badge, permissions, csrf_token))
+ (built_in_row(config, badge, state, permissions, csrf_token))
}
}
},
@@ -171,6 +365,7 @@ fn built_in_section(
fn built_in_row(
config: &AdminConfig,
badge: &BuiltInBadgeImage,
+ state: &BadgePageState,
permissions: &BadgePermissions,
csrf_token: &str,
) -> Markup {
@@ -190,18 +385,22 @@ fn built_in_row(
@if permissions.update {
div class="flex flex-wrap items-start gap-2" {
details class="rounded-lg border border-neutral-200 open:basis-full" {
- summary class="cursor-pointer rounded-lg px-3 py-2 font-medium text-sm" { "Replace image" }
+ summary class="cursor-pointer rounded-lg px-3 py-2 font-medium text-sm" {
+ "Replace image" span class="sr-only" { ", " (badge.label()) }
+ }
form method="post" enctype="multipart/form-data"
- action={(base) "/badges/built-in/" (badge.kind) "?_csrf=" (csrf_token)}
+ action={(base) "/badges/built-in/" (badge.kind) (state.current_query()) "&_csrf=" (csrf_token)}
class="flex flex-col gap-3 border-neutral-200 border-t p-3" {
(image_field(&prefix, true))
div { (submit_button("Replace image")) }
}
}
@if badge.asset_url.is_some() {
- form method="post" action={(base) "/badges/built-in/" (badge.kind) "/reset"} {
+ form method="post" action={(base) "/badges/built-in/" (badge.kind) "/reset" (state.current_query())} {
(csrf_input(csrf_token))
- button type="submit" class=(BADGE_ACTION_BUTTON_CLASS) { "Use the built-in image" }
+ button type="submit" class=(BADGE_ACTION_BUTTON_CLASS) {
+ "Use the built-in image" span class="sr-only" { ", " (badge.label()) }
+ }
}
}
}
@@ -213,23 +412,21 @@ fn built_in_row(
struct BadgePosition {
first: bool,
last: bool,
+ reorder: bool,
}
fn move_form(
config: &AdminConfig,
badge: &AdminCustomBadge,
direction: BadgeMove,
+ state: &BadgePageState,
csrf_token: &str,
) -> Markup {
- let label = match direction {
- BadgeMove::Up => "Move up",
- BadgeMove::Down => "Move down",
- };
html! {
form method="post"
- action={(config.base_path) "/badges/" (badge.id) "/move/" (direction.as_str())} {
+ action={(config.base_path) "/badges/" (badge.id) "/move/" (direction.as_str()) (state.current_query())} {
(csrf_input(csrf_token))
- (secondary_button(label))
+ (secondary_button_for(direction.label(), &badge.name))
}
}
}
@@ -237,6 +434,7 @@ fn move_form(
fn badge_row(
config: &AdminConfig,
badge: &AdminCustomBadge,
+ state: &BadgePageState,
permissions: &BadgePermissions,
csrf_token: &str,
position: BadgePosition,
@@ -245,7 +443,7 @@ fn badge_row(
html! {
div class="flex flex-col gap-4 py-4 first:pt-0 last:pb-0" {
div class="flex items-start gap-3" {
- img src=(badge.image_url()) alt=""
+ img src=(badge.image_url()) alt="" loading="lazy"
class="h-10 w-10 shrink-0 rounded object-contain";
div class="flex min-w-0 flex-col gap-1" {
span class="font-medium text-neutral-900" { (badge.name) }
@@ -263,9 +461,11 @@ fn badge_row(
div class="flex flex-wrap items-start gap-2" {
@if permissions.update {
details class="rounded-lg border border-neutral-200 open:basis-full" {
- summary class="cursor-pointer rounded-lg px-3 py-2 font-medium text-sm" { "Edit" }
+ summary class="cursor-pointer rounded-lg px-3 py-2 font-medium text-sm" {
+ "Edit" span class="sr-only" { ", " (badge.name) }
+ }
form method="post" enctype="multipart/form-data"
- action={(base) "/badges/" (badge.id) "?_csrf=" (csrf_token)}
+ action={(base) "/badges/" (badge.id) (state.current_query()) "&_csrf=" (csrf_token)}
class="flex flex-col gap-3 border-neutral-200 border-t p-3" {
(badge_fields(&badge.id, Some(badge)))
(image_field(&badge.id, false))
@@ -273,17 +473,19 @@ fn badge_row(
}
}
}
- @if permissions.update && !position.first {
- (move_form(config, badge, BadgeMove::Up, csrf_token))
+ @if permissions.update && position.reorder && !position.first {
+ (move_form(config, badge, BadgeMove::First, state, csrf_token))
+ (move_form(config, badge, BadgeMove::Up, state, csrf_token))
}
- @if permissions.update && !position.last {
- (move_form(config, badge, BadgeMove::Down, csrf_token))
+ @if permissions.update && position.reorder && !position.last {
+ (move_form(config, badge, BadgeMove::Down, state, csrf_token))
+ (move_form(config, badge, BadgeMove::Last, state, csrf_token))
}
@if permissions.delete {
- form method="post" action={(base) "/badges/" (badge.id) "/delete"}
+ form method="post" action={(base) "/badges/" (badge.id) "/delete" (state.current_query())}
onsubmit="return confirm('Delete this badge? Everyone it was given to stops showing it.')" {
(csrf_input(csrf_token))
- (danger_button("Delete badge"))
+ (danger_button_for("Delete badge", &badge.name))
}
}
}
@@ -337,12 +539,12 @@ fn image_field(prefix: &str, required: bool) -> Markup {
}
}
-fn create_form(config: &AdminConfig, csrf_token: &str) -> Markup {
+fn create_form(config: &AdminConfig, state: &BadgePageState, csrf_token: &str) -> Markup {
card_with_header(
"Create a badge",
html! {
form method="post" enctype="multipart/form-data"
- action={(config.base_path) "/badges?_csrf=" (csrf_token)}
+ action={(config.base_path) "/badges" (state.current_query()) "&_csrf=" (csrf_token)}
class="flex flex-col gap-3" {
label class="flex flex-col gap-1" for="badge-new-type" {
span class=(FORM_LABEL_CLASS) { "Given to" }
@@ -359,32 +561,110 @@ fn create_form(config: &AdminConfig, csrf_token: &str) -> Markup {
)
}
-pub fn custom_badge_list(badges: &[&AdminCustomBadge]) -> Markup {
+pub fn custom_badge_assignment(
+ config: &AdminConfig,
+ assignment: &BadgeAssignment,
+ targets: &BadgeAssignmentTargets<'_>,
+ can_edit: bool,
+ csrf_token: &str,
+) -> Markup {
+ let held = assignment.assigned.len();
+ let save_form_id = format!("badge-assign-save-{}", targets.tab);
+ let picked_ids = assignment
+ .picked
+ .iter()
+ .map(|badge| badge.id.as_str())
+ .collect::<Vec<_>>()
+ .join(",");
+ let over_limit = usize::try_from(assignment.limit).is_ok_and(|limit| held > limit);
html! {
- @if badges.is_empty() {
- p class="text-sm text-neutral-500" { "No badges given." }
- } @else {
- div class="flex flex-wrap gap-3" {
- @for badge in badges {
- span class="inline-flex items-center gap-2 text-sm text-neutral-800" {
- img src=(badge.image_url()) alt="" class="h-5 w-5 object-contain";
- (badge.name)
+ p class="mb-3 text-sm text-neutral-600" {
+ (held) " of up to " (assignment.limit) " " (targets.noun) " given. "
+ a href={(config.base_path) "/badges?type=" (targets.badge_type.as_str())} class="text-blue-600 underline" { "Open badges" }
+ }
+ @if over_limit {
+ p class="mb-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-800" {
+ "This is more than the limit of " (assignment.limit) ". Removing badges works, but new ones cannot be added until it is under the limit."
+ }
+ }
+ @if can_edit {
+ form method="get" action=(targets.search_action) class="mb-4 flex flex-wrap items-end gap-2"
+ onsubmit=(pick_script(&save_form_id)) {
+ input type="hidden" name="tab" value=(targets.tab);
+ input type="hidden" name="badge_pick" value=(picked_ids);
+ label class="flex min-w-0 flex-1 flex-col gap-1" for={"badge-assign-search-" (targets.tab)} {
+ span class=(FORM_LABEL_CLASS) { "Find badges to add" }
+ input type="search" id={"badge-assign-search-" (targets.tab)} name="badge_q"
+ value=(assignment.query.as_deref().unwrap_or("")) maxlength="64"
+ placeholder="Name or ID" class=(FORM_INPUT_CLASS);
+ }
+ (secondary_button("Search"))
+ }
+ form method="post" action=(targets.save_action) id=(save_form_id) {
+ (csrf_input(csrf_token))
+ div class="space-y-4" {
+ @if assignment.assigned.is_empty() {
+ p class="text-sm text-neutral-500" { "No badges given." }
+ } @else {
+ fieldset class="space-y-2" {
+ legend class=(FORM_LABEL_CLASS) { "Given" }
+ (badge_checkboxes(&assignment.assigned, true, false))
+ }
+ }
+ @if !assignment.picked.is_empty() {
+ fieldset class="space-y-2" {
+ legend class=(FORM_LABEL_CLASS) { "Selected to add" }
+ (badge_checkboxes(&assignment.picked, true, true))
+ }
}
+ @if !assignment.candidates.is_empty() {
+ fieldset class="space-y-2" {
+ legend class=(FORM_LABEL_CLASS) {
+ (if assignment.query.is_some() { "Matches" } else { "Add" })
+ }
+ (badge_checkboxes(&assignment.candidates, false, true))
+ @if assignment.more_candidates {
+ p class="text-neutral-500 text-xs" { "More badges match. Search to narrow the list." }
+ }
+ }
+ } @else if assignment.query.is_some() && assignment.search_incomplete {
+ p class="text-sm text-neutral-500" { "No match among the badges checked so far. More badges may match. Search for a longer part of the name or for the badge ID." }
+ } @else if assignment.query.is_some() {
+ p class="text-sm text-neutral-500" { "No other badges match the search." }
+ }
+ (form_actions(html! { (submit_button("Save badges")) }))
}
}
+ } @else {
+ (custom_badge_list(&assignment.assigned))
+ p class="mt-2 text-xs text-neutral-500" { (targets.permission_note) }
}
}
}
-pub fn custom_badge_picker(badges: &[&AdminCustomBadge], assigned: &[String]) -> Markup {
+pub struct BadgeAssignmentTargets<'a> {
+ pub badge_type: CustomBadgeType,
+ pub noun: &'a str,
+ pub tab: &'a str,
+ pub search_action: &'a str,
+ pub save_action: &'a str,
+ pub permission_note: &'a str,
+}
+
+fn pick_script(save_form_id: &str) -> String {
+ format!(
+ "var f=document.getElementById('{save_form_id}');if(f){{this.elements.badge_pick.value=Array.prototype.map.call(f.querySelectorAll('input[data-candidate]:checked'),function(i){{return i.value;}}).join(',');}}"
+ )
+}
+
+fn badge_checkboxes(badges: &[AdminCustomBadge], checked: bool, candidate: bool) -> Markup {
html! {
div class="grid grid-cols-1 gap-2 sm:grid-cols-2" {
@for badge in badges {
label class="flex items-center gap-2 text-sm text-neutral-800" {
- input type="checkbox" name="badge_ids[]" value=(badge.id)
- checked[assigned.contains(&badge.id)]
+ input type="checkbox" name="badge_ids[]" value=(badge.id) checked[checked] data-candidate[candidate]
class="h-4 w-4 rounded border-neutral-300";
- img src=(badge.image_url()) alt="" class="h-5 w-5 object-contain";
+ img src=(badge.image_url()) alt="" loading="lazy" class="h-5 w-5 object-contain";
(badge.name)
}
}
@@ -392,11 +672,19 @@ pub fn custom_badge_picker(badges: &[&AdminCustomBadge], assigned: &[String]) ->
}
}
-pub fn no_badges_defined(config: &AdminConfig, label: &str) -> Markup {
+fn custom_badge_list(badges: &[AdminCustomBadge]) -> Markup {
html! {
- p class="text-sm text-neutral-500" {
- "No " (label) " are defined yet. "
- a href={(config.base_path) "/badges"} class="text-blue-600 underline" { "Open badges" }
+ @if badges.is_empty() {
+ p class="text-sm text-neutral-500" { "No badges given." }
+ } @else {
+ div class="flex flex-wrap gap-3" {
+ @for badge in badges {
+ span class="inline-flex items-center gap-2 text-sm text-neutral-800" {
+ img src=(badge.image_url()) alt="" loading="lazy" class="h-5 w-5 object-contain";
+ (badge.name)
+ }
+ }
+ }
}
}
}
diff --git a/fluxer_admin/src/templates/pages/guild_detail_tabs/badges.rs b/fluxer_admin/src/templates/pages/guild_detail_tabs/badges.rs
index 1ac803337..3243e7685 100644
--- a/fluxer_admin/src/templates/pages/guild_detail_tabs/badges.rs
+++ b/fluxer_admin/src/templates/pages/guild_detail_tabs/badges.rs
@@ -2,14 +2,11 @@
use crate::{
acl,
- api::types::{AdminCustomBadgeList, CustomBadgeType, GuildDetailInfo},
+ api::types::{BadgeAssignment, CustomBadgeType, GuildDetailInfo},
config::AdminConfig,
templates::{
- components::{
- form::{csrf_input, form_actions, submit_button},
- page_container::card_with_header,
- },
- pages::badges::{custom_badge_list, custom_badge_picker, no_badges_defined},
+ components::page_container::card_with_header,
+ pages::badges::{BadgeAssignmentTargets, custom_badge_assignment},
},
};
use maud::{Markup, html};
@@ -17,38 +14,30 @@ use maud::{Markup, html};
pub fn badges_tab(
config: &AdminConfig,
guild: &GuildDetailInfo,
- badges: &AdminCustomBadgeList,
+ assignment: &BadgeAssignment,
csrf_token: &str,
admin_acls: &[String],
) -> Markup {
- let definitions: Vec<_> = badges.of_type(CustomBadgeType::Guild).collect();
- let assigned: Vec<_> = definitions
- .iter()
- .copied()
- .filter(|badge| guild.badge_ids.contains(&badge.id))
- .collect();
let can_edit = acl::has_permission(admin_acls, acl::GUILD_UPDATE_BADGES);
+ let search_action = format!("{}/guilds/{}", config.base_path, guild.id);
+ let save_action = format!(
+ "{}/guilds/{}?action=update_badges&tab=badges",
+ config.base_path, guild.id
+ );
html! {
div class="space-y-6" {
(card_with_header("Badges", html! {
p class="mb-4 text-sm text-neutral-500" {
"Badges show next to the guild name, after its verified, partnered or discoverable badge."
}
- @if definitions.is_empty() {
- (no_badges_defined(config, "guild badges"))
- } @else if can_edit {
- form method="post"
- action={(config.base_path) "/guilds/" (guild.id) "?action=update_badges&tab=badges"} {
- (csrf_input(csrf_token))
- div class="space-y-4" {
- (custom_badge_picker(&definitions, &guild.badge_ids))
- (form_actions(html! { (submit_button("Save badges")) }))
- }
- }
- } @else {
- (custom_badge_list(&assigned))
- p class="mt-2 text-xs text-neutral-500" { "You need the guild badges permission to change these." }
- }
+ (custom_badge_assignment(config, assignment, &BadgeAssignmentTargets {
+ badge_type: CustomBadgeType::Guild,
+ noun: "guild badges",
+ tab: "badges",
+ search_action: &search_action,
+ save_action: &save_action,
+ permission_note: "You need the guild badges permission to change these.",
+ }, can_edit, csrf_token))
}))
}
}
diff --git a/fluxer_admin/src/templates/pages/user_detail_tabs/overview.rs b/fluxer_admin/src/templates/pages/user_detail_tabs/overview.rs
index f650f019a..e05f39e2c 100644
--- a/fluxer_admin/src/templates/pages/user_detail_tabs/overview.rs
+++ b/fluxer_admin/src/templates/pages/user_detail_tabs/overview.rs
@@ -3,7 +3,7 @@
use crate::{
acl, admin_flags,
api::types::{
- AdminCustomBadgeList, AdminUser, CustomBadgeType, LimitConfigResponse,
+ AdminUser, BadgeAssignment, CustomBadgeType, LimitConfigResponse,
ListUserChangeLogResponse, account_tier_label,
},
config::AdminConfig,
@@ -13,7 +13,7 @@ use crate::{
page_container::{card_with_header, detail_row},
},
templates::pages::{
- badges::{custom_badge_list, custom_badge_picker, no_badges_defined},
+ badges::{BadgeAssignmentTargets, custom_badge_assignment},
enforcement_decision::suspension_label,
},
utils::{
@@ -28,7 +28,7 @@ use maud::{Markup, html};
pub struct OverviewSources<'a> {
pub change_log: Option<&'a ListUserChangeLogResponse>,
pub limit_config: Option<&'a LimitConfigResponse>,
- pub custom_badges: Option<&'a AdminCustomBadgeList>,
+ pub custom_badges: Option<&'a BadgeAssignment>,
}
pub fn overview_tab(
@@ -467,33 +467,30 @@ fn custom_badges_card(
user: &AdminUser,
admin_acls: &[String],
csrf_token: &str,
- badges: &AdminCustomBadgeList,
+ assignment: &BadgeAssignment,
) -> Markup {
- let definitions: Vec<_> = badges.of_type(CustomBadgeType::User).collect();
- let assigned: Vec<_> = definitions
- .iter()
- .copied()
- .filter(|badge| user.badge_ids.contains(&badge.id))
- .collect();
let can_edit = acl::has_permission(admin_acls, acl::USER_UPDATE_BADGES);
+ let search_action = format!("{}/users/{}", config.base_path, user.id);
+ let save_action = format!(
+ "{}/users/{}?action=update_badges&tab=overview",
+ config.base_path, user.id
+ );
card_with_header(
"Badges",
- html! {
- @if definitions.is_empty() {
- (no_badges_defined(config, "user badges"))
- } @else if can_edit {
- form method="post" action={(config.base_path) "/users/" (user.id) "?action=update_badges&tab=overview"} {
- (csrf_input(csrf_token))
- div class="space-y-4" {
- (custom_badge_picker(&definitions, &user.badge_ids))
- (form_actions(html! { (submit_button("Save badges")) }))
- }
- }
- } @else {
- (custom_badge_list(&assigned))
- p class="mt-2 text-xs text-neutral-500" { "You need the user badges permission to change these." }
- }
- },
+ custom_badge_assignment(
+ config,
+ assignment,
+ &BadgeAssignmentTargets {
+ badge_type: CustomBadgeType::User,
+ noun: "user badges",
+ tab: "overview",
+ search_action: &search_action,
+ save_action: &save_action,
+ permission_note: "You need the user badges permission to change these.",
+ },
+ can_edit,
+ csrf_token,
+ ),
)
}
diff --git a/fluxer_api/src/api/Tables.ts b/fluxer_api/src/api/Tables.ts
index fff948f04..13d441aa4 100644
--- a/fluxer_api/src/api/Tables.ts
+++ b/fluxer_api/src/api/Tables.ts
@@ -133,6 +133,7 @@ import {
type WebhooksBySourceChannelRow,
} from '@app/api/database/types/ChannelTypes';
import {USER_CONNECTION_STORAGE_COLUMNS, type UserConnectionStorageRow} from '@app/api/database/types/ConnectionTypes';
+import {CUSTOM_BADGE_COLUMNS, type CustomBadgeRow} from '@app/api/database/types/CustomBadgeTypes';
import {
ENFORCEMENT_DECISION_BY_SUBJECT_COLUMNS,
ENFORCEMENT_DECISION_COLUMNS,
@@ -1345,6 +1346,17 @@ export const InstanceConfiguration = defineTable<InstanceConfigurationRow, 'key'
columns: INSTANCE_CONFIGURATION_COLUMNS,
primaryKey: ['key'],
});
+export const CustomBadges = defineTable<CustomBadgeRow, 'badge_id'>({
+ name: 'custom_badges',
+ columns: CUSTOM_BADGE_COLUMNS,
+ primaryKey: ['badge_id'],
+});
+export const CustomBadgesByPosition = defineTable<CustomBadgeRow, 'type' | 'position', 'type'>({
+ name: 'custom_badges_by_position',
+ columns: CUSTOM_BADGE_COLUMNS,
+ primaryKey: ['type', 'position'],
+ partitionKey: ['type'],
+});
export const JobsById = defineTable<JobByIdRow, 'job_id'>({
name: 'jobs_by_id',
columns: JOB_BY_ID_COLUMNS,
diff --git a/fluxer_api/src/api/admin/AdminService.ts b/fluxer_api/src/api/admin/AdminService.ts
index 42fb35764..7925ab4e7 100644
--- a/fluxer_api/src/api/admin/AdminService.ts
+++ b/fluxer_api/src/api/admin/AdminService.ts
@@ -36,6 +36,7 @@ import type {InviteRepository} from '@app/api/invite/InviteRepository';
import {JobAdminService} from '@app/api/jobs/JobAdminService';
import type {JobLedgerRepository} from '@app/api/jobs/JobLedgerRepository';
import {
+ getCustomBadgeCatalog,
getEnforcementDecisionRepository,
getGuildDiscoveryRepository,
getInstanceConfigRepository,
@@ -178,7 +179,7 @@ export class AdminService {
auditService: this.auditService,
discoveryRepository: getGuildDiscoveryRepository(),
enforcement: this.enforcementService,
- instanceConfigRepository: getInstanceConfigRepository(),
+ customBadgeCatalog: getCustomBadgeCatalog(),
});
this.messageShredService = new AdminMessageShredService({
apiContext: this.apiContext,
@@ -239,6 +240,7 @@ export class AdminService {
});
this.badgeService = new AdminBadgeService({
instanceConfigRepository: getInstanceConfigRepository(),
+ catalog: getCustomBadgeCatalog(),
entityAssetService: this.entityAssetService,
assetDeletionQueue: this.assetDeletionQueue,
snowflakeService: snowflake,
diff --git a/fluxer_api/src/api/admin/controllers/BadgeAdminController.ts b/fluxer_api/src/api/admin/controllers/BadgeAdminController.ts
index a1bcd7cf5..7856a59b5 100644
--- a/fluxer_api/src/api/admin/controllers/BadgeAdminController.ts
+++ b/fluxer_api/src/api/admin/controllers/BadgeAdminController.ts
@@ -12,14 +12,18 @@ import type {HonoApp} from '@app/api/types/HonoEnv';
import {Validator} from '@app/api/Validator';
import {AdminACLs} from '@fluxer/constants/src/AdminACLs';
import {
+ AdminCustomBadgeListQuery,
AdminCustomBadgeListResponse,
AdminCustomBadgeResponse,
+ AdminCustomBadgeSettingsResponse,
BuiltInBadgeKindParam,
CreateCustomBadgeRequest,
CustomBadgeIdParam,
+ MoveCustomBadgeRequest,
ReorderCustomBadgesRequest,
ReplaceBuiltInBadgeImageRequest,
UpdateCustomBadgeRequest,
+ UpdateCustomBadgeSettingsRequest,
UpdateUserCustomBadgesRequest,
} from '@fluxer/schema/src/domains/admin/AdminBadgeSchemas';
import {UserMutationResponse} from '@fluxer/schema/src/domains/admin/AdminUserSchemas';
@@ -30,18 +34,19 @@ export function BadgeAdminController(app: HonoApp) {
'/admin/badges',
RateLimitMiddleware(AdminRateLimitConfigs.ADMIN_LOOKUP),
requireAdminACL(AdminACLs.BADGE_LIST),
+ Validator('query', AdminCustomBadgeListQuery),
OpenAPI({
operationId: 'list_admin_badges',
summary: 'List custom badges',
description:
- 'Lists the user and guild badges defined on this instance, in display order. Requires BADGE_LIST permission.',
+ 'Lists one page of the user and guild badges defined on this instance, in display order, with the badge settings and the built-in badge images. Pass next as after to get the following page. With query, it lists badges whose ID is the query or whose name holds it, and looks at up to 5,000 badges for each page. Requires BADGE_LIST permission.',
responseSchema: AdminCustomBadgeListResponse,
statusCode: 200,
security: 'adminApiKey',
tags: 'Admin',
}),
async (ctx) => {
- const response = await ctx.get('adminService').badgeService.listBadges();
+ const response = await ctx.get('adminService').badgeService.listBadges(ctx.req.valid('query'));
await recordAdminRead(ctx, {
targetType: 'badge',
targetId: 0n,
@@ -60,7 +65,7 @@ export function BadgeAdminController(app: HonoApp) {
operationId: 'create_admin_badge',
summary: 'Create custom badge',
description:
- 'Creates a user or guild badge and uploads its image to the media proxy. Each type has at most 10 badges. Creates audit log entry. Requires BADGE_CREATE permission.',
+ 'Creates a user or guild badge and uploads its image to the media proxy. The new badge is shown after every other badge of its type. Creates audit log entry. Requires BADGE_CREATE permission.',
responseSchema: AdminCustomBadgeResponse,
statusCode: 200,
security: 'adminApiKey',
@@ -86,7 +91,7 @@ export function BadgeAdminController(app: HonoApp) {
operationId: 'reorder_admin_badges',
summary: 'Reorder custom badges',
description:
- 'Sets the display order of the custom badges. The body lists every user and guild badge on this instance exactly once, in the new order. Creates audit log entry. Requires BADGE_UPDATE permission.',
+ 'Sets the display order of the custom badges. The body lists every user and guild badge on this instance exactly once, in the new order. It works on instances with up to 1,000 badges. Larger instances move badges one at a time with PATCH /admin/badges/order. The badges are written in groups. A failed request can leave part of the new order. Sending the same request again finishes it. Responds with the first page of badges. Creates audit log entry. Requires BADGE_UPDATE permission.',
responseSchema: AdminCustomBadgeListResponse,
statusCode: 200,
security: 'adminApiKey',
@@ -104,6 +109,67 @@ export function BadgeAdminController(app: HonoApp) {
return ctx.json(response);
},
);
+ app.patch(
+ '/admin/badges/settings',
+ RateLimitMiddleware(RateLimitConfigs.ADMIN_USER_MODIFY),
+ requireAdminACL(AdminACLs.BADGE_UPDATE),
+ Validator('json', UpdateCustomBadgeSettingsRequest),
+ OpenAPI({
+ operationId: 'update_admin_badge_settings',
+ summary: 'Update custom badge settings',
+ description:
+ 'Sets how many custom badges one user or one community can be given. Users can have up to 1,000 and communities up to 200. Lowering a limit keeps badges already given. A change that adds a badge to a user or community over the limit fails with MAX_BADGES. Creates audit log entry. Requires BADGE_UPDATE permission.',
+ responseSchema: AdminCustomBadgeSettingsResponse,
+ statusCode: 200,
+ security: 'adminApiKey',
+ tags: 'Admin',
+ }),
+ async (ctx) => {
+ const body = ctx.req.valid('json');
+ const settings = await ctx.get('adminService').badgeService.updateSettings(body);
+ await recordAdminWrite(ctx, {
+ targetType: 'badge',
+ targetId: 0n,
+ action: 'update_badge_settings',
+ metadata: {
+ max_per_user: String(settings.max_per_user),
+ max_per_guild: String(settings.max_per_guild),
+ },
+ });
+ return ctx.json(settings);
+ },
+ );
+ app.patch(
+ '/admin/badges/order',
+ RateLimitMiddleware(RateLimitConfigs.ADMIN_USER_MODIFY),
+ requireAdminACL(AdminACLs.BADGE_UPDATE),
+ Validator('json', MoveCustomBadgeRequest),
+ OpenAPI({
+ operationId: 'move_admin_badge',
+ summary: 'Move custom badge',
+ description:
+ 'Moves one badge within the badges of its type. Send direction to move it up or down one place or to the first or last place, or send after_id to show it right after another badge of the same type. Creates audit log entry. Requires BADGE_UPDATE permission.',
+ responseSchema: AdminCustomBadgeResponse,
+ statusCode: 200,
+ security: 'adminApiKey',
+ tags: 'Admin',
+ }),
+ async (ctx) => {
+ const body = ctx.req.valid('json');
+ const badgeId = body.badge_id;
+ const badge = await ctx.get('adminService').badgeService.moveBadge(badgeId, body);
+ await recordAdminWrite(ctx, {
+ targetType: 'badge',
+ targetId: badgeId,
+ action: 'move_badge',
+ metadata:
+ body.direction !== undefined
+ ? {direction: body.direction}
+ : {after_id: body.after_id === null || body.after_id === undefined ? 'first' : body.after_id.toString()},
+ });
+ return ctx.json(badge);
+ },
+ );
app.put(
'/admin/badges/built-in/:kind',
RateLimitMiddleware(RateLimitConfigs.ADMIN_USER_MODIFY),
@@ -222,7 +288,7 @@ export function BadgeAdminController(app: HonoApp) {
operationId: 'update_admin_user_badges',
summary: 'Update user custom badges',
description:
- 'Replaces the custom badges assigned to a user. Every ID must be a user badge, and a user can have at most 10. Creates audit log entry. Requires USER_UPDATE_BADGES permission.',
+ 'Replaces the custom badges assigned to a user. Every ID must be a user badge. A change that adds a badge fails with MAX_BADGES when the user would have more than the max_per_user badge setting allows. Creates audit log entry. Requires USER_UPDATE_BADGES permission.',
responseSchema: UserMutationResponse,
statusCode: 200,
security: 'adminApiKey',
diff --git a/fluxer_api/src/api/admin/models/UserTypes.ts b/fluxer_api/src/api/admin/models/UserTypes.ts
index 88fd351f6..a3fe66855 100644
--- a/fluxer_api/src/api/admin/models/UserTypes.ts
+++ b/fluxer_api/src/api/admin/models/UserTypes.ts
@@ -39,7 +39,7 @@ async function buildAdminProfileBadges(
Config.instance.selfHosted || user.isBot
? null
: loadOperatorPassEntitlementState(getOperatorPassRepository(), user.id),
- loadProfileBadgeEnvironment(),
+ loadProfileBadgeEnvironment(user.badgeIds),
]);
return buildOperatorProfileBadges({
user,
diff --git a/fluxer_api/src/api/admin/services/AdminBadgeService.ts b/fluxer_api/src/api/admin/services/AdminBadgeService.ts
index 11d28e588..e23a26e19 100644
--- a/fluxer_api/src/api/admin/services/AdminBadgeService.ts
+++ b/fluxer_api/src/api/admin/services/AdminBadgeService.ts
@@ -6,6 +6,13 @@ import {Config} from '@app/api/Config';
import type {EntityAssetService, PreparedAssetUpload} from '@app/api/infrastructure/EntityAssetService';
import type {IAssetDeletionQueue} from '@app/api/infrastructure/IAssetDeletionQueue';
import type {ISnowflakeService} from '@app/api/infrastructure/ISnowflakeService';
+import {
+ type CustomBadgeCatalog,
+ CustomBadgeCatalogUnpublishedError,
+ type CustomBadgeMove,
+ type CustomBadgePage,
+} from '@app/api/instance/custom_badges/CustomBadgeCatalog';
+import type {CustomBadge} from '@app/api/instance/custom_badges/CustomBadgeRepository';
import {
assetReferenceHash,
assetReferenceUrl,
@@ -15,7 +22,7 @@ import {
} from '@app/api/instance/InstanceAssetReferences';
import type {
BuiltInBadgeImages,
- CustomBadgeDefinition,
+ CustomBadgeCatalogState,
InstanceConfigRepository,
} from '@app/api/instance/InstanceConfigRepository';
import {PROFILE_BADGE_ASSETS} from '@app/api/user/profile_badges/ProfileBadgeAssets';
@@ -23,24 +30,29 @@ import type {UserRepository} from '@app/api/user/repositories/UserRepository';
import {
BUILT_IN_BADGE_KINDS,
type BuiltInBadgeKind,
+ CUSTOM_BADGE_PAGE_LIMIT_MAX,
type CustomBadgeType,
- MAX_CUSTOM_BADGES_PER_TYPE,
} from '@fluxer/constants/src/BadgeConstants';
import {MaxBadgesError} from '@fluxer/errors/src/domains/badge/MaxBadgesError';
import {UnknownBadgeError} from '@fluxer/errors/src/domains/badge/UnknownBadgeError';
import {InputValidationError} from '@fluxer/errors/src/domains/core/InputValidationError';
import type {
AdminBuiltInBadgeImageResponse,
+ AdminCustomBadgeListQuery,
AdminCustomBadgeListResponse,
AdminCustomBadgeResponse,
+ AdminCustomBadgeSettingsResponse,
CreateCustomBadgeRequest,
+ MoveCustomBadgeRequest,
UpdateCustomBadgeRequest,
+ UpdateCustomBadgeSettingsRequest,
} from '@fluxer/schema/src/domains/admin/AdminBadgeSchemas';
import type {UserMutationResponse} from '@fluxer/schema/src/domains/admin/AdminUserSchemas';
import type {ICacheService} from '@pkgs/cache/src/ICacheService';
interface AdminBadgeServiceDeps {
- instanceConfigRepository: InstanceConfigRepository;
+ instanceConfigRepository: Pick<InstanceConfigRepository, 'getBuiltInBadgeImages' | 'updateBuiltInBadgeImages'>;
+ catalog: CustomBadgeCatalog;
entityAssetService: EntityAssetService;
assetDeletionQueue: IAssetDeletionQueue;
snowflakeService: ISnowflakeService;
@@ -48,10 +60,11 @@ interface AdminBadgeServiceDeps {
cacheService: ICacheService;
}
-function mapCustomBadgeToAdminResponse(badge: CustomBadgeDefinition): AdminCustomBadgeResponse {
+function mapCustomBadgeToAdminResponse(badge: CustomBadge): AdminCustomBadgeResponse {
return {
id: badge.id,
type: badge.type,
+ position: badge.position.toString(),
name: badge.name,
description: badge.description,
asset_url: customBadgeImageUrl(badge.asset, Config.endpoints.media),
@@ -74,42 +87,78 @@ function mapBuiltInBadgeImages(images: BuiltInBadgeImages): Array<AdminBuiltInBa
});
}
-function findBadge(badges: ReadonlyArray<CustomBadgeDefinition>, badgeId: string): CustomBadgeDefinition {
- const badge = badges.find((candidate) => candidate.id === badgeId);
- if (!badge) {
- throw new UnknownBadgeError();
- }
- return badge;
-}
+const INT64_MAX = (1n << 63n) - 1n;
-function assertBelowTypeLimit(badges: ReadonlyArray<CustomBadgeDefinition>, type: CustomBadgeType): void {
- if (badges.filter((badge) => badge.type === type).length >= MAX_CUSTOM_BADGES_PER_TYPE) {
- throw new MaxBadgesError({maxBadges: MAX_CUSTOM_BADGES_PER_TYPE});
- }
+function mapSettings(state: CustomBadgeCatalogState): AdminCustomBadgeSettingsResponse {
+ return {max_per_user: state.max_per_user, max_per_guild: state.max_per_guild};
}
export async function assertCustomBadgeIdsOfType(
- instanceConfigRepository: Pick<InstanceConfigRepository, 'getCustomBadges'>,
+ catalog: Pick<CustomBadgeCatalog, 'getByIds'>,
type: CustomBadgeType,
badgeIds: ReadonlyArray<bigint>,
): Promise<void> {
- const badges = await instanceConfigRepository.getCustomBadges();
- const known = new Set(badges.filter((badge) => badge.type === type).map((badge) => badge.id));
+ const known = new Set((await catalog.getByIds(badgeIds, type)).map((badge) => badge.id));
if (badgeIds.some((badgeId) => !known.has(badgeId.toString()))) {
throw new UnknownBadgeError();
}
}
+export function assertCustomBadgeAssignmentLimit(
+ current: ReadonlySet<bigint>,
+ next: ReadonlySet<bigint>,
+ max: number,
+): void {
+ if (next.size > max && [...next].some((badgeId) => !current.has(badgeId))) {
+ throw new MaxBadgesError({maxBadges: max});
+ }
+}
+
+function toMove(request: MoveCustomBadgeRequest): CustomBadgeMove {
+ const hasDirection = request.direction !== undefined;
+ const hasAfter = request.after_id !== undefined;
+ if (hasDirection === hasAfter) {
+ throw InputValidationError.create('direction', 'Send either direction or after_id');
+ }
+ return request.direction !== undefined ? {direction: request.direction} : {afterId: request.after_id ?? null};
+}
+
export class AdminBadgeService {
constructor(private readonly deps: AdminBadgeServiceDeps) {}
- async listBadges(): Promise<AdminCustomBadgeListResponse> {
- const {instanceConfigRepository} = this.deps;
- const [badges, builtIn] = await Promise.all([
- instanceConfigRepository.getCustomBadges(),
+ async listBadges(query: AdminCustomBadgeListQuery): Promise<AdminCustomBadgeListResponse> {
+ const {catalog, instanceConfigRepository} = this.deps;
+ if (query.ids !== undefined && (query.query !== undefined || query.after !== undefined)) {
+ throw InputValidationError.create('ids', 'Send ids without query and after');
+ }
+ const [page, state, builtIn] = await Promise.all([
+ this.readListPage(query),
+ catalog.state(),
instanceConfigRepository.getBuiltInBadgeImages(),
]);
- return {badges: badges.map(mapCustomBadgeToAdminResponse), built_in: mapBuiltInBadgeImages(builtIn)};
+ return {
+ badges: page.badges.map(mapCustomBadgeToAdminResponse),
+ next: page.next,
+ version: catalog.clientVersion(state.version),
+ settings: mapSettings(state),
+ built_in: mapBuiltInBadgeImages(builtIn),
+ };
+ }
+
+ private async readListPage(query: AdminCustomBadgeListQuery): Promise<CustomBadgePage> {
+ const {catalog} = this.deps;
+ if (query.ids !== undefined) {
+ const ids = [...new Set(query.ids.split(','))].filter((id) => BigInt(id) <= INT64_MAX);
+ return {badges: await catalog.getByIds(ids, query.type), next: null};
+ }
+ if (query.query !== undefined) {
+ return catalog.search({type: query.type, query: query.query, after: query.after, limit: query.limit});
+ }
+ return (await catalog.readPage({type: query.type, after: query.after, limit: query.limit})).value;
+ }
+
+ private firstPage(): Promise<AdminCustomBadgeListResponse> {
+ return this.listBadges({limit: CUSTOM_BADGE_PAGE_LIMIT_MAX});
}
async replaceBuiltInBadgeImage(kind: BuiltInBadgeKind, image: string): Promise<AdminCustomBadgeListResponse> {
@@ -133,7 +182,7 @@ export class AdminBadgeService {
if (replaced.asset) {
await this.releaseAsset(replaced.asset);
}
- return this.listBadges();
+ return this.firstPage();
}
async resetBuiltInBadgeImage(kind: BuiltInBadgeKind): Promise<AdminCustomBadgeListResponse> {
@@ -146,82 +195,64 @@ export class AdminBadgeService {
if (removed.asset) {
await this.releaseAsset(removed.asset);
}
- return this.listBadges();
+ return this.firstPage();
}
async createBadge(data: CreateCustomBadgeRequest): Promise<AdminCustomBadgeResponse> {
- const {instanceConfigRepository, snowflakeService} = this.deps;
- assertBelowTypeLimit(await instanceConfigRepository.getCustomBadges(), data.type);
+ const {catalog, snowflakeService} = this.deps;
const badgeId = await snowflakeService.generate();
const prepared = await this.uploadImage(badgeId, data.image);
- const badge: CustomBadgeDefinition = {
- id: badgeId.toString(),
- type: data.type,
- name: data.name,
- description: data.description ?? null,
- asset: this.storedReference(prepared),
- href: data.href ?? null,
- };
- await this.writeOrRollback(prepared, (current) => {
- assertBelowTypeLimit(current, data.type);
- return [...current, badge];
- });
+ const badge = await this.orRollback(prepared, () =>
+ catalog.create({
+ id: badgeId,
+ type: data.type,
+ name: data.name,
+ description: data.description ?? null,
+ asset: this.storedReference(prepared),
+ href: data.href ?? null,
+ }),
+ );
return mapCustomBadgeToAdminResponse(badge);
}
async updateBadge(badgeId: bigint, data: UpdateCustomBadgeRequest): Promise<AdminCustomBadgeResponse> {
- const id = badgeId.toString();
- const existing = findBadge(await this.deps.instanceConfigRepository.getCustomBadges(), id);
+ const {catalog} = this.deps;
+ const existing = await catalog.getById(badgeId);
+ if (!existing) throw new UnknownBadgeError();
const prepared =
data.image === undefined ? null : await this.uploadImage(badgeId, data.image, assetReferenceHash(existing.asset));
- const replaced: {badge?: CustomBadgeDefinition} = {};
- const badges = await this.writeOrRollback(prepared, (current) => {
- const previous = findBadge(current, id);
- replaced.badge = previous;
- const next: CustomBadgeDefinition = {
- ...previous,
- name: data.name,
- description: data.description,
- href: data.href,
- asset: prepared ? this.storedReference(prepared) : previous.asset,
- };
- return current.map((badge) => (badge.id === id ? next : badge));
- });
- const updated = findBadge(badges, id);
- if (replaced.badge && replaced.badge.asset !== updated.asset) {
- await this.releaseAsset(replaced.badge.asset);
- }
- return mapCustomBadgeToAdminResponse(updated);
+ const {after} = await this.orRollback(prepared, () =>
+ catalog.update(
+ badgeId,
+ {
+ name: data.name,
+ description: data.description,
+ href: data.href,
+ ...(prepared ? {asset: this.storedReference(prepared)} : {}),
+ },
+ async ({before, after}) => {
+ if (before.asset !== after.asset) await this.releaseAsset(before.asset);
+ },
+ ),
+ );
+ return mapCustomBadgeToAdminResponse(after);
}
async deleteBadge(badgeId: bigint): Promise<void> {
- const id = badgeId.toString();
- const removed: {badge?: CustomBadgeDefinition} = {};
- await this.deps.instanceConfigRepository.updateCustomBadges((current) => {
- removed.badge = findBadge(current, id);
- return current.filter((badge) => badge.id !== id);
- });
- if (removed.badge) {
- await this.releaseAsset(removed.badge.asset);
- }
+ await this.deps.catalog.delete(badgeId, (removed) => this.releaseAsset(removed.asset));
+ }
+
+ async moveBadge(badgeId: bigint, request: MoveCustomBadgeRequest): Promise<AdminCustomBadgeResponse> {
+ return mapCustomBadgeToAdminResponse(await this.deps.catalog.move(badgeId, toMove(request)));
}
async reorderBadges(badgeIds: ReadonlyArray<bigint>): Promise<AdminCustomBadgeListResponse> {
- const order = badgeIds.map(String);
- const badges = await this.deps.instanceConfigRepository.updateCustomBadges((current) => {
- const reordered = order.map((id) => findBadge(current, id));
- if (new Set(order).size !== order.length) {
- throw InputValidationError.create('badge_ids', 'Each badge can only be listed once');
- }
- if (reordered.length !== current.length) {
- throw InputValidationError.create('badge_ids', 'List every badge on this instance');
- }
- return reordered;
- });
- return {
- badges: badges.map(mapCustomBadgeToAdminResponse),
- built_in: mapBuiltInBadgeImages(await this.deps.instanceConfigRepository.getBuiltInBadgeImages()),
- };
+ await this.deps.catalog.reorderAll(badgeIds);
+ return this.firstPage();
+ }
+
+ async updateSettings(patch: UpdateCustomBadgeSettingsRequest): Promise<AdminCustomBadgeSettingsResponse> {
+ return mapSettings(await this.deps.catalog.updateSettings(patch));
}
async updateUserBadges(params: {
@@ -229,10 +260,11 @@ export class AdminBadgeService {
badgeIds: ReadonlyArray<bigint>;
acls: ReadonlySet<string>;
}): Promise<UserMutationResponse> {
- const {userRepository, cacheService, instanceConfigRepository} = this.deps;
+ const {userRepository, cacheService, catalog} = this.deps;
const user = await userRepository.findUniqueAssert(params.userId);
- await assertCustomBadgeIdsOfType(instanceConfigRepository, 'user', params.badgeIds);
+ await assertCustomBadgeIdsOfType(catalog, 'user', params.badgeIds);
const badgeIds = new Set(params.badgeIds);
+ assertCustomBadgeAssignmentLimit(user.badgeIds, badgeIds, (await catalog.state()).max_per_user);
const updatedUser = await userRepository.patchUpsert(
params.userId,
{badge_ids: badgeIds.size > 0 ? badgeIds : null},
@@ -263,14 +295,13 @@ export class AdminBadgeService {
return customBadgeAssetReferenceFromOwnUrl(prepared.newCdnUrl, Config.endpoints.media);
}
- private async writeOrRollback(
- prepared: PreparedAssetUpload | null,
- update: (current: ReadonlyArray<CustomBadgeDefinition>) => Array<CustomBadgeDefinition>,
- ): Promise<ReadonlyArray<CustomBadgeDefinition>> {
+ private async orRollback<T>(prepared: PreparedAssetUpload | null, write: () => Promise<T>): Promise<T> {
try {
- return await this.deps.instanceConfigRepository.updateCustomBadges(update);
+ return await write();
} catch (error) {
- if (prepared) await this.deps.entityAssetService.rollbackAssetUpload(prepared);
+ if (prepared && !(error instanceof CustomBadgeCatalogUnpublishedError)) {
+ await this.deps.entityAssetService.rollbackAssetUpload(prepared);
+ }
throw error;
}
}
diff --git a/fluxer_api/src/api/admin/services/AdminGuildService.ts b/fluxer_api/src/api/admin/services/AdminGuildService.ts
index 47e043ad2..b4fa90ddc 100644
--- a/fluxer_api/src/api/admin/services/AdminGuildService.ts
+++ b/fluxer_api/src/api/admin/services/AdminGuildService.ts
@@ -15,7 +15,7 @@ import type {GuildRepository} from '@app/api/guild/repositories/GuildRepository'
import type {GuildService} from '@app/api/guild/services/GuildService';
import type {EntityAssetService} from '@app/api/infrastructure/EntityAssetService';
import type {IGatewayService} from '@app/api/infrastructure/IGatewayService';
-import type {InstanceConfigRepository} from '@app/api/instance/InstanceConfigRepository';
+import type {CustomBadgeCatalog} from '@app/api/instance/custom_badges/CustomBadgeCatalog';
import type {InviteRepository} from '@app/api/invite/InviteRepository';
import {createRequestCache} from '@app/api/middleware/RequestCacheMiddleware';
import type {UserRepository} from '@app/api/user/repositories/UserRepository';
@@ -32,7 +32,7 @@ interface AdminGuildServiceDeps {
auditService: AdminAuditService;
discoveryRepository: GuildDiscoveryRepository;
enforcement: EnforcementDecisionService;
- instanceConfigRepository: Pick<InstanceConfigRepository, 'getCustomBadges'>;
+ customBadgeCatalog: Pick<CustomBadgeCatalog, 'getByIds' | 'state'>;
}
export class AdminGuildService {
@@ -63,7 +63,7 @@ export class AdminGuildService {
auditService: deps.auditService,
updatePropagator: this.updatePropagator,
guildService: deps.guildService,
- instanceConfigRepository: deps.instanceConfigRepository,
+ customBadgeCatalog: deps.customBadgeCatalog,
});
this.vanityService = new AdminGuildVanityService({
guildRepository: deps.guildRepository,
diff --git a/fluxer_api/src/api/admin/services/guild/AdminGuildUpdateService.ts b/fluxer_api/src/api/admin/services/guild/AdminGuildUpdateService.ts
index ab87293cc..1a16e62b7 100644
--- a/fluxer_api/src/api/admin/services/guild/AdminGuildUpdateService.ts
+++ b/fluxer_api/src/api/admin/services/guild/AdminGuildUpdateService.ts
@@ -2,7 +2,7 @@
import {mapGuildToAdminResponse} from '@app/api/admin/models/GuildTypes';
import type {AdminAuditService} from '@app/api/admin/services/AdminAuditService';
-import {assertCustomBadgeIdsOfType} from '@app/api/admin/services/AdminBadgeService';
+import {assertCustomBadgeAssignmentLimit, assertCustomBadgeIdsOfType} from '@app/api/admin/services/AdminBadgeService';
import type {AdminGuildUpdatePropagator} from '@app/api/admin/services/guild/AdminGuildUpdatePropagator';
import {createGuildID, createRoleID, createUserID, type GuildID, type UserID} from '@app/api/BrandedTypes';
import {Config} from '@app/api/Config';
@@ -15,7 +15,7 @@ import type {GuildService} from '@app/api/guild/services/GuildService';
import {onGuildVisitSettingsChanged} from '@app/api/guild/visits/GuildVisitLifecycle';
import {emitGuildFeaturesChanged} from '@app/api/infrastructure/activity/GuildEvents';
import type {EntityAssetService, PreparedAssetUpload} from '@app/api/infrastructure/EntityAssetService';
-import type {InstanceConfigRepository} from '@app/api/instance/InstanceConfigRepository';
+import type {CustomBadgeCatalog} from '@app/api/instance/custom_badges/CustomBadgeCatalog';
import {Logger} from '@app/api/Logger';
import {DiscoveryApplicationStatus} from '@fluxer/constants/src/DiscoveryConstants';
import {GuildFeatures} from '@fluxer/constants/src/GuildConstants';
@@ -35,7 +35,7 @@ interface AdminGuildUpdateServiceDeps {
auditService: AdminAuditService;
updatePropagator: AdminGuildUpdatePropagator;
guildService: Pick<GuildService, 'withUpdateLock'>;
- instanceConfigRepository: Pick<InstanceConfigRepository, 'getCustomBadges'>;
+ customBadgeCatalog: Pick<CustomBadgeCatalog, 'getByIds' | 'state'>;
}
export class AdminGuildUpdateService {
@@ -125,14 +125,16 @@ export class AdminGuildUpdateService {
adminUserId: UserID;
auditLogReason: string | null;
}) {
- const {guildRepository, auditService, updatePropagator, guildService, instanceConfigRepository} = this.deps;
- await assertCustomBadgeIdsOfType(instanceConfigRepository, 'guild', badgeIds);
+ const {guildRepository, auditService, updatePropagator, guildService, customBadgeCatalog} = this.deps;
+ await assertCustomBadgeIdsOfType(customBadgeCatalog, 'guild', badgeIds);
const assigned = new Set(badgeIds);
+ const {max_per_guild: maxPerGuild} = await customBadgeCatalog.state();
const updatedGuild = await guildService.withUpdateLock(guildId, async () => {
const guild = await guildRepository.findUnique(guildId);
if (!guild) {
throw new UnknownGuildError();
}
+ assertCustomBadgeAssignmentLimit(guild.badgeIds, assigned, maxPerGuild);
return guildRepository.upsertPartial(guildId, {badge_ids: assigned.size > 0 ? assigned : null}, guild.toRow());
});
await updatePropagator.dispatchGuildUpdate(guildId, updatedGuild);
diff --git a/fluxer_api/src/api/admin/tests/AdminCustomBadges.test.ts b/fluxer_api/src/api/admin/tests/AdminCustomBadges.test.ts
index 23e74a22a..c6145db08 100644
--- a/fluxer_api/src/api/admin/tests/AdminCustomBadges.test.ts
+++ b/fluxer_api/src/api/admin/tests/AdminCustomBadges.test.ts
@@ -4,7 +4,7 @@ import {createTestCustomBadge} from '@app/api/admin/tests/AdminTestUtils';
import {createTestAccount, setUserACLs, type TestAccount} from '@app/api/auth/tests/AuthTestUtils';
import {getPngDataUrl} from '@app/api/emoji/tests/EmojiTestUtils';
import {createGuild} from '@app/api/message/tests/MessageTestUtils';
-import {getInstanceConfigRepository} from '@app/api/middleware/ServiceSingletons';
+import {getCustomBadgeCatalog} from '@app/api/middleware/ServiceSingletons';
import {type ApiTestHarness, createApiTestHarness} from '@app/api/test/ApiTestHarness';
import {HTTP_STATUS} from '@app/api/test/TestConstants';
import {createBuilder} from '@app/api/test/TestRequestBuilder';
@@ -46,7 +46,7 @@ describe('custom badges', () => {
test('stores an uploaded image reference and serves it as a profile badge until deleted', async () => {
const badge = await createTestCustomBadge(harness, admin.token, 'user', 'Translator');
- const [stored] = await getInstanceConfigRepository().getCustomBadges();
+ const stored = await getCustomBadgeCatalog().getById(badge.id);
expect(stored?.asset).toMatch(new RegExp(`^custom-badges/${badge.id}/[0-9a-f]{8}\\.png$`));
expect(badge.asset_url).toMatch(new RegExp(`/custom-badges/${badge.id}/[0-9a-f]{8}\\.webp$`));
@@ -91,26 +91,6 @@ describe('custom badges', () => {
.execute();
});
- test('allows 100 badges of a type and refuses the next one', async () => {
- const template = await createTestCustomBadge(harness, admin.token, 'user');
- const [stored] = await getInstanceConfigRepository().getCustomBadges();
- await getInstanceConfigRepository().updateCustomBadges((current) => [
- ...current,
- ...Array.from({length: 98}, (_, index) => ({
- ...stored!,
- id: (BigInt(template.id) + BigInt(index + 1)).toString(),
- name: `Badge ${index}`,
- })),
- ]);
- await createTestCustomBadge(harness, admin.token, 'user', 'Last one');
- await createTestCustomBadge(harness, admin.token, 'guild', 'Other type');
- await createBuilder(harness, admin.token)
- .post('/admin/badges')
- .body({type: 'user', name: 'One too many', image: getPngDataUrl()})
- .expect(HTTP_STATUS.BAD_REQUEST, 'MAX_BADGES')
- .execute();
- });
-
test('needs the matching ACL on every route', async () => {
const badge = await createTestCustomBadge(harness, admin.token);
const target = await createTestAccount(harness);
diff --git a/fluxer_api/src/api/admin/tests/audit_coverage/BadgeAdminAuditCases.ts b/fluxer_api/src/api/admin/tests/audit_coverage/BadgeAdminAuditCases.ts
index 8eca85c49..f07ab20f9 100644
--- a/fluxer_api/src/api/admin/tests/audit_coverage/BadgeAdminAuditCases.ts
+++ b/fluxer_api/src/api/admin/tests/audit_coverage/BadgeAdminAuditCases.ts
@@ -55,6 +55,38 @@ export const BadgeAdminAuditCases: ReadonlyArray<AdminAuditCoverageCase> = [
};
},
},
+ {
+ method: 'PATCH',
+ route: '/admin/badges/settings',
+ async prepare() {
+ return {
+ request: {path: '/admin/badges/settings', body: {max_per_user: 20}},
+ expected: {
+ action: 'update_badge_settings',
+ targetType: 'badge',
+ targetId: '0',
+ metadata: {max_per_user: '20', max_per_guild: '50'},
+ },
+ };
+ },
+ },
+ {
+ method: 'PATCH',
+ route: '/admin/badges/order',
+ async prepare({harness, admin}) {
+ await createTestCustomBadge(harness, admin.token, 'user');
+ const badge = await createTestCustomBadge(harness, admin.token, 'user');
+ return {
+ request: {path: '/admin/badges/order', body: {badge_id: badge.id, direction: 'up'}},
+ expected: {
+ action: 'move_badge',
+ targetType: 'badge',
+ targetId: badge.id,
+ metadata: {direction: 'up'},
+ },
+ };
+ },
+ },
{
method: 'PUT',
route: '/admin/badges/built-in/:kind',
diff --git a/fluxer_api/src/api/app/APILifecycle.ts b/fluxer_api/src/api/app/APILifecycle.ts
index 0e6931de3..0be13378b 100644
--- a/fluxer_api/src/api/app/APILifecycle.ts
+++ b/fluxer_api/src/api/app/APILifecycle.ts
@@ -32,6 +32,7 @@ import {
} from '@app/api/middleware/ServiceRegistry';
import {
getCacheService,
+ getCustomBadgeCatalog,
getInstanceConfigRepository,
getKVAccountDeletionQueue,
getReportRepository,
@@ -267,6 +268,8 @@ export function createInitializer(
await initializeRefreshCache(profileSubstringBlocklistCache, 'Profile substring blocklist cache', logger);
await initializeServiceSingletons(dependencies);
logger.info('Service singletons initialized');
+ await getCustomBadgeCatalog().initialize();
+ logger.info('Custom badge catalog initialized');
if (!config.dev.testModeEnabled) {
jsConnectionManager = new JetStreamConnectionManager({
url: config.nats.jetStreamUrl,
diff --git a/fluxer_api/src/api/database/CassandraQueryExecution.ts b/fluxer_api/src/api/database/CassandraQueryExecution.ts
index e76ee33e9..084de998f 100644
--- a/fluxer_api/src/api/database/CassandraQueryExecution.ts
+++ b/fluxer_api/src/api/database/CassandraQueryExecution.ts
@@ -103,7 +103,7 @@ export interface PagedQueryResult<T> {
}
interface CassandraReadOptions {
- consistency: 'all' | 'serial';
+ consistency: 'all' | 'serial' | 'localQuorum';
}
async function collectSelectRows<T>(queryType: string, result: cassandra.types.ResultSet): Promise<Array<T>> {
@@ -320,7 +320,11 @@ interface BatchQuery {
meta?: KvQueryMeta;
}
-async function executeBatch(queries: Array<BatchQuery>, atomic = true): Promise<void> {
+async function executeBatch(
+ queries: Array<BatchQuery>,
+ atomic = true,
+ consistency?: CassandraReadOptions['consistency'],
+): Promise<void> {
if (queries.length === 0) return;
for (const {query, params, meta} of queries) {
assertUnconditional({cql: query, params: params as CassandraParams, kvMeta: meta});
@@ -340,6 +344,7 @@ async function executeBatch(queries: Array<BatchQuery>, atomic = true): Promise<
prepare: true,
logged: atomic,
counter: false,
+ ...(consistency ? {consistency: getLoadedCassandraDriver()?.types.consistencies[consistency]} : {}),
};
const isDev = getIsDev();
const startTime = isDev ? performance.now() : 0;
@@ -373,9 +378,9 @@ export class BatchBuilder {
return this;
}
- async execute(atomic = true): Promise<void> {
+ async execute(atomic = true, consistency?: CassandraReadOptions['consistency']): Promise<void> {
if (this.queries.length === 0) return;
- await executeBatch(this.queries, atomic);
+ await executeBatch(this.queries, atomic, consistency);
}
async executeChunked(chunkSize: number, atomic = false): Promise<void> {
diff --git a/fluxer_api/src/api/database/types/CustomBadgeTypes.ts b/fluxer_api/src/api/database/types/CustomBadgeTypes.ts
new file mode 100644
index 000000000..79bc6dc16
--- /dev/null
+++ b/fluxer_api/src/api/database/types/CustomBadgeTypes.ts
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+export interface CustomBadgeRow {
+ badge_id: bigint;
+ type: string;
+ position: bigint;
+ name: string;
+ description: string | null;
+ asset: string;
+ href: string | null;
+ updated_at: Date;
+}
+
+export const CUSTOM_BADGE_COLUMNS = [
+ 'badge_id',
+ 'type',
+ 'position',
+ 'name',
+ 'description',
+ 'asset',
+ 'href',
+ 'updated_at',
+] as const satisfies ReadonlyArray<keyof CustomBadgeRow>;
diff --git a/fluxer_api/src/api/instance/InstanceConfigRepository.ts b/fluxer_api/src/api/instance/InstanceConfigRepository.ts
index 811b8740f..888a84a14 100644
--- a/fluxer_api/src/api/instance/InstanceConfigRepository.ts
+++ b/fluxer_api/src/api/instance/InstanceConfigRepository.ts
@@ -95,7 +95,15 @@ import {
} from '@fluxer/constants/src/AccountIdentityConstants';
import {resolveIdentifierFirst, resolveInstantAccountAvailability} from '@fluxer/constants/src/AccountTierRules';
import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';
-import {BUILT_IN_BADGE_KINDS, type BuiltInBadgeKind, CustomBadgeTypes} from '@fluxer/constants/src/BadgeConstants';
+import {
+ BUILT_IN_BADGE_KINDS,
+ type BuiltInBadgeKind,
+ CUSTOM_BADGES_PER_GUILD_CEILING,
+ CUSTOM_BADGES_PER_USER_CEILING,
+ CustomBadgeTypes,
+ DEFAULT_CUSTOM_BADGES_PER_GUILD,
+ DEFAULT_CUSTOM_BADGES_PER_USER,
+} from '@fluxer/constants/src/BadgeConstants';
import {resolveSmtpTlsMode, type SmtpTlsMode} from '@fluxer/constants/src/SmtpConstants';
import {ConflictError} from '@fluxer/errors/src/domains/core/ConflictError';
import {ServiceUnavailableError} from '@fluxer/errors/src/domains/core/ServiceUnavailableError';
@@ -195,6 +203,7 @@ const INSTANCE_BILLING_CONFIG_KEY = 'instance_billing_config';
const ACCOUNT_IDENTITY_CONFIG_KEY = 'account_identity_config';
const INSTANCE_NOTICE_KEY = 'instance_notice';
const CUSTOM_BADGES_CONFIG_KEY = 'custom_badges';
+const CUSTOM_BADGE_CATALOG_CONFIG_KEY = 'custom_badge_catalog';
export const INSTANCE_CONFIG_REFRESH_CHANNEL = 'instance-config-refresh';
export const REGISTRATION_PENDING_APPROVAL_TRAIT = 'registration_pending_approval';
export const REGISTRATION_REJECTED_TRAIT = 'registration_rejected';
@@ -563,7 +572,8 @@ type StoredConfigSection =
| 'SSO allowed domains'
| 'account identity'
| 'instance notice'
- | 'custom badges';
+ | 'custom badges'
+ | 'custom badge catalog';
function parseStoredConfigValue(raw: string | null, section: StoredConfigSection): unknown {
if (raw === null) return {};
@@ -928,20 +938,45 @@ const StoredBuiltInBadgeImagesSchema = z
.default({});
const StoredCustomBadgesSchema = z.object({
- badges: z.array(StoredCustomBadgeSchema).default([]),
+ badges: z.array(z.unknown()).default([]),
built_in: StoredBuiltInBadgeImagesSchema,
});
-export type CustomBadgeDefinition = z.infer<typeof StoredCustomBadgeSchema>;
+const StoredLegacyCustomBadgesSchema = StoredCustomBadgesSchema.extend({
+ badges: z.array(StoredCustomBadgeSchema).default([]),
+});
+
+const StoredCustomBadgeCatalogSchema = z.object({
+ version: z
+ .string()
+ .regex(/^[0-9]{1,20}$/)
+ .default('0'),
+ max_per_user: z.number().int().min(1).max(CUSTOM_BADGES_PER_USER_CEILING).default(DEFAULT_CUSTOM_BADGES_PER_USER),
+ max_per_guild: z.number().int().min(1).max(CUSTOM_BADGES_PER_GUILD_CEILING).default(DEFAULT_CUSTOM_BADGES_PER_GUILD),
+ migrated: z.boolean().default(false),
+});
+
+export type LegacyCustomBadge = z.infer<typeof StoredCustomBadgeSchema>;
+
+export type CustomBadgeCatalogState = Readonly<z.infer<typeof StoredCustomBadgeCatalogSchema>>;
export type BuiltInBadgeImages = Readonly<Partial<Record<BuiltInBadgeKind, string>>>;
type StoredCustomBadges = z.infer<typeof StoredCustomBadgesSchema>;
+export interface StoredCustomBadgeReferences {
+ legacyAssetKeys: ReadonlySet<string>;
+ builtInAssetKeys: ReadonlySet<string>;
+}
+
function parseStoredCustomBadges(raw: string | null): StoredCustomBadges {
return parseStoredConfigOrDefault(StoredCustomBadgesSchema, raw, 'custom badges');
}
+function parseStoredCustomBadgeCatalog(raw: string | null): CustomBadgeCatalogState {
+ return parseStoredConfigOrDefault(StoredCustomBadgeCatalogSchema, raw, 'custom badge catalog');
+}
+
function validateStoredCollection<T>(schema: z.ZodType<T>, value: unknown, section: StoredConfigSection): Array<T> {
if (!Array.isArray(value)) {
throw new Error(`Stored ${section} configuration must be an array`);
@@ -1630,6 +1665,7 @@ export class InstanceConfigRepository {
private effectiveBlueskyConfig: BlueskyOAuthConfig | null = null;
private effectiveBlueskyConfigSource: string | null = null;
private parsedCustomBadges: {raw: string | null; stored: StoredCustomBadges} | null = null;
+ private parsedCustomBadgeCatalog: {raw: string | null; stored: CustomBadgeCatalogState} | null = null;
constructor(kvClient: IKVProvider | null = null) {
this.kvClient = kvClient;
@@ -1793,6 +1829,7 @@ export class InstanceConfigRepository {
parseStoredInstancePolicyConfig(snapshot.get(INSTANCE_POLICY_CONFIG_KEY) ?? null);
parseStoredInstanceNotice(snapshot.get(INSTANCE_NOTICE_KEY) ?? null);
parseStoredCustomBadges(snapshot.get(CUSTOM_BADGES_CONFIG_KEY) ?? null);
+ parseStoredCustomBadgeCatalog(snapshot.get(CUSTOM_BADGE_CATALOG_CONFIG_KEY) ?? null);
checkStoredConfig('registration', () =>
parseStoredRegistrationConfig(snapshot.get(REGISTRATION_CONFIG_KEY) ?? null),
);
@@ -2170,48 +2207,70 @@ export class InstanceConfigRepository {
return this.parsedCustomBadges.stored;
}
- async getCustomBadges(): Promise<ReadonlyArray<CustomBadgeDefinition>> {
- return (await this.getStoredCustomBadges()).badges;
- }
-
async getBuiltInBadgeImages(): Promise<BuiltInBadgeImages> {
return (await this.getStoredCustomBadges()).built_in;
}
- private updateStoredCustomBadges(update: (current: StoredCustomBadges) => StoredCustomBadges) {
- return this.updateStoredConfig(CUSTOM_BADGES_CONFIG_KEY, (raw) =>
- validateStoredConfig(
+ async updateBuiltInBadgeImages(
+ update: (current: BuiltInBadgeImages) => BuiltInBadgeImages,
+ ): Promise<BuiltInBadgeImages> {
+ const config = await this.updateStoredConfig(CUSTOM_BADGES_CONFIG_KEY, (raw) => {
+ const current = parseStoredConfig(StoredCustomBadgesSchema, raw, 'custom badges');
+ return validateStoredConfig(
StoredCustomBadgesSchema,
- update(parseStoredConfig(StoredCustomBadgesSchema, raw, 'custom badges')),
+ {...current, built_in: {...update(current.built_in)}},
'custom badges',
- ),
- );
+ );
+ });
+ return config.built_in;
}
- async updateCustomBadges(
- update: (current: ReadonlyArray<CustomBadgeDefinition>) => Array<CustomBadgeDefinition>,
- ): Promise<ReadonlyArray<CustomBadgeDefinition>> {
- const config = await this.updateStoredCustomBadges((current) => ({...current, badges: update(current.badges)}));
- return config.badges;
+ async readLegacyCustomBadges(): Promise<ReadonlyArray<LegacyCustomBadge>> {
+ const cache = this.configCache;
+ cache.assertActive();
+ const raw = await this.fetchConfigForWrite(CUSTOM_BADGES_CONFIG_KEY);
+ cache.assertActive();
+ return parseStoredConfig(StoredLegacyCustomBadgesSchema, raw, 'custom badges').badges;
}
- async updateBuiltInBadgeImages(
- update: (current: BuiltInBadgeImages) => BuiltInBadgeImages,
- ): Promise<BuiltInBadgeImages> {
- const config = await this.updateStoredCustomBadges((current) => ({
- ...current,
- built_in: {...update(current.built_in)},
- }));
- return config.built_in;
+ async getCustomBadgeCatalogState(): Promise<CustomBadgeCatalogState> {
+ const raw = await this.getConfig(CUSTOM_BADGE_CATALOG_CONFIG_KEY);
+ if (this.parsedCustomBadgeCatalog?.raw !== raw) {
+ this.parsedCustomBadgeCatalog = {raw, stored: parseStoredCustomBadgeCatalog(raw)};
+ }
+ return this.parsedCustomBadgeCatalog.stored;
}
- async readStoredCustomBadgeAssetKeys(): Promise<Set<string>> {
+ async readCustomBadgeCatalogStateForWrite(): Promise<CustomBadgeCatalogState> {
const cache = this.configCache;
cache.assertActive();
- const raw = await this.fetchConfigFromDatabase(CUSTOM_BADGES_CONFIG_KEY);
+ const raw = await this.fetchConfigForWrite(CUSTOM_BADGE_CATALOG_CONFIG_KEY);
cache.assertActive();
- const {badges, built_in: builtIn} = parseStoredConfig(StoredCustomBadgesSchema, raw, 'custom badges');
- return new Set([...badges.map((badge) => badge.asset), ...Object.values(builtIn)].map(assetStorageKey));
+ return parseStoredConfig(StoredCustomBadgeCatalogSchema, raw, 'custom badge catalog');
+ }
+
+ updateCustomBadgeCatalogState(
+ update: (current: CustomBadgeCatalogState) => CustomBadgeCatalogState,
+ ): Promise<CustomBadgeCatalogState> {
+ return this.updateStoredConfig(CUSTOM_BADGE_CATALOG_CONFIG_KEY, (raw) =>
+ validateStoredConfig(
+ StoredCustomBadgeCatalogSchema,
+ update(parseStoredConfig(StoredCustomBadgeCatalogSchema, raw, 'custom badge catalog')),
+ 'custom badge catalog',
+ ),
+ );
+ }
+
+ async readStoredCustomBadgeReferences(): Promise<StoredCustomBadgeReferences> {
+ const cache = this.configCache;
+ cache.assertActive();
+ const legacyRaw = await this.fetchConfigFromDatabase(CUSTOM_BADGES_CONFIG_KEY);
+ cache.assertActive();
+ const {badges, built_in: builtIn} = parseStoredConfig(StoredLegacyCustomBadgesSchema, legacyRaw, 'custom badges');
+ return {
+ legacyAssetKeys: new Set(badges.map((badge) => assetStorageKey(badge.asset))),
+ builtInAssetKeys: new Set(Object.values(builtIn).map(assetStorageKey)),
+ };
}
async getCaptchaConfig(): Promise<CaptchaConfig> {
diff --git a/fluxer_api/src/api/instance/InstanceController.ts b/fluxer_api/src/api/instance/InstanceController.ts
index 96fb2afcc..0b3347512 100644
--- a/fluxer_api/src/api/instance/InstanceController.ts
+++ b/fluxer_api/src/api/instance/InstanceController.ts
@@ -1,23 +1,27 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
+import {createHash} from 'node:crypto';
import {Config} from '@app/api/Config';
import type {NatsGifProvider} from '@app/api/gif/NatsGifProvider';
import {withAccountIdentitySetupLock} from '@app/api/instance/AccountIdentitySetupLock';
+import {type CustomBadge, compareBigInts} from '@app/api/instance/custom_badges/CustomBadgeRepository';
import {
type DiscoveryValidators,
isDiscoveryNotModified,
nextDiscoveryValidators,
} from '@app/api/instance/DiscoveryValidators';
import {customBadgeImageUrl} from '@app/api/instance/InstanceAssetReferences';
-import type {BuiltInBadgeImages, CustomBadgeDefinition} from '@app/api/instance/InstanceConfigRepository';
+import type {BuiltInBadgeImages} from '@app/api/instance/InstanceConfigRepository';
import {assertSetupToken} from '@app/api/instance/SetupToken';
import {getStatusPageDetector} from '@app/api/instance/StatusPageDetector';
import {RateLimitMiddleware} from '@app/api/middleware/RateLimitMiddleware';
import {OpenAPI} from '@app/api/middleware/ResponseTypeMiddleware';
import {getVoiceTopology} from '@app/api/middleware/ServiceRegistry';
+import {getCustomBadgeCatalog} from '@app/api/middleware/ServiceSingletons';
import {RateLimitConfigs} from '@app/api/RateLimitConfig';
import {isBillingActive, isPremiumTieringActive, isStripeServiceable} from '@app/api/stripe/BillingConfigCache';
import type {HonoEnv} from '@app/api/types/HonoEnv';
+import {entityTagMatches} from '@app/api/utils/EntityTag';
import {requireConfiguredClientIp} from '@app/api/utils/RequestClientIp';
import {Validator} from '@app/api/Validator';
import {endpointOrigin} from '@app/api/voice/VoiceServerEndpoints';
@@ -45,8 +49,10 @@ import {toDomainMigrationDiscovery} from '@fluxer/schema/src/domains/admin/Domai
import {
InstanceAccountIdentityResponse,
InstanceAccountIdentityUpdateRequest,
+ type InstanceBadge,
+ InstanceBadgesQuery,
+ InstanceBadgesResponse,
type InstanceBuiltInGuildBadgeImages,
- type InstanceGuildBadge,
InstanceSetupTokenCheckRequest,
WellKnownFluxerResponse,
} from '@fluxer/schema/src/domains/instance/InstanceSchemas';
@@ -164,16 +170,27 @@ function mapBuiltInGuildBadgeImagesForDiscovery(images: BuiltInBadgeImages): Ins
};
}
-function mapGuildBadgesForDiscovery(badges: ReadonlyArray<CustomBadgeDefinition>): Array<InstanceGuildBadge> {
- return badges
- .filter((badge) => badge.type === 'guild')
- .map((badge) => ({
- id: badge.id,
- name: badge.name,
- description: badge.description,
- asset_url: customBadgeImageUrl(badge.asset, Config.endpoints.media),
- href: badge.href,
- }));
+const INT64_MAX = (1n << 63n) - 1n;
+const BADGE_CACHE_CURRENT = 'public, max-age=86400, immutable';
+const BADGE_CACHE_REVALIDATE = 'public, max-age=60, must-revalidate';
+
+function mapGuildBadge(badge: CustomBadge): InstanceBadge {
+ return {
+ id: badge.id,
+ name: badge.name,
+ description: badge.description,
+ asset_url: customBadgeImageUrl(badge.asset, Config.endpoints.media),
+ href: badge.href,
+ position: badge.position.toString(),
+ };
+}
+
+function parseBadgeIds(ids: string): Array<bigint> {
+ return [...new Set(ids.split(','))].map((id) => BigInt(id)).filter((id) => id <= INT64_MAX);
+}
+
+function badgeEntityTag(version: string, query: string): string {
+ return `"${createHash('sha256').update(`${version}\n${query}`).digest('hex').slice(0, 32)}"`;
}
export function InstanceController(app: Hono<HonoEnv>) {
@@ -209,7 +226,7 @@ export function InstanceController(app: Hono<HonoEnv>) {
accounts,
instantAccountAvailability,
notice,
- customBadges,
+ badgeHead,
builtInBadgeImages,
] = await Promise.all([
instanceConfigRepository.getRegistrationPublicConfig(),
@@ -224,7 +241,7 @@ export function InstanceController(app: Hono<HonoEnv>) {
instanceConfigRepository.getAccountsConfig(),
instanceConfigRepository.getInstantAccountAvailability(),
instanceConfigRepository.getActiveInstanceNotice(),
- instanceConfigRepository.getCustomBadges(),
+ getCustomBadgeCatalog().readDiscoveryHead(),
instanceConfigRepository.getBuiltInBadgeImages(),
]);
const statusPageInstatus = await getStatusPageDetector().isInstatus(appPublicConfig.branding.status_page_url);
@@ -273,7 +290,9 @@ export function InstanceController(app: Hono<HonoEnv>) {
...discovery,
notice,
domain_migration: toDomainMigrationDiscovery(domainMigration),
- guild_badges: mapGuildBadgesForDiscovery(customBadges),
+ guild_badges: badgeHead.value.badges.map(mapGuildBadge),
+ guild_badges_partial: badgeHead.value.partial,
+ custom_badges_version: getCustomBadgeCatalog().clientVersion(badgeHead.version),
built_in_guild_badge_images: mapBuiltInGuildBadgeImagesForDiscovery(builtInBadgeImages),
voice_origins: listVoiceOrigins(),
};
@@ -292,6 +311,58 @@ export function InstanceController(app: Hono<HonoEnv>) {
return ctx.json(response);
},
);
+ app.get(
+ '/instance/badges',
+ RateLimitMiddleware(RateLimitConfigs.INSTANCE_BADGES),
+ Validator('query', InstanceBadgesQuery),
+ OpenAPI({
+ operationId: 'list_instance_badges',
+ summary: 'List community badges',
+ description:
+ 'Lists the custom badges that communities on this instance can show, in display order. Send ids to look up the badges listed in badge_ids of a community, or page through every badge with after and limit. Send the custom_badges_version from discovery as version. While that is still the current version, the response can be cached for a day.',
+ responseSchema: InstanceBadgesResponse,
+ statusCode: 200,
+ security: [],
+ tags: ['Instance'],
+ }),
+ async (ctx) => {
+ ctx.header('Access-Control-Allow-Origin', '*');
+ const query = ctx.req.valid('query');
+ if (query.ids !== undefined && query.after !== undefined) {
+ throw InputValidationError.create('after', 'Send either ids or after');
+ }
+ const catalog = getCustomBadgeCatalog();
+ const read =
+ query.ids !== undefined
+ ? await catalog.readByIds(parseBadgeIds(query.ids)).then((result) => ({
+ ...result,
+ value: {badges: result.value.filter((badge) => badge.type === 'guild'), next: null},
+ }))
+ : await catalog.readPage({type: 'guild', after: query.after, limit: query.limit});
+ const version = catalog.clientVersion(read.version);
+ const normalizedQuery =
+ query.ids !== undefined
+ ? `ids=${parseBadgeIds(query.ids).sort(compareBigInts).join(',')}`
+ : `after=${query.after ?? ''}&limit=${query.limit}`;
+ ctx.header(
+ 'Cache-Control',
+ read.stable && query.version === version ? BADGE_CACHE_CURRENT : BADGE_CACHE_REVALIDATE,
+ );
+ if (read.stable) {
+ const etag = badgeEntityTag(version, normalizedQuery);
+ ctx.header('ETag', etag);
+ const ifNoneMatch = ctx.req.header('If-None-Match');
+ if (ifNoneMatch !== undefined && entityTagMatches(ifNoneMatch, etag)) {
+ return ctx.body(null, 304);
+ }
+ }
+ return ctx.json({
+ version,
+ badges: read.value.badges.map(mapGuildBadge),
+ next: read.value.next,
+ });
+ },
+ );
app.post(
'/instance/setup/token-checks',
RateLimitMiddleware(RateLimitConfigs.INSTANCE_SETUP_TOKEN_CHECK),
diff --git a/fluxer_api/src/api/instance/custom_badges/CustomBadgeCatalog.ts b/fluxer_api/src/api/instance/custom_badges/CustomBadgeCatalog.ts
new file mode 100644
index 000000000..c3d694c04
--- /dev/null
+++ b/fluxer_api/src/api/instance/custom_badges/CustomBadgeCatalog.ts
@@ -0,0 +1,692 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import {createHash} from 'node:crypto';
+import type {ISnowflakeService} from '@app/api/infrastructure/ISnowflakeService';
+import {
+ applyCustomBadgeChanges,
+ type CustomBadge,
+ type CustomBadgeChange,
+ compareCustomBadges,
+ findCustomBadge,
+ findCustomBadges,
+ insertCustomBadgeIfMissing,
+ listCustomBadgeRange,
+ writeCustomBadgePositionRow,
+} from '@app/api/instance/custom_badges/CustomBadgeRepository';
+import {assetStorageKey} from '@app/api/instance/InstanceAssetReferences';
+import type {CustomBadgeCatalogState, InstanceConfigRepository} from '@app/api/instance/InstanceConfigRepository';
+import {Logger} from '@app/api/Logger';
+import {
+ CUSTOM_BADGE_REORDER_IDS_MAX,
+ type CustomBadgeType,
+ DISCOVERY_GUILD_BADGE_LIMIT,
+} from '@fluxer/constants/src/BadgeConstants';
+import {UnknownBadgeError} from '@fluxer/errors/src/domains/badge/UnknownBadgeError';
+import {InputValidationError} from '@fluxer/errors/src/domains/core/InputValidationError';
+import {ResourceLockedError} from '@fluxer/errors/src/domains/core/ResourceLockedError';
+import {ServiceUnavailableError} from '@fluxer/errors/src/domains/core/ServiceUnavailableError';
+import type {ICacheService} from '@pkgs/cache/src/ICacheService';
+
+const CUSTOM_BADGE_POSITION_STEP = 1n << 32n;
+const INT64_MIN = -(1n << 63n);
+const INT64_MAX = (1n << 63n) - 1n;
+const BADGE_CACHE_MAX = 5000;
+const MISSING_CACHE_MAX = 5000;
+const CACHE_TTL_MS = 5 * 60_000;
+const LOCK_KEY = 'custom-badges:catalog-write';
+const PENDING_VERSION_KEY = 'custom-badges:pending-version';
+const LOCK_TTL_SECONDS = 15;
+const LOCK_WAIT_MS = 10_000;
+const LOCK_RETRY_MS = 50;
+const PUBLISH_ATTEMPTS = 3;
+const SEARCH_SCAN_BUDGET = 5000;
+const SEARCH_SCAN_PAGE = 1000;
+const REBALANCE_WINDOW = 16;
+const REBALANCE_WINDOW_MAX = 1024;
+const BADGE_TYPES: ReadonlyArray<CustomBadgeType> = ['user', 'guild'];
+
+type CustomBadgeMoveDirection = 'up' | 'down' | 'first' | 'last';
+
+export type CustomBadgeMove = {direction: CustomBadgeMoveDirection} | {afterId: bigint | null};
+
+export interface CustomBadgeCursor {
+ readonly type: CustomBadgeType;
+ readonly position: bigint;
+}
+
+export interface CustomBadgePage {
+ readonly badges: ReadonlyArray<CustomBadge>;
+ readonly next: string | null;
+}
+
+export interface StableRead<T> {
+ readonly value: T;
+ readonly version: string;
+ readonly stable: boolean;
+}
+
+export interface CustomBadgeDiscoveryHead {
+ readonly badges: ReadonlyArray<CustomBadge>;
+ readonly partial: boolean;
+}
+
+export interface NewCustomBadge {
+ readonly id: bigint;
+ readonly type: CustomBadgeType;
+ readonly name: string;
+ readonly description: string | null;
+ readonly asset: string;
+ readonly href: string | null;
+}
+
+export type CustomBadgeEdit = Partial<Pick<CustomBadge, 'name' | 'description' | 'href' | 'asset'>>;
+
+interface CacheGeneration {
+ readonly version: string;
+ readonly createdAt: number;
+ readonly badges: Map<string, CustomBadge>;
+ readonly missing: Map<string, true>;
+ head: Promise<CustomBadgeDiscoveryHead> | null;
+}
+
+interface CustomBadgeCatalogDeps {
+ readonly instanceConfigRepository: Pick<
+ InstanceConfigRepository,
+ | 'getCustomBadgeCatalogState'
+ | 'readCustomBadgeCatalogStateForWrite'
+ | 'updateCustomBadgeCatalogState'
+ | 'readLegacyCustomBadges'
+ >;
+ readonly cacheService: Pick<ICacheService, 'acquireLock' | 'extendLock' | 'releaseLock' | 'get' | 'set' | 'delete'>;
+ readonly snowflakeService: Pick<ISnowflakeService, 'generate'>;
+ readonly mediaEndpoint: () => string;
+ readonly now?: () => Date;
+}
+
+function encodeCustomBadgeCursor(badge: Pick<CustomBadge, 'type' | 'position'>): string {
+ return `${badge.type === 'guild' ? 'g' : 'u'}${badge.position}`;
+}
+
+function decodeCustomBadgeCursor(cursor: string): CustomBadgeCursor {
+ const match = /^([gu])(-?[0-9]{1,19})$/.exec(cursor);
+ const position = match ? BigInt(match[2]!) : null;
+ if (!match || position === null || position < INT64_MIN || position > INT64_MAX) {
+ throw InputValidationError.create('after', 'This cursor is not valid');
+ }
+ return {type: match[1] === 'g' ? 'guild' : 'user', position};
+}
+
+export class CustomBadgeCatalogUnpublishedError extends ServiceUnavailableError {
+ constructor() {
+ super({
+ message:
+ 'The badge change was saved but clients have not been told yet. The next badge change or api restart tells them',
+ });
+ }
+}
+
+function sleep(ms: number): Promise<void> {
+ return new Promise((resolve) => setTimeout(resolve, ms));
+}
+
+function touch<K, V>(map: Map<K, V>, key: K, value: V, max: number): void {
+ map.delete(key);
+ map.set(key, value);
+ while (map.size > max) {
+ const oldest = map.keys().next();
+ if (oldest.done) break;
+ map.delete(oldest.value);
+ }
+}
+
+function assertPosition(position: bigint): bigint {
+ if (position <= INT64_MIN || position >= INT64_MAX) {
+ throw InputValidationError.create('position', 'The badge order has no room left. Reorder the badges of this type');
+ }
+ return position;
+}
+
+function nextVersionAfter(current: string, candidate: bigint): string {
+ const stored = BigInt(current);
+ return (candidate > stored ? candidate : stored + 1n).toString();
+}
+
+export class CustomBadgeCatalog {
+ private generation: CacheGeneration | null = null;
+ private queue: Promise<void> = Promise.resolve();
+
+ constructor(private readonly deps: CustomBadgeCatalogDeps) {}
+
+ private now(): Date {
+ return this.deps.now?.() ?? new Date();
+ }
+
+ async state(): Promise<CustomBadgeCatalogState> {
+ return this.deps.instanceConfigRepository.getCustomBadgeCatalogState();
+ }
+
+ clientVersion(version: string): string {
+ const media = createHash('sha256').update(this.deps.mediaEndpoint()).digest('hex').slice(0, 8);
+ return `${version}.${media}`;
+ }
+
+ private cacheFor(version: string): CacheGeneration {
+ const current = this.generation;
+ if (current && current.version === version && Date.now() - current.createdAt < CACHE_TTL_MS) {
+ return current;
+ }
+ const fresh: CacheGeneration = {
+ version,
+ createdAt: Date.now(),
+ badges: new Map(),
+ missing: new Map(),
+ head: null,
+ };
+ this.generation = fresh;
+ return fresh;
+ }
+
+ private async stableRead<T>(read: (generation: CacheGeneration) => Promise<T>): Promise<StableRead<T>> {
+ const before = (await this.state()).version;
+ const generation = this.cacheFor(before);
+ const value = await read(generation);
+ const after = (await this.state()).version;
+ return {value, version: before, stable: before === after};
+ }
+
+ private async stillCurrent(generation: CacheGeneration): Promise<boolean> {
+ return (await this.state()).version === generation.version && this.generation === generation;
+ }
+
+ async readByIds(ids: Iterable<bigint | string>): Promise<StableRead<Array<CustomBadge>>> {
+ const wanted = [...new Set([...ids].map((id) => id.toString()))];
+ return this.stableRead(async (generation) => {
+ const found: Array<CustomBadge> = [];
+ const misses: Array<bigint> = [];
+ for (const id of wanted) {
+ const cached = generation.badges.get(id);
+ if (cached) {
+ touch(generation.badges, id, cached, BADGE_CACHE_MAX);
+ found.push(cached);
+ } else if (!generation.missing.has(id)) {
+ misses.push(BigInt(id));
+ }
+ }
+ if (misses.length > 0) {
+ const loaded = await findCustomBadges(misses);
+ found.push(...loaded);
+ if (await this.stillCurrent(generation)) {
+ const loadedIds = new Set(loaded.map((badge) => badge.id));
+ for (const badge of loaded) touch(generation.badges, badge.id, badge, BADGE_CACHE_MAX);
+ for (const id of misses) {
+ if (!loadedIds.has(id.toString())) touch(generation.missing, id.toString(), true, MISSING_CACHE_MAX);
+ }
+ }
+ }
+ return found.sort(compareCustomBadges);
+ });
+ }
+
+ async getByIds(ids: Iterable<bigint | string>, type?: CustomBadgeType): Promise<Array<CustomBadge>> {
+ const {value} = await this.readByIds(ids);
+ return type ? value.filter((badge) => badge.type === type) : value;
+ }
+
+ async getById(id: bigint | string): Promise<CustomBadge | null> {
+ const [badge] = await this.getByIds([id]);
+ return badge ?? null;
+ }
+
+ async readPage(params: {
+ type?: CustomBadgeType;
+ after?: string;
+ limit: number;
+ }): Promise<StableRead<CustomBadgePage>> {
+ return this.stableRead(() => this.listPage(params));
+ }
+
+ private orderedTypes(type: CustomBadgeType | undefined, cursor: CustomBadgeCursor | null): Array<CustomBadgeType> {
+ if (cursor && type && cursor.type !== type) {
+ throw InputValidationError.create('after', 'This cursor belongs to the other badge type');
+ }
+ const types = type ? [type] : [...BADGE_TYPES];
+ return cursor ? types.slice(types.indexOf(cursor.type)) : types;
+ }
+
+ private async listPage(params: {type?: CustomBadgeType; after?: string; limit: number}): Promise<CustomBadgePage> {
+ const cursor = params.after ? decodeCustomBadgeCursor(params.after) : null;
+ const badges: Array<CustomBadge> = [];
+ for (const [index, type] of this.orderedTypes(params.type, cursor).entries()) {
+ const rows = await listCustomBadgeRange({
+ type,
+ after: index === 0 ? cursor?.position : undefined,
+ limit: params.limit - badges.length + 1,
+ });
+ badges.push(...rows);
+ if (badges.length > params.limit) break;
+ }
+ const page = badges.slice(0, params.limit);
+ const last = page.at(-1);
+ return {badges: page, next: badges.length > params.limit && last ? encodeCustomBadgeCursor(last) : null};
+ }
+
+ async readDiscoveryHead(): Promise<StableRead<CustomBadgeDiscoveryHead>> {
+ return this.stableRead(async (generation) => {
+ if (generation.head) return generation.head;
+ const head = listCustomBadgeRange({type: 'guild', limit: DISCOVERY_GUILD_BADGE_LIMIT + 1}).then((rows) => ({
+ badges: rows.slice(0, DISCOVERY_GUILD_BADGE_LIMIT),
+ partial: rows.length > DISCOVERY_GUILD_BADGE_LIMIT,
+ }));
+ const result = await head;
+ if (await this.stillCurrent(generation)) generation.head = head;
+ return result;
+ });
+ }
+
+ async search(params: {
+ type?: CustomBadgeType;
+ query: string;
+ after?: string;
+ limit: number;
+ }): Promise<CustomBadgePage> {
+ const cursor = params.after ? decodeCustomBadgeCursor(params.after) : null;
+ const needle = params.query.toLowerCase();
+ const matches: Array<CustomBadge> = [];
+ const seen = new Set<string>();
+ if (!cursor && /^[0-9]{1,20}$/.test(params.query) && BigInt(params.query) <= INT64_MAX) {
+ for (const badge of await this.getByIds([params.query], params.type)) {
+ matches.push(badge);
+ seen.add(badge.id);
+ }
+ }
+ let scanned = 0;
+ let lastScanned: CustomBadge | null = null;
+ for (const [index, type] of this.orderedTypes(params.type, cursor).entries()) {
+ let after = index === 0 ? cursor?.position : undefined;
+ for (;;) {
+ const budget = Math.min(SEARCH_SCAN_PAGE, SEARCH_SCAN_BUDGET - scanned);
+ if (budget <= 0) return {badges: matches, next: lastScanned ? encodeCustomBadgeCursor(lastScanned) : null};
+ const rows = await listCustomBadgeRange({type, after, limit: budget});
+ for (const row of rows) {
+ scanned += 1;
+ lastScanned = row;
+ if (!seen.has(row.id) && row.name.toLowerCase().includes(needle)) {
+ matches.push(row);
+ seen.add(row.id);
+ if (matches.length >= params.limit) {
+ return {badges: matches, next: encodeCustomBadgeCursor(row)};
+ }
+ }
+ }
+ if (rows.length < budget) break;
+ after = rows.at(-1)!.position;
+ }
+ }
+ return {badges: matches, next: null};
+ }
+
+ async create(input: NewCustomBadge): Promise<CustomBadge> {
+ return this.write(async (commit) => {
+ const [last] = await listCustomBadgeRange({type: input.type, descending: true, limit: 1, serial: true});
+ const badge: CustomBadge = {
+ id: input.id.toString(),
+ type: input.type,
+ position: assertPosition(last ? last.position + CUSTOM_BADGE_POSITION_STEP : CUSTOM_BADGE_POSITION_STEP),
+ name: input.name,
+ description: input.description,
+ asset: input.asset,
+ href: input.href,
+ updatedAt: this.now(),
+ };
+ await commit([{before: null, after: badge}]);
+ return badge;
+ });
+ }
+
+ async update(
+ badgeId: bigint,
+ edit: CustomBadgeEdit,
+ settle?: (change: {before: CustomBadge; after: CustomBadge}) => Promise<void>,
+ ): Promise<{before: CustomBadge; after: CustomBadge}> {
+ return this.write(async (commit) => {
+ const before = await this.requireBadge(badgeId);
+ const after: CustomBadge = {...before, ...edit, updatedAt: this.now()};
+ await commit([{before, after}]);
+ return {before, after};
+ }, settle);
+ }
+
+ async delete(badgeId: bigint, settle?: (removed: CustomBadge) => Promise<void>): Promise<CustomBadge> {
+ return this.write(async (commit) => {
+ const before = await this.requireBadge(badgeId);
+ await commit([{before, after: null}]);
+ return before;
+ }, settle);
+ }
+
+ async move(badgeId: bigint, move: CustomBadgeMove): Promise<CustomBadge> {
+ return this.write(async (commit) => {
+ const current = await this.requireBadge(badgeId);
+ const changes = await this.planMove(current, move);
+ if (changes.length > 0) await commit(changes);
+ return changes.find((change) => change.after?.id === current.id)?.after ?? current;
+ });
+ }
+
+ async reorderAll(order: ReadonlyArray<bigint>): Promise<void> {
+ const ids = order.map(String);
+ if (new Set(ids).size !== ids.length) {
+ throw InputValidationError.create('badge_ids', 'Each badge can only be listed once');
+ }
+ await this.write(async (commit) => {
+ const slots = new Map<CustomBadgeType, Array<CustomBadge>>();
+ let total = 0;
+ for (const type of BADGE_TYPES) {
+ const rows = await listCustomBadgeRange({type, limit: CUSTOM_BADGE_REORDER_IDS_MAX + 1, serial: true});
+ slots.set(type, rows);
+ total += rows.length;
+ }
+ if (total > CUSTOM_BADGE_REORDER_IDS_MAX) {
+ throw InputValidationError.create(
+ 'badge_ids',
+ `This instance has more than ${CUSTOM_BADGE_REORDER_IDS_MAX} badges. Move badges one at a time with PATCH /admin/badges/order`,
+ );
+ }
+ const stored = new Map((await findCustomBadges(order)).map((badge) => [badge.id, badge]));
+ if (ids.some((id) => !stored.has(id))) throw new UnknownBadgeError();
+ const listed = [...slots.values()].flat();
+ if (ids.length !== total || listed.some((row) => !stored.has(row.id))) {
+ throw InputValidationError.create('badge_ids', 'List every badge on this instance');
+ }
+ const now = this.now();
+ const changes: Array<CustomBadgeChange> = [];
+ for (const type of BADGE_TYPES) {
+ const rows = slots.get(type)!;
+ const ordered = ids.map((id) => stored.get(id)!).filter((badge) => badge.type === type);
+ if (ordered.length !== rows.length) {
+ throw InputValidationError.create('badge_ids', 'List every badge on this instance');
+ }
+ for (const [index, badge] of ordered.entries()) {
+ const slot = rows[index]!;
+ if (slot.id !== badge.id || slot.position !== badge.position) {
+ changes.push({before: null, after: {...badge, position: slot.position, updatedAt: now}});
+ }
+ }
+ }
+ if (changes.length > 0) await commit(changes);
+ });
+ }
+
+ async updateSettings(patch: {max_per_user?: number; max_per_guild?: number}): Promise<CustomBadgeCatalogState> {
+ return this.deps.instanceConfigRepository.updateCustomBadgeCatalogState((current) => ({...current, ...patch}));
+ }
+
+ async initialize(): Promise<void> {
+ await this.migrate();
+ const pending = await this.deps.cacheService.get<string>(PENDING_VERSION_KEY);
+ if (pending !== null) {
+ await this.withLock(() => this.publishPending());
+ }
+ }
+
+ async migrate(): Promise<void> {
+ const {instanceConfigRepository} = this.deps;
+ if ((await instanceConfigRepository.readCustomBadgeCatalogStateForWrite()).migrated) return;
+ await this.withLock(async () => {
+ if ((await instanceConfigRepository.readCustomBadgeCatalogStateForWrite()).migrated) return;
+ const legacy = await instanceConfigRepository.readLegacyCustomBadges();
+ const existing = new Map(
+ (await findCustomBadges(legacy.map((badge) => BigInt(badge.id)))).map((badge) => [badge.id, badge]),
+ );
+ const used = new Map<CustomBadgeType, Set<bigint>>(BADGE_TYPES.map((type) => [type, new Set()]));
+ for (const badge of existing.values()) used.get(badge.type)!.add(badge.position);
+ const counters = new Map<CustomBadgeType, bigint>(BADGE_TYPES.map((type) => [type, 0n]));
+ const now = this.now();
+ for (const entry of legacy) {
+ const type: CustomBadgeType = entry.type;
+ const taken = used.get(type)!;
+ let position = (counters.get(type)! + 1n) * CUSTOM_BADGE_POSITION_STEP;
+ counters.set(type, counters.get(type)! + 1n);
+ const stored = existing.get(entry.id);
+ if (stored) {
+ await writeCustomBadgePositionRow(stored);
+ continue;
+ }
+ while (taken.has(position)) position += CUSTOM_BADGE_POSITION_STEP;
+ taken.add(position);
+ const badge: CustomBadge = {
+ id: entry.id,
+ type,
+ position,
+ name: entry.name,
+ description: entry.description,
+ asset: entry.asset,
+ href: entry.href,
+ updatedAt: now,
+ };
+ const kept = (await insertCustomBadgeIfMissing(badge)) ? badge : await findCustomBadge(BigInt(entry.id), true);
+ if (kept) await writeCustomBadgePositionRow(kept);
+ }
+ const version = await this.deps.snowflakeService.generate();
+ await instanceConfigRepository.updateCustomBadgeCatalogState((current) => ({
+ ...current,
+ version: nextVersionAfter(current.version, version),
+ migrated: true,
+ }));
+ Logger.info({badges: legacy.length}, 'Moved custom badges into their own tables');
+ });
+ }
+
+ private async requireBadge(badgeId: bigint): Promise<CustomBadge> {
+ const badge = await findCustomBadge(badgeId, true);
+ if (!badge) throw new UnknownBadgeError();
+ return badge;
+ }
+
+ private moved(badge: CustomBadge, position: bigint): CustomBadge {
+ return {...badge, position: assertPosition(position), updatedAt: this.now()};
+ }
+
+ private async planMove(current: CustomBadge, move: CustomBadgeMove): Promise<Array<CustomBadgeChange>> {
+ const type = current.type;
+ if ('direction' in move) {
+ switch (move.direction) {
+ case 'up':
+ case 'down': {
+ const [neighbour] = await listCustomBadgeRange(
+ move.direction === 'up'
+ ? {type, before: current.position, descending: true, limit: 1, serial: true}
+ : {type, after: current.position, limit: 1, serial: true},
+ );
+ if (!neighbour) return [];
+ return [
+ {before: current, after: this.moved(current, neighbour.position)},
+ {before: neighbour, after: this.moved(neighbour, current.position)},
+ ];
+ }
+ case 'first':
+ return this.planMoveAfter(current, null);
+ case 'last': {
+ const [last] = await listCustomBadgeRange({type, descending: true, limit: 1, serial: true});
+ if (!last || last.id === current.id) return [];
+ return [{before: current, after: this.moved(current, last.position + CUSTOM_BADGE_POSITION_STEP)}];
+ }
+ }
+ }
+ return this.planMoveAfter(current, move.afterId);
+ }
+
+ private async planMoveAfter(current: CustomBadge, afterId: bigint | null): Promise<Array<CustomBadgeChange>> {
+ const type = current.type;
+ if (afterId === null) {
+ const [first] = await listCustomBadgeRange({type, limit: 1, serial: true});
+ if (!first || first.id === current.id) return [];
+ return [{before: current, after: this.moved(current, first.position - CUSTOM_BADGE_POSITION_STEP)}];
+ }
+ if (afterId.toString() === current.id) {
+ throw InputValidationError.create('after_id', 'A badge cannot be moved after itself');
+ }
+ const anchor = await findCustomBadge(afterId, true);
+ if (!anchor || anchor.type !== type) throw new UnknownBadgeError();
+ const [following] = await listCustomBadgeRange({type, after: anchor.position, limit: 1, serial: true});
+ if (following?.id === current.id) return [];
+ if (!following) {
+ return [{before: current, after: this.moved(current, anchor.position + CUSTOM_BADGE_POSITION_STEP)}];
+ }
+ if (following.position - anchor.position > 1n) {
+ return [{before: current, after: this.moved(current, (anchor.position + following.position) / 2n)}];
+ }
+ return this.planRebalance(current, anchor);
+ }
+
+ private async planRebalance(current: CustomBadge, anchor: CustomBadge): Promise<Array<CustomBadgeChange>> {
+ const type = current.type;
+ for (let window = REBALANCE_WINDOW; window <= REBALANCE_WINDOW_MAX; window *= 2) {
+ const others = (rows: Array<CustomBadge>) => rows.filter((row) => row.id !== current.id);
+ const earlier = others(
+ await listCustomBadgeRange({
+ type,
+ before: anchor.position + 1n,
+ descending: true,
+ limit: window + 2,
+ serial: true,
+ }),
+ );
+ const later = others(await listCustomBadgeRange({type, after: anchor.position, limit: window + 2, serial: true}));
+ const lower = earlier[window]?.position ?? null;
+ const upper = later[window]?.position ?? null;
+ const members = [...earlier.slice(0, window).reverse(), current, ...later.slice(0, window)];
+ const count = BigInt(members.length);
+ let start: bigint;
+ let spacing: bigint;
+ if (lower !== null && upper !== null) {
+ spacing = (upper - lower) / (count + 1n);
+ start = lower + spacing;
+ } else if (lower !== null) {
+ spacing = CUSTOM_BADGE_POSITION_STEP;
+ start = lower + spacing;
+ } else if (upper !== null) {
+ spacing = CUSTOM_BADGE_POSITION_STEP;
+ start = upper - spacing * count;
+ } else {
+ spacing = CUSTOM_BADGE_POSITION_STEP;
+ start = members[0]!.position;
+ }
+ if (spacing < 1n) continue;
+ const changes: Array<CustomBadgeChange> = [];
+ for (const [index, member] of members.entries()) {
+ const position = start + spacing * BigInt(index);
+ if (member.id === current.id || member.position !== position) {
+ changes.push({before: member, after: this.moved(member, position)});
+ }
+ }
+ return changes;
+ }
+ throw InputValidationError.create(
+ 'after_id',
+ 'The badge order has no room left here. Reorder the badges of this type',
+ );
+ }
+
+ private async withLock<T>(fn: () => Promise<T>): Promise<T> {
+ const run = this.queue.then(() => this.withDistributedLock(fn));
+ this.queue = run.then(
+ () => undefined,
+ () => undefined,
+ );
+ return run;
+ }
+
+ private async withDistributedLock<T>(fn: () => Promise<T>): Promise<T> {
+ const {cacheService} = this.deps;
+ const deadline = Date.now() + LOCK_WAIT_MS;
+ let token = await cacheService.acquireLock(LOCK_KEY, LOCK_TTL_SECONDS);
+ while (!token) {
+ if (Date.now() > deadline) throw new ResourceLockedError();
+ await sleep(LOCK_RETRY_MS);
+ token = await cacheService.acquireLock(LOCK_KEY, LOCK_TTL_SECONDS);
+ }
+ const held = token;
+ const keepAlive = setInterval(
+ () => {
+ cacheService.extendLock(LOCK_KEY, held, LOCK_TTL_SECONDS).catch((error: unknown) => {
+ Logger.warn({error}, 'Could not extend the custom badge catalog lock');
+ });
+ },
+ (LOCK_TTL_SECONDS * 1000) / 3,
+ );
+ try {
+ return await fn();
+ } finally {
+ clearInterval(keepAlive);
+ await cacheService.releaseLock(LOCK_KEY, held).catch(() => false);
+ }
+ }
+
+ private async write<T>(
+ fn: (commit: (changes: ReadonlyArray<CustomBadgeChange>) => Promise<void>) => Promise<T>,
+ settle?: (result: T) => Promise<void>,
+ ): Promise<T> {
+ return this.withLock(async () => {
+ await this.publishPending();
+ const version = await this.deps.snowflakeService.generate();
+ let committed = false;
+ const result = await fn(async (changes) => {
+ if (!committed) {
+ await this.deps.cacheService.set(PENDING_VERSION_KEY, version.toString());
+ committed = true;
+ }
+ await applyCustomBadgeChanges(changes);
+ });
+ if (!committed) return result;
+ let unpublished: unknown = null;
+ await this.publish(version).catch((error: unknown) => {
+ unpublished = error;
+ });
+ if (settle) await settle(result);
+ if (unpublished !== null) throw unpublished;
+ return result;
+ });
+ }
+
+ private async publishPending(): Promise<void> {
+ const pending = await this.deps.cacheService.get<string>(PENDING_VERSION_KEY);
+ if (pending === null) return;
+ const state = await this.deps.instanceConfigRepository.readCustomBadgeCatalogStateForWrite();
+ if (/^[0-9]{1,20}$/.test(pending) && BigInt(pending) > BigInt(state.version)) {
+ await this.publish(BigInt(pending));
+ return;
+ }
+ await this.deps.cacheService.delete(PENDING_VERSION_KEY);
+ }
+
+ private async publish(version: bigint): Promise<void> {
+ for (let attempt = 1; attempt <= PUBLISH_ATTEMPTS; attempt++) {
+ try {
+ await this.deps.instanceConfigRepository.updateCustomBadgeCatalogState((current) => ({
+ ...current,
+ version: nextVersionAfter(current.version, version),
+ }));
+ await this.deps.cacheService.delete(PENDING_VERSION_KEY);
+ return;
+ } catch (error) {
+ Logger.warn({error, attempt}, 'Could not publish a new custom badge catalog version');
+ if (attempt < PUBLISH_ATTEMPTS) await sleep(100 * attempt);
+ }
+ }
+ throw new CustomBadgeCatalogUnpublishedError();
+ }
+}
+
+export async function isCustomBadgeAssetReferenced(
+ instanceConfigRepository: Pick<InstanceConfigRepository, 'readStoredCustomBadgeReferences'>,
+ s3Key: string,
+): Promise<boolean> {
+ const references = await instanceConfigRepository.readStoredCustomBadgeReferences();
+ if (references.builtInAssetKeys.has(s3Key)) return true;
+ if (references.legacyAssetKeys.has(s3Key)) return true;
+ const badgeId = /^custom-badges\/([0-9]{1,20})\//.exec(s3Key)?.[1];
+ if (!badgeId) return false;
+ const badge = await findCustomBadge(BigInt(badgeId));
+ return badge !== null && assetStorageKey(badge.asset) === s3Key;
+}
diff --git a/fluxer_api/src/api/instance/custom_badges/CustomBadgeRepository.ts b/fluxer_api/src/api/instance/custom_badges/CustomBadgeRepository.ts
new file mode 100644
index 000000000..e68f94d1c
--- /dev/null
+++ b/fluxer_api/src/api/instance/custom_badges/CustomBadgeRepository.ts
@@ -0,0 +1,198 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import {BatchBuilder, executeConditional, fetchMany} from '@app/api/database/CassandraQueryExecution';
+import type {PreparedQuery} from '@app/api/database/CassandraTypes';
+import type {CustomBadgeRow} from '@app/api/database/types/CustomBadgeTypes';
+import {CustomBadges, CustomBadgesByPosition} from '@app/api/Tables';
+import type {CustomBadgeType} from '@fluxer/constants/src/BadgeConstants';
+
+export interface CustomBadge {
+ readonly id: string;
+ readonly type: CustomBadgeType;
+ readonly position: bigint;
+ readonly name: string;
+ readonly description: string | null;
+ readonly asset: string;
+ readonly href: string | null;
+ readonly updatedAt: Date;
+}
+
+export interface CustomBadgeChange {
+ readonly before: CustomBadge | null;
+ readonly after: CustomBadge | null;
+}
+
+const LOOKUP_CHUNK_SIZE = 100;
+const QUORUM = {consistency: 'localQuorum'} as const;
+const SERIAL = {consistency: 'serial'} as const;
+
+const FETCH_BY_ID = CustomBadges.select({where: CustomBadges.where.eq('badge_id'), limit: 1});
+const FETCH_BY_IDS = CustomBadges.select({where: CustomBadges.where.in('badge_id', 'badge_ids')});
+
+function customBadgeFromRow(row: CustomBadgeRow): CustomBadge {
+ return {
+ id: row.badge_id.toString(),
+ type: row.type === 'guild' ? 'guild' : 'user',
+ position: row.position,
+ name: row.name,
+ description: row.description,
+ asset: row.asset,
+ href: row.href,
+ updatedAt: row.updated_at,
+ };
+}
+
+function customBadgeToRow(badge: CustomBadge): CustomBadgeRow {
+ return {
+ badge_id: BigInt(badge.id),
+ type: badge.type,
+ position: badge.position,
+ name: badge.name,
+ description: badge.description,
+ asset: badge.asset,
+ href: badge.href,
+ updated_at: badge.updatedAt,
+ };
+}
+
+export function compareCustomBadges(left: CustomBadge, right: CustomBadge): number {
+ if (left.type !== right.type) return left.type === 'user' ? -1 : 1;
+ if (left.position !== right.position) return left.position < right.position ? -1 : 1;
+ return compareBigInts(BigInt(left.id), BigInt(right.id));
+}
+
+export function compareBigInts(left: bigint, right: bigint): number {
+ if (left === right) return 0;
+ return left < right ? -1 : 1;
+}
+
+export async function findCustomBadge(badgeId: bigint, serial = false): Promise<CustomBadge | null> {
+ const [row] = await fetchMany<CustomBadgeRow>(
+ FETCH_BY_ID.bind({badge_id: badgeId}),
+ undefined,
+ serial ? SERIAL : QUORUM,
+ );
+ return row ? customBadgeFromRow(row) : null;
+}
+
+export async function findCustomBadges(badgeIds: ReadonlyArray<bigint>): Promise<Array<CustomBadge>> {
+ const unique = [...new Set(badgeIds)];
+ const chunks: Array<Array<bigint>> = [];
+ for (let index = 0; index < unique.length; index += LOOKUP_CHUNK_SIZE) {
+ chunks.push(unique.slice(index, index + LOOKUP_CHUNK_SIZE));
+ }
+ const rows = await Promise.all(
+ chunks.map((chunk) => fetchMany<CustomBadgeRow>(FETCH_BY_IDS.bind({badge_ids: chunk}), undefined, QUORUM)),
+ );
+ return rows.flat().map(customBadgeFromRow);
+}
+
+export interface CustomBadgeRangeQuery {
+ readonly type: CustomBadgeType;
+ readonly after?: bigint;
+ readonly before?: bigint;
+ readonly descending?: boolean;
+ readonly limit: number;
+ readonly serial?: boolean;
+}
+
+export async function listCustomBadgeRange(query: CustomBadgeRangeQuery): Promise<Array<CustomBadge>> {
+ const where = [CustomBadgesByPosition.where.eq('type')];
+ const params: Record<string, string | bigint> = {type: query.type};
+ if (query.after !== undefined) {
+ where.push(CustomBadgesByPosition.where.gt('position', 'after_position'));
+ params.after_position = query.after;
+ }
+ if (query.before !== undefined) {
+ where.push(CustomBadgesByPosition.where.lt('position', 'before_position'));
+ params.before_position = query.before;
+ }
+ const template = CustomBadgesByPosition.select({
+ where,
+ limit: query.limit,
+ ...(query.descending ? {orderBy: {col: 'position', direction: 'DESC'}} : {}),
+ });
+ const rows = await fetchMany<CustomBadgeRow>(template.bind(params), undefined, query.serial ? SERIAL : QUORUM);
+ return rows.map(customBadgeFromRow);
+}
+
+export async function insertCustomBadgeIfMissing(badge: CustomBadge): Promise<boolean> {
+ return executeConditional(CustomBadges.insertIfNotExists(customBadgeToRow(badge)));
+}
+
+export async function writeCustomBadgePositionRow(badge: CustomBadge): Promise<void> {
+ await new BatchBuilder()
+ .addPrepared(CustomBadgesByPosition.upsertAll(customBadgeToRow(badge)))
+ .execute(true, 'localQuorum');
+}
+
+function positionKey(badge: CustomBadge): string {
+ return `${badge.type}:${badge.position}`;
+}
+
+const BATCH_BYTES_MAX = 32 * 1024;
+const STATEMENT_OVERHEAD_BYTES = 128;
+
+function rowBytes(badge: CustomBadge): number {
+ return (
+ STATEMENT_OVERHEAD_BYTES +
+ Buffer.byteLength(badge.name) +
+ Buffer.byteLength(badge.description ?? '') +
+ Buffer.byteLength(badge.asset) +
+ Buffer.byteLength(badge.href ?? '')
+ );
+}
+
+interface CustomBadgeBatch {
+ readonly queries: ReadonlyArray<PreparedQuery>;
+ readonly bytes: number;
+}
+
+function planCustomBadgeBatches(changes: ReadonlyArray<CustomBadgeChange>): Array<CustomBadgeBatch> {
+ const written = new Set<string>();
+ for (const {after} of changes) {
+ if (!after) continue;
+ const key = positionKey(after);
+ if (written.has(key)) {
+ throw new Error(`Two custom badges would share position ${key}`);
+ }
+ written.add(key);
+ }
+ const batches: Array<CustomBadgeBatch> = [];
+ let queries: Array<PreparedQuery> = [];
+ let bytes = 0;
+ for (const {before, after} of changes) {
+ const group: Array<PreparedQuery> = [];
+ let size = 0;
+ if (before && !written.has(positionKey(before))) {
+ group.push(CustomBadgesByPosition.deleteByPk({type: before.type, position: before.position}));
+ size += STATEMENT_OVERHEAD_BYTES;
+ }
+ if (after) {
+ const row = customBadgeToRow(after);
+ group.push(CustomBadges.upsertAll(row), CustomBadgesByPosition.upsertAll(row));
+ size += 2 * rowBytes(after);
+ } else if (before) {
+ group.push(CustomBadges.deleteByPk({badge_id: BigInt(before.id)}));
+ size += STATEMENT_OVERHEAD_BYTES;
+ }
+ if (group.length === 0) continue;
+ if (queries.length > 0 && bytes + size > BATCH_BYTES_MAX) {
+ batches.push({queries, bytes});
+ queries = [];
+ bytes = 0;
+ }
+ queries.push(...group);
+ bytes += size;
+ }
+ if (queries.length > 0) batches.push({queries, bytes});
+ return batches;
+}
+
+export async function applyCustomBadgeChanges(changes: ReadonlyArray<CustomBadgeChange>): Promise<void> {
+ for (const {queries} of planCustomBadgeBatches(changes)) {
+ const batch = new BatchBuilder();
+ for (const query of queries) batch.addPrepared(query);
+ await batch.execute(true, 'localQuorum');
+ }
+}
diff --git a/fluxer_api/src/api/middleware/ServiceSingletons.ts b/fluxer_api/src/api/middleware/ServiceSingletons.ts
index 2680dce08..d5ac1a0c5 100644
--- a/fluxer_api/src/api/middleware/ServiceSingletons.ts
+++ b/fluxer_api/src/api/middleware/ServiceSingletons.ts
@@ -45,6 +45,7 @@ import {UserCacheService} from '@app/api/infrastructure/UserCacheService';
import {createUsersServiceClient} from '@app/api/infrastructure/UsersServiceClient';
import {VirusScanService} from '@app/api/infrastructure/VirusScanService';
import {type ContactEmails, resolveContactEmails, resolveLegalAddress} from '@app/api/instance/ContactEmails';
+import {CustomBadgeCatalog} from '@app/api/instance/custom_badges/CustomBadgeCatalog';
import {InstanceConfigRepository} from '@app/api/instance/InstanceConfigRepository';
import {NatsConfigPublisher} from '@app/api/instance/NatsConfigPublisher';
import {getInstanceProductName} from '@app/api/instance/ProductName';
@@ -177,6 +178,15 @@ export const getNatsConfigPublisher = singleton(
export const getVisionarySlotRepository = singleton(() => new VisionarySlotRepository());
export const getCacheService: () => ICacheService = singleton(() => new KVCacheProvider({client: getKVClient()}));
+export const getCustomBadgeCatalog = singleton(
+ () =>
+ new CustomBadgeCatalog({
+ instanceConfigRepository: getInstanceConfigRepository(),
+ cacheService: getCacheService(),
+ snowflakeService: getSnowflakeService(),
+ mediaEndpoint: () => Config.endpoints.media,
+ }),
+);
export const getRateLimitService = singleton(() => new RateLimitService(getKVClient()));
export const getEmailDnsValidationService = singleton(() => new EmailDnsValidationService());
export const getOperatorPassEntitlementService = singleton(
diff --git a/fluxer_api/src/api/openapi/openapi.json b/fluxer_api/src/api/openapi/openapi.json
index d4f5535b0..d4ab86910 100644
--- a/fluxer_api/src/api/openapi/openapi.json
+++ b/fluxer_api/src/api/openapi/openapi.json
@@ -11741,6 +11741,92 @@
]
}
},
+ "/instance/badges": {
+ "get": {
+ "operationId": "list_instance_badges",
+ "summary": "List community badges",
+ "tags": ["Instance"],
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/InstanceBadgesResponse"}}}
+ },
+ "400": {
+ "description": "Bad Request - The request was malformed or contained invalid data",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
+ },
+ "429": {
+ "description": "Too Many Requests - You are being rate limited",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ThrottledError"}}},
+ "headers": {
+ "Retry-After": {
+ "description": "Number of seconds to wait before retrying (only on 429)",
+ "schema": {"type": "integer"}
+ },
+ "X-RateLimit-Limit": {
+ "description": "The number of requests that can be made in the current window",
+ "schema": {"type": "integer"}
+ },
+ "X-RateLimit-Remaining": {
+ "description": "The number of remaining requests that can be made",
+ "schema": {"type": "integer"}
+ },
+ "X-RateLimit-Reset": {
+ "description": "Unix timestamp when the rate limit resets",
+ "schema": {"type": "integer"}
+ }
+ }
+ },
+ "500": {
+ "description": "Internal Server Error - An unexpected error occurred",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
+ }
+ },
+ "description": "Lists the custom badges that communities on this instance can show, in display order. Send ids to look up the badges listed in badge_ids of a community, or page through every badge with after and limit. Send the custom_badges_version from discovery as version. While that is still the current version, the response can be cached for a day.",
+ "parameters": [
+ {
+ "name": "ids",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "description": "Up to 100 badge IDs separated by commas. Only these badges are returned. Cannot be sent with after",
+ "type": "string",
+ "pattern": "^[0-9]{1,20}(?:,[0-9]{1,20}){0,99}$"
+ },
+ "description": "Up to 100 badge IDs separated by commas. Only these badges are returned. Cannot be sent with after"
+ },
+ {
+ "name": "after",
+ "in": "query",
+ "required": false,
+ "schema": {"$ref": "#/components/schemas/CustomBadgeCursorType"},
+ "description": "Opaque cursor from the next field of a previous page"
+ },
+ {
+ "name": "limit",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "description": "Most badges to return, from 1 to 200. Not used with ids",
+ "default": "100",
+ "type": "string"
+ },
+ "description": "Most badges to return, from 1 to 200. Not used with ids"
+ },
+ {
+ "name": "version",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "description": "The catalog version the client already holds. When it is the current version the response can be cached for a day",
+ "type": "string",
+ "maxLength": 64
+ },
+ "description": "The catalog version the client already holds. When it is the current version the response can be cached for a day"
+ }
+ ]
+ }
+ },
"/instance/setup/account-identity": {
"put": {
"operationId": "set_instance_account_identity",
@@ -30146,7 +30232,7 @@
"description": "Array of guild feature flags"
},
"badge_ids": {
- "description": "IDs of the custom badges assigned to the community. Look them up in guild_badges of the instance discovery document and skip IDs that are not there",
+ "description": "IDs of the custom badges assigned to the community. Look them up in guild_badges of the instance discovery document. When guild_badges_partial is true, look up the IDs that are not there with GET /instance/badges?ids=...&version=custom_badges_version, and skip IDs that it does not return",
"$ref": "#/components/schemas/CustomBadgeIdListResponse"
},
"verification_level": {
@@ -33687,6 +33773,54 @@
"required": ["mode", "tag_style"],
"additionalProperties": false
},
+ "CustomBadgeCursorType": {
+ "type": "string",
+ "pattern": "^[gu]-?[0-9]{1,19}$",
+ "description": "Opaque cursor from the next field of a previous page"
+ },
+ "InstanceBadgesResponse": {
+ "type": "object",
+ "properties": {
+ "version": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "Version of the badge catalog. It changes whenever a badge is created, edited, deleted or moved"
+ },
+ "badges": {
+ "maxItems": 200,
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "description": "The ID of the badge, as listed in badge_ids of a community",
+ "$ref": "#/components/schemas/SnowflakeStringType"
+ },
+ "name": {"type": "string", "description": "The name of the badge"},
+ "description": {
+ "description": "Text shown under the name when hovering over the badge, or null",
+ "type": ["string", "null"]
+ },
+ "asset_url": {
+ "type": "string",
+ "description": "URL of the badge image, served as WebP by the media proxy"
+ },
+ "href": {"description": "URL opened when the badge is clicked, or null", "type": ["string", "null"]},
+ "position": {"$ref": "#/components/schemas/CustomBadgePositionType"}
+ },
+ "required": ["id", "name", "description", "asset_url", "href", "position"],
+ "additionalProperties": false
+ },
+ "description": "Community badges in display order. IDs that are unknown or deleted are left out"
+ },
+ "next": {
+ "anyOf": [{"$ref": "#/components/schemas/CustomBadgeCursorType"}, {"type": "null"}],
+ "description": "Pass this as after to get the next page, or null on the last page and for a lookup by ids"
+ }
+ },
+ "required": ["version", "badges", "next"],
+ "additionalProperties": false
+ },
"HarvestArchiveResponse": {
"type": "string",
"format": "binary",
@@ -35787,7 +35921,7 @@
"description": "The public badge features of the source community: VERIFIED, PARTNERED and DISCOVERABLE only"
},
"badge_ids": {
- "description": "IDs of the custom badges assigned to the source community. Look them up in guild_badges of the instance discovery document",
+ "description": "IDs of the custom badges assigned to the source community. Look them up in guild_badges of the instance discovery document. When guild_badges_partial is true, look up the IDs that are not there with GET /instance/badges?ids=...&version=custom_badges_version, and skip IDs that it does not return",
"$ref": "#/components/schemas/CustomBadgeIdListResponse"
},
"approximate_member_count": {
@@ -37905,11 +38039,20 @@
"$ref": "#/components/schemas/DomainMigrationDiscoveryResponse"
},
"guild_badges": {
- "description": "Custom badges that communities on this instance can show next to their name, in display order",
+ "description": "The first 100 custom badges that communities on this instance can show next to their name, in display order. GET /instance/badges serves every badge",
"maxItems": 100,
"type": "array",
"items": {"$ref": "#/components/schemas/InstanceGuildBadgeSchema"}
},
+ "guild_badges_partial": {
+ "description": "True when the instance has more community badges than guild_badges lists",
+ "type": "boolean"
+ },
+ "custom_badges_version": {
+ "type": "string",
+ "maxLength": 64,
+ "description": "Version of the badge catalog. It changes whenever a badge is created, edited, deleted or moved"
+ },
"built_in_guild_badge_images": {
"description": "Images this instance shows in place of the built-in verified, partnered and discoverable community badges",
"$ref": "#/components/schemas/InstanceBuiltInGuildBadgeImagesSchema"
@@ -37969,7 +38112,8 @@
"type": ["string", "null"]
},
"asset_url": {"type": "string", "description": "URL of the badge image, served as WebP by the media proxy"},
- "href": {"description": "URL opened when the badge is clicked, or null", "type": ["string", "null"]}
+ "href": {"description": "URL opened when the badge is clicked, or null", "type": ["string", "null"]},
+ "position": {"$ref": "#/components/schemas/CustomBadgePositionType"}
},
"required": ["id", "name", "description", "asset_url", "href"],
"additionalProperties": false
@@ -38586,6 +38730,11 @@
"description": "Age policy for one region"
},
"InstanceAgePolicyActionSchema": {"type": "string", "enum": ["restrict", "block"]},
+ "CustomBadgePositionType": {
+ "type": "string",
+ "pattern": "^-?[0-9]{1,19}$",
+ "description": "Display position of the badge. Badges are shown in ascending order of this value"
+ },
"SnowflakeStringType": {"type": "string", "pattern": "^(0|[1-9][0-9]*)$", "format": "snowflake"},
"BotFlags": {
"type": "integer",
@@ -39454,7 +39603,7 @@
"description": "Array of guild feature flags"
},
"badge_ids": {
- "description": "IDs of the custom badges assigned to the community. Look them up in guild_badges of the instance discovery document and skip IDs that are not there",
+ "description": "IDs of the custom badges assigned to the community. Look them up in guild_badges of the instance discovery document. When guild_badges_partial is true, look up the IDs that are not there with GET /instance/badges?ids=...&version=custom_badges_version, and skip IDs that it does not return",
"$ref": "#/components/schemas/CustomBadgeIdListResponse"
},
"visits_enabled": {
@@ -39589,7 +39738,7 @@
"description": "Array of guild feature flags"
},
"badge_ids": {
- "description": "IDs of the custom badges assigned to the community. Look them up in guild_badges of the instance discovery document and skip IDs that are not there",
+ "description": "IDs of the custom badges assigned to the community. Look them up in guild_badges of the instance discovery document. When guild_badges_partial is true, look up the IDs that are not there with GET /instance/badges?ids=...&version=custom_badges_version, and skip IDs that it does not return",
"$ref": "#/components/schemas/CustomBadgeIdListResponse"
},
"visits_enabled": {
@@ -39602,7 +39751,7 @@
"additionalProperties": false
},
"CustomBadgeIdListResponse": {
- "maxItems": 10,
+ "maxItems": 1000,
"type": "array",
"items": {"$ref": "#/components/schemas/SnowflakeStringType"},
"description": "IDs of the custom badges assigned to it"
@@ -40696,7 +40845,7 @@
"description": "The public badge features of the source community: VERIFIED, PARTNERED and DISCOVERABLE only"
},
"badge_ids": {
- "description": "IDs of the custom badges assigned to the source community. Look them up in guild_badges of the instance discovery document",
+ "description": "IDs of the custom badges assigned to the source community. Look them up in guild_badges of the instance discovery document. When guild_badges_partial is true, look up the IDs that are not there with GET /instance/badges?ids=...&version=custom_badges_version, and skip IDs that it does not return",
"$ref": "#/components/schemas/CustomBadgeIdListResponse"
},
"approximate_member_count": {
@@ -44426,7 +44575,7 @@
]
},
"HiddenProfileBadgesType": {
- "maxItems": 18,
+ "maxItems": 1008,
"type": "array",
"items": {
"type": "string",
@@ -45886,7 +46035,7 @@
"This IP address cannot be added to the blocklist.",
"This network block belongs to an enforcement decision. End the decision to remove it.",
"You've reached the maximum of {limit, plural, one {# application} other {# applications}}.",
- "You've reached the maximum of {count, plural, one {# badge} other {# badges}} for this type.",
+ "The limit is {count, plural, one {# badge} other {# badges}}.",
"You've reached the maximum of {count, plural, one {# bookmark} other {# bookmarks}}.",
"This community has reached its active thread limit of {count}.",
"You've reached the maximum of {count, plural, one {# category channel} other {# category channels}}.",
diff --git a/fluxer_api/src/api/rate_limit_configs/MiscRateLimitConfig.ts b/fluxer_api/src/api/rate_limit_configs/MiscRateLimitConfig.ts
index bcdbc13d5..21c624992 100644
--- a/fluxer_api/src/api/rate_limit_configs/MiscRateLimitConfig.ts
+++ b/fluxer_api/src/api/rate_limit_configs/MiscRateLimitConfig.ts
@@ -8,6 +8,10 @@ export const MiscRateLimitConfigs = {
bucket: 'instance:info',
config: {limit: 60, windowMs: ms('1 minute')},
} as RouteRateLimitConfig,
+ INSTANCE_BADGES: {
+ bucket: 'instance:badges',
+ config: {limit: 60, windowMs: ms('1 minute')},
+ } as RouteRateLimitConfig,
VOICE_JOIN: {
bucket: 'voice:join',
config: {limit: 10, windowMs: ms('1 minute')},
diff --git a/fluxer_api/src/api/user/profile_badges/HiddenProfileBadges.ts b/fluxer_api/src/api/user/profile_badges/HiddenProfileBadges.ts
index 75f35c130..e1e68e2a8 100644
--- a/fluxer_api/src/api/user/profile_badges/HiddenProfileBadges.ts
+++ b/fluxer_api/src/api/user/profile_badges/HiddenProfileBadges.ts
@@ -1,11 +1,9 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
-import type {CustomBadgeDefinition} from '@app/api/instance/InstanceConfigRepository';
import type {User} from '@app/api/models/User';
import {heldPremiumBadgeKind} from '@app/api/user/profile_badges/PremiumBadgeMasking';
import {getBadgePremiumType} from '@app/api/user/UserHelpers';
import {
- CustomBadgeTypes,
customBadgeIdFromProfileBadgeKey,
PREMIUM_PROFILE_BADGE_KINDS,
type ProfileBadgeKey,
@@ -46,13 +44,17 @@ export function resolveHiddenProfileBadges(
return next;
}
+export function hiddenCustomBadgeIds(hidden: ReadonlySet<ProfileBadgeKey>): Array<string> {
+ return [...hidden].flatMap((key) => {
+ const id = customBadgeIdFromProfileBadgeKey(key);
+ return id === null ? [] : [id];
+ });
+}
+
export function dropUndefinedCustomBadgeKeys(
hidden: ReadonlySet<ProfileBadgeKey>,
- customBadges: ReadonlyArray<CustomBadgeDefinition>,
+ userBadgeIds: ReadonlySet<string>,
): Set<ProfileBadgeKey> {
- const userBadgeIds = new Set(
- customBadges.filter((badge) => badge.type === CustomBadgeTypes.USER).map((badge) => badge.id),
- );
return new Set(
[...hidden].filter((key) => {
const id = customBadgeIdFromProfileBadgeKey(key);
diff --git a/fluxer_api/src/api/user/profile_badges/ProfileBadgeEnvironment.ts b/fluxer_api/src/api/user/profile_badges/ProfileBadgeEnvironment.ts
index 6de793689..0e09022a6 100644
--- a/fluxer_api/src/api/user/profile_badges/ProfileBadgeEnvironment.ts
+++ b/fluxer_api/src/api/user/profile_badges/ProfileBadgeEnvironment.ts
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {Config} from '@app/api/Config';
-import {getInstanceConfigRepository} from '@app/api/middleware/ServiceSingletons';
+import {getCustomBadgeCatalog, getInstanceConfigRepository} from '@app/api/middleware/ServiceSingletons';
import {getBillingBranding} from '@app/api/stripe/BillingBranding';
import {isPremiumTieringActive} from '@app/api/stripe/BillingConfigCache';
import type {ProfileBadgeEnvironment} from '@app/api/user/profile_badges/ProfileBadgeRegistry';
import {CustomBadgeTypes} from '@fluxer/constants/src/BadgeConstants';
-export async function loadProfileBadgeEnvironment(): Promise<ProfileBadgeEnvironment> {
+export async function loadProfileBadgeEnvironment(customBadgeIds: Iterable<bigint>): Promise<ProfileBadgeEnvironment> {
const selfHosted = Config.instance.selfHosted;
const instanceConfigRepository = getInstanceConfigRepository();
const [branding, premiumInfoUrl, customBadges, builtInImages] = await Promise.all([
@@ -15,7 +15,7 @@ export async function loadProfileBadgeEnvironment(): Promise<ProfileBadgeEnviron
selfHosted
? instanceConfigRepository.getAppPublicConfig().then((config) => config.branding.premium_info_url)
: Promise.resolve(null),
- instanceConfigRepository.getCustomBadges(),
+ getCustomBadgeCatalog().getByIds(customBadgeIds, CustomBadgeTypes.USER),
instanceConfigRepository.getBuiltInBadgeImages(),
]);
return {
@@ -26,7 +26,7 @@ export async function loadProfileBadgeEnvironment(): Promise<ProfileBadgeEnviron
premiumInfoUrl,
marketingUrl: Config.endpoints.marketing,
mediaUrl: Config.endpoints.media,
- customBadges: customBadges.filter((badge) => badge.type === CustomBadgeTypes.USER),
+ customBadges,
builtInImages,
};
}
diff --git a/fluxer_api/src/api/user/profile_badges/ProfileBadgeRegistry.ts b/fluxer_api/src/api/user/profile_badges/ProfileBadgeRegistry.ts
index 7ffe70d56..ad9cbd645 100644
--- a/fluxer_api/src/api/user/profile_badges/ProfileBadgeRegistry.ts
+++ b/fluxer_api/src/api/user/profile_badges/ProfileBadgeRegistry.ts
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {getContentMessage} from '@app/api/content_i18n/ContentI18n';
-import type {BuiltInBadgeImages, CustomBadgeDefinition} from '@app/api/instance/InstanceConfigRepository';
+import type {CustomBadge} from '@app/api/instance/custom_badges/CustomBadgeRepository';
+import type {BuiltInBadgeImages} from '@app/api/instance/InstanceConfigRepository';
import {Logger} from '@app/api/Logger';
import type {VisiblePremiumBadge} from '@app/api/user/profile_badges/PremiumBadgeMasking';
import {
@@ -22,7 +23,7 @@ export interface ProfileBadgeEnvironment {
premiumInfoUrl: string | null;
marketingUrl: string;
mediaUrl: string;
- customBadges: ReadonlyArray<CustomBadgeDefinition>;
+ customBadges: ReadonlyArray<Pick<CustomBadge, 'id' | 'name' | 'description' | 'asset' | 'href'>>;
builtInImages: BuiltInBadgeImages;
}
diff --git a/fluxer_api/src/api/user/services/UserAccountProfileService.ts b/fluxer_api/src/api/user/services/UserAccountProfileService.ts
index 3cc273760..406bfde30 100644
--- a/fluxer_api/src/api/user/services/UserAccountProfileService.ts
+++ b/fluxer_api/src/api/user/services/UserAccountProfileService.ts
@@ -8,10 +8,11 @@ import type {LimitConfigService} from '@app/api/limits/LimitConfigService';
import {resolveLimitSafe} from '@app/api/limits/LimitConfigUtils';
import {createLimitMatchContext} from '@app/api/limits/LimitMatchContextBuilder';
import {profileSubstringBlocklistCache} from '@app/api/middleware/ProfileSubstringBlocklistCache';
-import {getInstanceConfigRepository} from '@app/api/middleware/ServiceSingletons';
+import {getCustomBadgeCatalog} from '@app/api/middleware/ServiceSingletons';
import type {User} from '@app/api/models/User';
import {
dropUndefinedCustomBadgeKeys,
+ hiddenCustomBadgeIds,
resolveHiddenProfileBadges,
} from '@app/api/user/profile_badges/HiddenProfileBadges';
import {applyProfileBadgeSettings} from '@app/api/user/profile_badges/PremiumBadgeMasking';
@@ -19,6 +20,7 @@ import type {UserRepository} from '@app/api/user/repositories/UserRepository';
import {isProfileSubstringExempt} from '@app/api/user/UserHelpers';
import {deriveDominantAvatarColor} from '@app/api/utils/AvatarColorUtils';
import * as EmojiUtils from '@app/api/utils/EmojiUtils';
+import {CustomBadgeTypes} from '@fluxer/constants/src/BadgeConstants';
import {MAX_BIO_LENGTH} from '@fluxer/constants/src/LimitConstants';
import {PremiumFlags, ProfileFieldPrivacyFlags, UserFlags} from '@fluxer/constants/src/UserConstants';
import {ValidationErrorCodes} from '@fluxer/constants/src/ValidationErrorCodes';
@@ -391,7 +393,8 @@ export class UserAccountProfileService {
const {user, data, updates} = params;
const requested = resolveHiddenProfileBadges(user.hiddenProfileBadges, data);
if (!requested) return;
- const next = dropUndefinedCustomBadgeKeys(requested, await getInstanceConfigRepository().getCustomBadges());
+ const known = await getCustomBadgeCatalog().getByIds(hiddenCustomBadgeIds(requested), CustomBadgeTypes.USER);
+ const next = dropUndefinedCustomBadgeKeys(requested, new Set(known.map((badge) => badge.id)));
if (next.size === user.hiddenProfileBadges.size && [...next].every((key) => user.hiddenProfileBadges.has(key))) {
return;
}
diff --git a/fluxer_api/src/api/user/services/UserAccountRequestService.ts b/fluxer_api/src/api/user/services/UserAccountRequestService.ts
index 074fb953a..99b312788 100644
--- a/fluxer_api/src/api/user/services/UserAccountRequestService.ts
+++ b/fluxer_api/src/api/user/services/UserAccountRequestService.ts
@@ -342,17 +342,18 @@ export class UserAccountRequestService {
async getUserProfile(params: UserProfileParams): Promise<UserProfileFullResponse> {
const guildId = params.guildId ? createGuildID(params.guildId) : undefined;
+ const profileLookup = this.userAccountService.lookupService.getUserProfile({
+ userId: params.currentUserId,
+ targetId: params.targetUserId,
+ guildId,
+ withMutualFriends: params.withMutualFriends,
+ withMutualGuilds: params.withMutualGuilds,
+ requestCache: params.requestCache,
+ });
const [profile, operatorPassState, badgeEnvironment] = await Promise.all([
- this.userAccountService.lookupService.getUserProfile({
- userId: params.currentUserId,
- targetId: params.targetUserId,
- guildId,
- withMutualFriends: params.withMutualFriends,
- withMutualGuilds: params.withMutualGuilds,
- requestCache: params.requestCache,
- }),
+ profileLookup,
this.operatorPassEntitlementService?.loadState(params.targetUserId) ?? null,
- loadProfileBadgeEnvironment(),
+ profileLookup.then((found) => loadProfileBadgeEnvironment(found.user.badgeIds)),
]);
let profileUser = profile.user;
let premiumType = profile.premiumType;
@@ -450,7 +451,7 @@ export class UserAccountRequestService {
const {user, settings} = params;
const [operatorPassState, environment] = await Promise.all([
user.isBot ? null : (this.operatorPassEntitlementService?.loadState(user.id) ?? null),
- loadProfileBadgeEnvironment(),
+ loadProfileBadgeEnvironment(user.badgeIds),
]);
const expired = shouldStripExpiredPremium(user);
const input = {
diff --git a/fluxer_api/src/api/worker/tasks/ProcessAssetDeletionQueue.ts b/fluxer_api/src/api/worker/tasks/ProcessAssetDeletionQueue.ts
index 46d423384..253dfa2b4 100644
--- a/fluxer_api/src/api/worker/tasks/ProcessAssetDeletionQueue.ts
+++ b/fluxer_api/src/api/worker/tasks/ProcessAssetDeletionQueue.ts
@@ -13,6 +13,7 @@ import type {
QueuedAssetType,
} from '@app/api/infrastructure/IAssetDeletionQueue';
import type {IStorageService} from '@app/api/infrastructure/IStorageService';
+import {isCustomBadgeAssetReferenced} from '@app/api/instance/custom_badges/CustomBadgeCatalog';
import type {InstanceConfigRepository} from '@app/api/instance/InstanceConfigRepository';
import {Logger} from '@app/api/Logger';
import type {UserRepository} from '@app/api/user/repositories/UserRepository';
@@ -34,7 +35,7 @@ interface AssetReferenceRepositories {
guildRepository: Pick<GuildRepository, 'findUnique' | 'getMember' | 'getRole'>;
instanceConfigRepository: Pick<
InstanceConfigRepository,
- 'readStoredBrandingAssetKeys' | 'readStoredCustomBadgeAssetKeys'
+ 'readStoredBrandingAssetKeys' | 'readStoredCustomBadgeReferences'
>;
}
@@ -185,7 +186,7 @@ async function isQueuedAssetStillCurrent(
return (await deps.instanceConfigRepository.readStoredBrandingAssetKeys()).has(item.s3Key);
}
if (item.s3Key.startsWith('custom-badges/')) {
- return (await deps.instanceConfigRepository.readStoredCustomBadgeAssetKeys()).has(item.s3Key);
+ return isCustomBadgeAssetReferenced(deps.instanceConfigRepository, item.s3Key);
}
if (item.s3Key.startsWith('role-icons/')) {
return isRoleIconStillCurrent(item, deps);
diff --git a/fluxer_api/src/api/worker/tasks/admin_bulk/AdminBulkServices.ts b/fluxer_api/src/api/worker/tasks/admin_bulk/AdminBulkServices.ts
index 0db3fe261..5b9dfd146 100644
--- a/fluxer_api/src/api/worker/tasks/admin_bulk/AdminBulkServices.ts
+++ b/fluxer_api/src/api/worker/tasks/admin_bulk/AdminBulkServices.ts
@@ -12,11 +12,11 @@ import {EnforcementDecisionService} from '@app/api/enforcement/EnforcementDecisi
import {EnforcementNoticeDelivery} from '@app/api/enforcement/EnforcementNoticeDelivery';
import {getReportServiceInstance} from '@app/api/middleware/ServiceMiddleware';
import {
+ getCustomBadgeCatalog,
getDiscriminatorService,
getEnforcementDecisionRepository,
getEntityAssetService,
getGuildDiscoveryRepository,
- getInstanceConfigRepository,
getInviteRepository,
} from '@app/api/middleware/ServiceSingletons';
import {queuePaymentDisputeClosures} from '@app/api/payment_disputes/PaymentDisputeEnforcement';
@@ -136,7 +136,7 @@ export function createAdminBulkServices(deps: WorkerDependencies): AdminBulkServ
auditService,
discoveryRepository: getGuildDiscoveryRepository(),
enforcement: enforcementService,
- instanceConfigRepository: getInstanceConfigRepository(),
+ customBadgeCatalog: getCustomBadgeCatalog(),
});
return {auditService, banManagementService, userService, guildService};
}
diff --git a/fluxer_app/src/features/app/components/layout/GuildHeader.tsx b/fluxer_app/src/features/app/components/layout/GuildHeader.tsx
index 2a556e3df..08aa41f9b 100644
--- a/fluxer_app/src/features/app/components/layout/GuildHeader.tsx
+++ b/fluxer_app/src/features/app/components/layout/GuildHeader.tsx
@@ -155,7 +155,7 @@ export const GuildHeader = observer(({guild, banner}: {guild: Guild; banner: Gui
<GuildBadge
features={guild.features}
badgeIds={guild.badgeIds}
- customBadgeLimit={2}
+ visibleCustomBadges={2}
linkable
variant={onBanner ? 'banner' : 'default'}
tooltipPosition="bottom"
diff --git a/fluxer_app/src/features/app/components/layout/sidebar_nav/GuildListItemTooltip.tsx b/fluxer_app/src/features/app/components/layout/sidebar_nav/GuildListItemTooltip.tsx
index 35dfa272d..5672b331e 100644
--- a/fluxer_app/src/features/app/components/layout/sidebar_nav/GuildListItemTooltip.tsx
+++ b/fluxer_app/src/features/app/components/layout/sidebar_nav/GuildListItemTooltip.tsx
@@ -188,7 +188,7 @@ export function GuildListItemTooltip({
<GuildBadge
features={guild.features}
badgeIds={guild.badgeIds}
- customBadgeLimit={2}
+ visibleCustomBadges={2}
showTooltip={false}
onLightSurface
data-flx="app.sidebar-nav.guild-list-item-tooltip.guild-badge"
diff --git a/fluxer_app/src/features/app/components/pages/YouPage.tsx b/fluxer_app/src/features/app/components/pages/YouPage.tsx
index 1672b2801..24b8d0a39 100644
--- a/fluxer_app/src/features/app/components/pages/YouPage.tsx
+++ b/fluxer_app/src/features/app/components/pages/YouPage.tsx
@@ -145,6 +145,7 @@ export const YouPage = observer(({onAvatarClick}: YouPageProps) => {
<div className={styles.badgesWrapper} data-flx="app.you-page.badges-wrapper">
<UserProfileBadges
badges={profile?.profileBadges ?? []}
+ maxVisible={15}
isModal={true}
isMobile={true}
onEditBadges={canEditOwnProfileBadges(user.id, profile) ? openProfileBadgeSettings : undefined}
diff --git a/fluxer_app/src/features/app/constants/Endpoints.ts b/fluxer_app/src/features/app/constants/Endpoints.ts
index 42324f54e..2c8f3259f 100644
--- a/fluxer_app/src/features/app/constants/Endpoints.ts
+++ b/fluxer_app/src/features/app/constants/Endpoints.ts
@@ -3,6 +3,7 @@
import {ME} from '@fluxer/constants/src/AppConstants';
export const Endpoints = {
+ INSTANCE_BADGES: '/instance/badges',
INSTANCE_SETUP_ACCOUNT_IDENTITY: '/instance/setup/account-identity',
INSTANCE_SETUP_TOKEN_CHECKS: '/instance/setup/token-checks',
ATTACHMENTS_REFRESH_URLS: '/attachments/refresh-urls',
diff --git a/fluxer_app/src/features/app/state/InstanceSnapshotStore.ts b/fluxer_app/src/features/app/state/InstanceSnapshotStore.ts
index aeb44593b..3d101baac 100644
--- a/fluxer_app/src/features/app/state/InstanceSnapshotStore.ts
+++ b/fluxer_app/src/features/app/state/InstanceSnapshotStore.ts
@@ -121,6 +121,8 @@ export function runtimeSnapshotFromDiscovery(document: InstanceDiscoveryDocument
domainMigration: discovery.domainMigration,
notice: discovery.notice ?? null,
guildBadges: discovery.guildBadges,
+ guildBadgesPartial: discovery.guildBadgesPartial,
+ customBadgesVersion: discovery.customBadgesVersion,
builtInGuildBadgeImages: discovery.builtInGuildBadgeImages,
});
}
diff --git a/fluxer_app/src/features/app/state/RuntimeConfig.ts b/fluxer_app/src/features/app/state/RuntimeConfig.ts
index 9641c6047..d38f872cf 100644
--- a/fluxer_app/src/features/app/state/RuntimeConfig.ts
+++ b/fluxer_app/src/features/app/state/RuntimeConfig.ts
@@ -686,6 +686,8 @@ class RuntimeConfig {
appPublic: resolution.snapshot.appPublic,
notice: resolution.snapshot.notice,
guildBadges: resolution.snapshot.guildBadges,
+ guildBadgesPartial: resolution.snapshot.guildBadgesPartial,
+ customBadgesVersion: resolution.snapshot.customBadgesVersion,
builtInGuildBadgeImages: resolution.snapshot.builtInGuildBadgeImages,
limits: resolution.snapshot.limits,
});
@@ -924,6 +926,14 @@ class RuntimeConfig {
return this.activeRuntime?.snapshot.guildBadges ?? [];
}
+ get guildBadgesPartial(): boolean {
+ return this.activeRuntime?.snapshot.guildBadgesPartial ?? false;
+ }
+
+ get customBadgesVersion(): string | null {
+ return this.activeRuntime?.snapshot.customBadgesVersion ?? null;
+ }
+
get builtInGuildBadgeImages(): InstanceBuiltInGuildBadgeImages {
return this.activeRuntime?.snapshot.builtInGuildBadgeImages ?? NO_BUILT_IN_GUILD_BADGE_IMAGES;
}
diff --git a/fluxer_app/src/features/app/state/RuntimeConfigSnapshot.ts b/fluxer_app/src/features/app/state/RuntimeConfigSnapshot.ts
index 064b4fc47..d6831ff13 100644
--- a/fluxer_app/src/features/app/state/RuntimeConfigSnapshot.ts
+++ b/fluxer_app/src/features/app/state/RuntimeConfigSnapshot.ts
@@ -78,6 +78,8 @@ export interface RuntimeConfigSnapshot extends RuntimeConfigIdentity {
readonly domainMigration: InstanceDomainMigration | null;
readonly notice: InstanceNotice | null;
readonly guildBadges: ReadonlyArray<InstanceGuildBadge>;
+ readonly guildBadgesPartial: boolean;
+ readonly customBadgesVersion: string | null;
readonly builtInGuildBadgeImages: InstanceBuiltInGuildBadgeImages;
}
@@ -580,12 +582,15 @@ function readGuildBadges(value: unknown): Array<InstanceGuildBadge> {
return value.map((entry, index) => {
const path = `guildBadges[${index}]`;
const source = readRecord(entry, path);
+ const position =
+ source.position === undefined ? undefined : readNonEmptyString(source, 'position', `${path}.position`);
return {
id: readNonEmptyString(source, 'id', `${path}.id`),
name: readNonEmptyString(source, 'name', `${path}.name`),
description: readNullableNonEmptyString(source, 'description', `${path}.description`),
asset_url: readNonEmptyString(source, 'asset_url', `${path}.asset_url`),
href: readNullableAbsoluteHttpUrl(source, 'href', `${path}.href`),
+ ...(position === undefined ? {} : {position}),
};
});
}
@@ -630,6 +635,11 @@ export function requireRuntimeConfigSnapshot(value: unknown): RuntimeConfigSnaps
domainMigration: parseInstanceDomainMigration(source.domainMigration),
notice: readNotice(source.notice),
guildBadges: readGuildBadges(source.guildBadges),
+ guildBadgesPartial: source.guildBadgesPartial === true,
+ customBadgesVersion:
+ source.customBadgesVersion === undefined || source.customBadgesVersion === null
+ ? null
+ : readNonEmptyString(source, 'customBadgesVersion', 'customBadgesVersion'),
builtInGuildBadgeImages: readBuiltInGuildBadgeImages(source.builtInGuildBadgeImages),
};
}
diff --git a/fluxer_app/src/features/channel/components/direct_message/DMWelcomeSection.tsx b/fluxer_app/src/features/channel/components/direct_message/DMWelcomeSection.tsx
index 839853b7b..87504971b 100644
--- a/fluxer_app/src/features/channel/components/direct_message/DMWelcomeSection.tsx
+++ b/fluxer_app/src/features/channel/components/direct_message/DMWelcomeSection.tsx
@@ -283,6 +283,7 @@ export const DMWelcomeSection: React.FC<DMWelcomeSectionProps> = observer(functi
</FocusRing>
<UserProfileBadges
badges={profile?.profileBadges ?? []}
+ maxVisible={7}
isModal={true}
isMobile={mobileLayout.enabled}
data-flx="channel.direct-message.dm-welcome-section.user-profile-badges"
diff --git a/fluxer_app/src/features/discovery/discovery/DiscoveryGuildCard.tsx b/fluxer_app/src/features/discovery/discovery/DiscoveryGuildCard.tsx
index cf0f8b537..970746930 100644
--- a/fluxer_app/src/features/discovery/discovery/DiscoveryGuildCard.tsx
+++ b/fluxer_app/src/features/discovery/discovery/DiscoveryGuildCard.tsx
@@ -144,6 +144,7 @@ export const DiscoveryGuildCard = observer(function DiscoveryGuildCard({
<GuildBadge
features={nameBadgeFeatures}
badgeIds={guild.badge_ids}
+ expandable={false}
tooltipPosition="bottom"
data-flx="discovery.discovery.discovery-guild-card.guild-badge"
/>
diff --git a/fluxer_app/src/features/guild/components/GuildBadge.module.css b/fluxer_app/src/features/guild/components/GuildBadge.module.css
index 01ce479b9..1cb4f6256 100644
--- a/fluxer_app/src/features/guild/components/GuildBadge.module.css
+++ b/fluxer_app/src/features/guild/components/GuildBadge.module.css
@@ -57,3 +57,27 @@
--guild-badge-seal: var(--brand-primary-fill);
--guild-badge-icon: var(--brand-primary);
}
+
+.morePill {
+ display: inline-flex;
+ flex-shrink: 0;
+ align-items: center;
+ justify-content: center;
+ min-width: 1.25rem;
+ height: 1.25rem;
+ border: 0;
+ border-radius: 0.625rem;
+ padding: 0 0.375rem;
+ background: var(--background-modifier-accent);
+ color: var(--text-primary);
+ font: inherit;
+ font-weight: 600;
+ font-size: 0.75rem;
+ line-height: 1;
+ font-variant-numeric: tabular-nums;
+ white-space: nowrap;
+}
+
+button.morePill {
+ cursor: pointer;
+}
diff --git a/fluxer_app/src/features/guild/components/GuildBadge.tsx b/fluxer_app/src/features/guild/components/GuildBadge.tsx
index 3f0e333bd..232f6c02d 100644
--- a/fluxer_app/src/features/guild/components/GuildBadge.tsx
+++ b/fluxer_app/src/features/guild/components/GuildBadge.tsx
@@ -2,20 +2,28 @@
import RuntimeConfig from '@app/features/app/state/RuntimeConfig';
import styles from '@app/features/guild/components/GuildBadge.module.css';
+import {GuildBadgesModal} from '@app/features/guild/components/modals/GuildBadgesModal';
+import GuildBadgeDefinitions from '@app/features/guild/state/GuildBadgeDefinitions';
import {DISCOVERABLE_COMMUNITY_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
+import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
import {DiscoverableBadgeIcon} from '@app/features/ui/components/icons/DiscoverableBadgeIcon';
import {PartneredBadgeIcon} from '@app/features/ui/components/icons/PartneredBadgeIcon';
import {VerifiedBadgeIcon} from '@app/features/ui/components/icons/VerifiedBadgeIcon';
import {Tooltip} from '@app/features/ui/tooltip/Tooltip';
import {handleExternalLinkClick} from '@app/features/ui/utils/NativeUtils';
import {customBadgeImageUrl} from '@app/features/user/utils/ProfileUtils';
+import {
+ MORE_BADGES_DESCRIPTOR,
+ SHOW_ALL_BADGES_COUNT_DESCRIPTOR,
+ SHOW_ALL_BADGES_DESCRIPTOR,
+} from '@app/features/user/utils/UserMessageDescriptors';
import type {BuiltInGuildBadgeKind} from '@fluxer/constants/src/BadgeConstants';
import {GuildFeatures} from '@fluxer/constants/src/GuildConstants';
import type {InstanceGuildBadge} from '@fluxer/instance_bootstrap/src/Types';
import {msg} from '@lingui/core/macro';
import {useLingui} from '@lingui/react/macro';
import {observer} from 'mobx-react-lite';
-import {useEffect} from 'react';
+import {useEffect, useState} from 'react';
const VERIFIED_PARTNERED_COMMUNITY_DESCRIPTOR = msg({
message: 'Verified & partnered community',
@@ -30,14 +38,15 @@ const VERIFIED_COMMUNITY_DESCRIPTOR = msg({
comment: 'Short label in the community badge. Keep it concise.',
});
-const UNKNOWN_BADGE_REVALIDATION_COOLDOWN_MS = 5 * 60 * 1000;
-const unknownBadgeRevalidatedAt = new Map<string, number>();
+const DEFAULT_VISIBLE_CUSTOM_BADGES = 3;
+const CUSTOM_BADGE_SETTLE_MS = 300;
interface GuildBadgeProps {
readonly features: ReadonlySet<string> | ReadonlyArray<string>;
readonly badgeIds?: ReadonlyArray<string>;
- readonly customBadgeLimit?: number;
+ readonly visibleCustomBadges?: number;
readonly linkable?: boolean;
+ readonly expandable?: boolean;
readonly variant?: 'default' | 'large' | 'banner';
readonly tooltipPosition?: 'top' | 'bottom';
readonly showTooltip?: boolean;
@@ -52,21 +61,66 @@ function hasFeature(features: ReadonlySet<string> | ReadonlyArray<string>, featu
return (features as ReadonlySet<string>).has(feature);
}
-function assignedCustomBadges(badgeIds: ReadonlyArray<string>): ReadonlyArray<InstanceGuildBadge> {
- if (badgeIds.length === 0) return [];
- const assigned = new Set(badgeIds);
- return RuntimeConfig.guildBadges.filter((badge) => assigned.has(badge.id));
+function useSettledOnce(settled: boolean): boolean {
+ const [shown, setShown] = useState(settled);
+ useEffect(() => {
+ if (shown) return;
+ if (settled) {
+ setShown(true);
+ return;
+ }
+ const timer = window.setTimeout(() => setShown(true), CUSTOM_BADGE_SETTLE_MS);
+ return () => window.clearTimeout(timer);
+ }, [settled, shown]);
+ return shown || settled;
}
-function revalidateUnknownBadges(badgeIds: ReadonlyArray<string>): void {
- const known = new Set(RuntimeConfig.guildBadges.map((badge) => badge.id));
- const now = Date.now();
- const unknown = badgeIds.filter(
- (id) => !known.has(id) && now - (unknownBadgeRevalidatedAt.get(id) ?? 0) >= UNKNOWN_BADGE_REVALIDATION_COOLDOWN_MS,
+function MoreGuildBadges({
+ badges,
+ hidden,
+ interactive,
+ tooltipPosition,
+}: {
+ readonly badges: ReadonlyArray<InstanceGuildBadge>;
+ readonly hidden: number;
+ readonly interactive: boolean;
+ readonly tooltipPosition: 'top' | 'bottom';
+}) {
+ const {i18n} = useLingui();
+ const label = i18n._(MORE_BADGES_DESCRIPTOR, {count: hidden});
+ if (!interactive) {
+ return (
+ <span className={styles.morePill} data-flx="guild.guild-badge.more-badges-text">
+ {label}
+ </span>
+ );
+ }
+ const open = (event: React.SyntheticEvent) => {
+ event.preventDefault();
+ event.stopPropagation();
+ ModalCommands.push(
+ ModalCommands.modal(() => <GuildBadgesModal badges={badges} data-flx="guild.guild-badge.guild-badges-modal" />),
+ );
+ };
+ return (
+ <Tooltip
+ text={i18n._(SHOW_ALL_BADGES_DESCRIPTOR)}
+ position={tooltipPosition}
+ data-flx="guild.guild-badge.more-tooltip"
+ >
+ <button
+ type="button"
+ className={styles.morePill}
+ aria-label={i18n._(SHOW_ALL_BADGES_COUNT_DESCRIPTOR, {count: hidden})}
+ onClick={open}
+ onPointerDown={(event) => event.stopPropagation()}
+ onKeyDown={(event) => event.stopPropagation()}
+ data-flx="guild.guild-badge.more-badges-button"
+ >
+ {label}
+ </button>
+ </Tooltip>
);
- if (unknown.length === 0) return;
- for (const id of unknown) unknownBadgeRevalidatedAt.set(id, now);
- void RuntimeConfig.revalidateDiscovery().catch(() => undefined);
}
function CustomGuildBadge({
@@ -134,7 +188,7 @@ function CustomGuildBadge({
}
type BuiltInGuildBadgeProps = Required<
- Omit<GuildBadgeProps, 'badgeIds' | 'customBadgeLimit' | 'linkable' | 'variant'>
+ Omit<GuildBadgeProps, 'badgeIds' | 'visibleCustomBadges' | 'linkable' | 'expandable' | 'variant'>
> & {
readonly variant: NonNullable<GuildBadgeProps['variant']>;
readonly size: number;
@@ -215,8 +269,9 @@ const BuiltInGuildBadge = observer(function BuiltInGuildBadge({
export const GuildBadge = observer(function GuildBadge({
features,
badgeIds = [],
- customBadgeLimit,
+ visibleCustomBadges = DEFAULT_VISIBLE_CUSTOM_BADGES,
linkable = false,
+ expandable = true,
variant = 'default',
tooltipPosition = 'top',
showTooltip = true,
@@ -236,11 +291,17 @@ export const GuildBadge = observer(function GuildBadge({
data-flx="guild.guild-badge.built-in-guild-badge"
/>
);
+ const badgeKey = badgeIds.join(',');
useEffect(() => {
- if (badgeIds.length > 0) revalidateUnknownBadges(badgeIds);
- }, [badgeIds]);
- const customBadges = assignedCustomBadges(badgeIds).slice(0, customBadgeLimit);
- if (customBadges.length === 0) {
+ if (badgeKey === '') return;
+ return GuildBadgeDefinitions.retain(badgeKey.split(','));
+ }, [badgeKey]);
+ const resolved = GuildBadgeDefinitions.resolve(badgeIds);
+ const ready = useSettledOnce(resolved.settled);
+ const allCustomBadges = ready ? resolved.badges : [];
+ const customBadges = allCustomBadges.slice(0, Math.max(0, visibleCustomBadges));
+ const hidden = allCustomBadges.length - customBadges.length;
+ if (allCustomBadges.length === 0) {
return builtIn;
}
return (
@@ -257,6 +318,15 @@ export const GuildBadge = observer(function GuildBadge({
data-flx="guild.guild-badge.custom-guild-badge"
/>
))}
+ {hidden > 0 && (
+ <MoreGuildBadges
+ badges={allCustomBadges}
+ hidden={hidden}
+ interactive={showTooltip && expandable}
+ tooltipPosition={tooltipPosition}
+ data-flx="guild.guild-badge.more-guild-badges"
+ />
+ )}
</span>
);
});
diff --git a/fluxer_app/src/features/guild/components/modals/GuildBadgesModal.tsx b/fluxer_app/src/features/guild/components/modals/GuildBadgesModal.tsx
new file mode 100644
index 000000000..676bfd536
--- /dev/null
+++ b/fluxer_app/src/features/guild/components/modals/GuildBadgesModal.tsx
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import {BadgeListModal} from '@app/features/user/components/modals/BadgeListModal';
+import {customBadgeImageUrl} from '@app/features/user/utils/ProfileUtils';
+import type {InstanceGuildBadge} from '@fluxer/instance_bootstrap/src/Types';
+
+export function GuildBadgesModal({
+ badges,
+ 'data-flx': dataFlx = 'guild.guild-badges-modal',
+}: {
+ readonly badges: ReadonlyArray<InstanceGuildBadge>;
+ readonly 'data-flx'?: string;
+}) {
+ return (
+ <BadgeListModal
+ items={badges.map((badge) => ({
+ key: badge.id,
+ imageUrl: customBadgeImageUrl(badge.asset_url),
+ caption: null,
+ title: badge.name,
+ lines: badge.description === null ? [] : [badge.description],
+ href: badge.href,
+ }))}
+ data-flx={dataFlx}
+ />
+ );
+}
diff --git a/fluxer_app/src/features/guild/state/GuildBadgeDefinitions.ts b/fluxer_app/src/features/guild/state/GuildBadgeDefinitions.ts
new file mode 100644
index 000000000..396858203
--- /dev/null
+++ b/fluxer_app/src/features/guild/state/GuildBadgeDefinitions.ts
@@ -0,0 +1,326 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import {Endpoints} from '@app/features/app/constants/Endpoints';
+import RuntimeConfig from '@app/features/app/state/RuntimeConfig';
+import {http} from '@app/features/platform/transport/RestTransport';
+import {CUSTOM_BADGE_LOOKUP_IDS_MAX} from '@fluxer/constants/src/BadgeConstants';
+import type {InstanceGuildBadge} from '@fluxer/instance_bootstrap/src/Types';
+import {makeAutoObservable, observable, reaction, runInAction} from 'mobx';
+
+const LOOKUP_DELAY_MS = 50;
+const FETCHED_MAX = 2000;
+const MISSING_MAX = 5000;
+const REVALIDATE_COOLDOWN_MS = 30_000;
+const RETRY_AFTER_MS = 30_000;
+const LEGACY_REVALIDATE_COOLDOWN_MS = 5 * 60_000;
+
+interface VersionedBadge {
+ readonly badge: InstanceGuildBadge;
+ readonly version: string;
+}
+
+interface BadgeLookupResponse {
+ readonly version?: unknown;
+ readonly badges?: unknown;
+}
+
+export interface ResolvedGuildBadges {
+ readonly badges: ReadonlyArray<InstanceGuildBadge>;
+ readonly settled: boolean;
+}
+
+function versionSequence(version: string): bigint | null {
+ const match = /^([0-9]{1,20})/.exec(version);
+ return match ? BigInt(match[1]!) : null;
+}
+
+function versionSuffix(version: string): string {
+ const dot = version.indexOf('.');
+ return dot === -1 ? '' : version.slice(dot + 1);
+}
+
+function isNewerBadgeVersion(candidate: string, current: string | null): boolean {
+ if (current === null) return true;
+ const next = versionSequence(candidate);
+ const now = versionSequence(current);
+ if (next === null || now === null || versionSuffix(candidate) !== versionSuffix(current)) return false;
+ return next > now;
+}
+
+function readBadge(value: unknown): InstanceGuildBadge | null {
+ if (typeof value !== 'object' || value === null) return null;
+ const source = value as Record<string, unknown>;
+ const {id, name, description, asset_url: assetUrl, href, position} = source;
+ if (typeof id !== 'string' || typeof name !== 'string' || typeof assetUrl !== 'string') return null;
+ return {
+ id,
+ name,
+ description: typeof description === 'string' && description.length > 0 ? description : null,
+ asset_url: assetUrl,
+ href: typeof href === 'string' && /^https?:\/\//.test(href) ? href : null,
+ ...(typeof position === 'string' && /^-?[0-9]{1,19}$/.test(position) ? {position} : {}),
+ };
+}
+
+function compareIds(left: string, right: string): number {
+ const a = BigInt(left);
+ const b = BigInt(right);
+ if (a === b) return 0;
+ return a < b ? -1 : 1;
+}
+
+function setCapped<V>(map: Map<string, V>, key: string, value: V, max: number, keep: (key: string) => boolean): void {
+ map.delete(key);
+ map.set(key, value);
+ if (map.size <= max) return;
+ for (const candidate of map.keys()) {
+ if (map.size <= max) break;
+ if (!keep(candidate)) map.delete(candidate);
+ }
+}
+
+class GuildBadgeDefinitions {
+ private readonly fetched = observable.map<string, VersionedBadge>(undefined, {deep: false});
+ private readonly missing = observable.map<string, string>(undefined, {deep: false});
+ private responseVersion: string | null = null;
+ private readonly pending = new Set<string>();
+ private readonly inFlight = new Set<string>();
+ private readonly retryAt = new Map<string, number>();
+ private readonly retained = new Map<string, number>();
+ private readonly legacyRevalidatedAt = new Map<string, number>();
+ private timer: ReturnType<typeof setTimeout> | null = null;
+ private retryTimer: ReturnType<typeof setTimeout> | null = null;
+ private lastRevalidateAt = 0;
+
+ constructor() {
+ makeAutoObservable<
+ GuildBadgeDefinitions,
+ | 'pending'
+ | 'inFlight'
+ | 'retryAt'
+ | 'retained'
+ | 'legacyRevalidatedAt'
+ | 'timer'
+ | 'retryTimer'
+ | 'lastRevalidateAt'
+ >(
+ this,
+ {
+ pending: false,
+ inFlight: false,
+ retryAt: false,
+ retained: false,
+ legacyRevalidatedAt: false,
+ timer: false,
+ retryTimer: false,
+ lastRevalidateAt: false,
+ },
+ {autoBind: true},
+ );
+ reaction(
+ () => this.activeVersion,
+ () => this.requestRetained(),
+ );
+ if (typeof window !== 'undefined') {
+ window.addEventListener('online', () => this.retryNow());
+ }
+ }
+
+ get activeVersion(): string | null {
+ const discovery = RuntimeConfig.customBadgesVersion;
+ if (discovery === null) return null;
+ const response = this.responseVersion;
+ return response !== null && isNewerBadgeVersion(response, discovery) ? response : discovery;
+ }
+
+ private get seeded(): ReadonlyMap<string, {badge: InstanceGuildBadge; index: number}> {
+ return new Map(RuntimeConfig.guildBadges.map((badge, index) => [badge.id, {badge, index}]));
+ }
+
+ private current(id: string): InstanceGuildBadge | null | undefined {
+ const version = this.activeVersion;
+ const fetched = this.fetched.get(id);
+ if (fetched && fetched.version === version) return fetched.badge;
+ const seeded = this.seeded.get(id);
+ if (seeded) return seeded.badge;
+ if (version === null) return undefined;
+ return this.missing.get(id) === version ? null : undefined;
+ }
+
+ private lookup(id: string): InstanceGuildBadge | null | undefined {
+ const badge = this.current(id);
+ return badge === undefined ? this.fetched.get(id)?.badge : badge;
+ }
+
+ resolve(ids: ReadonlyArray<string>): ResolvedGuildBadges {
+ const found: Array<InstanceGuildBadge> = [];
+ let settled = true;
+ const seen = new Set<string>();
+ for (const id of ids) {
+ if (seen.has(id)) continue;
+ seen.add(id);
+ const badge = this.lookup(id);
+ if (badge) found.push(badge);
+ else if (badge === undefined) settled = false;
+ }
+ const seeded = this.seeded;
+ found.sort((left, right) => {
+ if (left.position !== undefined && right.position !== undefined) {
+ const a = BigInt(left.position);
+ const b = BigInt(right.position);
+ if (a !== b) return a < b ? -1 : 1;
+ return compareIds(left.id, right.id);
+ }
+ const leftIndex = seeded.get(left.id)?.index ?? Number.MAX_SAFE_INTEGER;
+ const rightIndex = seeded.get(right.id)?.index ?? Number.MAX_SAFE_INTEGER;
+ return leftIndex !== rightIndex ? leftIndex - rightIndex : compareIds(left.id, right.id);
+ });
+ return {badges: found, settled: settled || this.activeVersion === null};
+ }
+
+ retain(ids: ReadonlyArray<string>): () => void {
+ const unique = [...new Set(ids)];
+ for (const id of unique) this.retained.set(id, (this.retained.get(id) ?? 0) + 1);
+ this.request(unique);
+ return () => {
+ for (const id of unique) {
+ const count = (this.retained.get(id) ?? 1) - 1;
+ if (count <= 0) this.retained.delete(id);
+ else this.retained.set(id, count);
+ }
+ };
+ }
+
+ request(ids: ReadonlyArray<string>): void {
+ if (this.activeVersion === null) {
+ this.revalidateLegacy(ids);
+ return;
+ }
+ const now = Date.now();
+ for (const id of ids) {
+ if (!/^[0-9]{1,20}$/.test(id) || this.current(id) !== undefined) continue;
+ if (this.pending.has(id) || this.inFlight.has(id) || (this.retryAt.get(id) ?? 0) > now) continue;
+ this.pending.add(id);
+ }
+ if (this.pending.size > 0 && this.timer === null) {
+ this.timer = setTimeout(() => this.flush(), LOOKUP_DELAY_MS);
+ }
+ this.scheduleRetry();
+ }
+
+ private requestRetained(): void {
+ if (this.retained.size > 0) this.request([...this.retained.keys()]);
+ }
+
+ private retryNow(): void {
+ this.retryAt.clear();
+ this.requestRetained();
+ }
+
+ private revalidateLegacy(ids: ReadonlyArray<string>): void {
+ const now = Date.now();
+ const unknown = ids.filter(
+ (id) =>
+ this.current(id) === undefined &&
+ now - (this.legacyRevalidatedAt.get(id) ?? 0) >= LEGACY_REVALIDATE_COOLDOWN_MS,
+ );
+ if (unknown.length === 0) return;
+ for (const id of unknown) this.legacyRevalidatedAt.set(id, now);
+ void RuntimeConfig.revalidateDiscovery().catch(() => undefined);
+ }
+
+ private flush(): void {
+ this.timer = null;
+ const version = this.activeVersion;
+ const ids = [...this.pending].sort(compareIds);
+ this.pending.clear();
+ if (version === null || ids.length === 0) return;
+ for (let index = 0; index < ids.length; index += CUSTOM_BADGE_LOOKUP_IDS_MAX) {
+ const chunk = ids.slice(index, index + CUSTOM_BADGE_LOOKUP_IDS_MAX);
+ for (const id of chunk) this.inFlight.add(id);
+ void http
+ .get<BadgeLookupResponse>(Endpoints.INSTANCE_BADGES, {
+ query: {ids: chunk.join(','), version},
+ mode: 'silent',
+ })
+ .then(
+ (response) => this.applyResponse(chunk, response.ok ? response.body : null),
+ () => this.applyResponse(chunk, null),
+ );
+ }
+ }
+
+ private applyResponse(ids: ReadonlyArray<string>, body: BadgeLookupResponse | null): void {
+ runInAction(() => {
+ for (const id of ids) this.inFlight.delete(id);
+ const responseVersion = typeof body?.version === 'string' ? body.version : null;
+ const active = this.activeVersion;
+ if (body === null || responseVersion === null || active === null || !Array.isArray(body.badges)) {
+ this.deferRetry(ids);
+ return;
+ }
+ if (isNewerBadgeVersion(responseVersion, active)) {
+ this.responseVersion = responseVersion;
+ this.revalidateDiscovery();
+ }
+ const current = responseVersion === this.activeVersion;
+ const returned = new Set<string>();
+ for (const entry of body.badges) {
+ const badge = readBadge(entry);
+ if (!badge) continue;
+ returned.add(badge.id);
+ const previous = this.fetched.get(badge.id);
+ if (!current && previous?.version === this.activeVersion) continue;
+ setCapped(this.fetched, badge.id, {badge, version: responseVersion}, FETCHED_MAX, (key) =>
+ this.retained.has(key),
+ );
+ }
+ if (current) {
+ for (const id of ids) {
+ if (!returned.has(id)) setCapped(this.missing, id, responseVersion, MISSING_MAX, () => false);
+ }
+ } else {
+ this.deferRetry(ids);
+ }
+ });
+ }
+
+ private deferRetry(ids: ReadonlyArray<string>): void {
+ const at = Date.now() + RETRY_AFTER_MS;
+ for (const id of ids) this.retryAt.set(id, at);
+ while (this.retryAt.size > MISSING_MAX) {
+ const oldest = this.retryAt.keys().next();
+ if (oldest.done) break;
+ this.retryAt.delete(oldest.value);
+ }
+ this.scheduleRetry();
+ }
+
+ private scheduleRetry(): void {
+ if (this.retryTimer !== null) return;
+ const now = Date.now();
+ let next: number | null = null;
+ for (const id of this.retained.keys()) {
+ const at = this.retryAt.get(id);
+ if (at !== undefined && at > now && (next === null || at < next)) next = at;
+ }
+ if (next === null) return;
+ this.retryTimer = setTimeout(
+ () => {
+ this.retryTimer = null;
+ this.requestRetained();
+ this.scheduleRetry();
+ },
+ next - now + LOOKUP_DELAY_MS,
+ );
+ }
+
+ private revalidateDiscovery(): void {
+ const now = Date.now();
+ if (now - this.lastRevalidateAt < REVALIDATE_COOLDOWN_MS) return;
+ this.lastRevalidateAt = now;
+ void RuntimeConfig.revalidateDiscovery().catch(() => undefined);
+ }
+}
+
+export default new GuildBadgeDefinitions();
diff --git a/fluxer_app/src/features/i18n/locales/ar/messages.po b/fluxer_app/src/features/i18n/locales/ar/messages.po
index 00ca3d914..36a9d3e22 100644
--- a/fluxer_app/src/features/i18n/locales/ar/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ar/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, zero {# اشتراك نشط} one {اشتراك نشط و
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, zero {# مرفق} one {مرفق واحد} two {مرفقان} few {# مرفقات} many {# مرفقًا} other {# مرفق}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, zero {لا توجد شارات مطابقة} one {شارة واحدة مطابقة} two {شارتان مطابقتان} few {# شارات مطابقة} many {# شارة مطابقة} other {# شارة مطابقة}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, zero {# سنة} one {# سنة} two {# سنة} few {# سنة} many {# سنة} other {# سنة}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, zero {+# شارة إضافية، عرض الكل} one {+# شارة إضافية، عرض الكل} two {+# شارتان إضافيتان، عرض الكل} few {+# شارات إضافية، عرض الكل} many {+# شارة إضافية، عرض الكل} other {+# شارة إضافية، عرض الكل}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, zero {طي (# سطر)} one {طي (سطر واحد)} two {طي (سطران)} few {طي (# أسطر)} many {طي (# سطرًا)} other {طي (# سطر)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "العدد للشارة والجدار: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "الشارات"
@@ -16568,6 +16582,11 @@ msgstr "تملأ صفحة تسجيل الدخول خلف النموذج، مع
msgid "Filter"
msgstr "تصفية"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "تصفية الشارات"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "لا توجد اقتراحات إكمال تلقائي"
msgid "No background"
msgstr "بلا خلفية"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "لا توجد شارات مطابقة."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "لا يوجد مستخدمون محظورون"
@@ -32974,6 +32998,11 @@ msgstr "اعرض «نشط الآن» على الشاشة الرئيسية لإب
msgid "Show activity on other accounts"
msgstr "عرض النشاط على الحسابات الأخرى"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "عرض كل الشارات"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/bg/messages.po b/fluxer_app/src/features/i18n/locales/bg/messages.po
index 4199d8ae7..a2402c583 100644
--- a/fluxer_app/src/features/i18n/locales/bg/messages.po
+++ b/fluxer_app/src/features/i18n/locales/bg/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# активен абонамент} other {# ак
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# прикачен файл} other {# прикачени файла}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# съвпадаща значка} other {# съвпадащи значки}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# г.} other {# г.}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# още значка, покажи всички} other {+# още значки, покажи всички}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Свиване (# ред)} other {Свиване (# реда)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Брой за значката и стената: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Значки"
@@ -16568,6 +16582,11 @@ msgstr "Запълва страницата за вход зад формата
msgid "Filter"
msgstr "Филтър"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Филтриране на значките"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Няма предложения за автоматично довърш
msgid "No background"
msgstr "Без фон"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Няма съвпадащи значки."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Няма забранени потребители"
@@ -32974,6 +32998,11 @@ msgstr "Показвай „Активни сега“ на началния е
msgid "Show activity on other accounts"
msgstr "Покажи активност в други профили"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Покажи всички значки"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/cs/messages.po b/fluxer_app/src/features/i18n/locales/cs/messages.po
index e02863ad6..677d793c4 100644
--- a/fluxer_app/src/features/i18n/locales/cs/messages.po
+++ b/fluxer_app/src/features/i18n/locales/cs/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# aktivní odběr} few {# aktivní odběry} many {#
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# příloha} few {# přílohy} many {# přílohy} other {# příloh}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# odpovídající odznak} few {# odpovídající odznaky} many {# odpovídajícího odznaku} other {# odpovídajících odznaků}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# r.} few {# r.} many {# r.} other {# l.}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# další odznak, zobrazit vše} few {+# další odznaky, zobrazit vše} many {+# dalšího odznaku, zobrazit vše} other {+# dalších odznaků, zobrazit vše}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Sbalit (# řádek)} few {Sbalit (# řádky)} many {Sbalit (# řádku)} other {Sbalit (# řádků)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Počet pro odznak a zeď: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Odznaky"
@@ -16568,6 +16582,11 @@ msgstr "Vyplňuje přihlašovací stránku za formulářem a je ztmavený, aby b
msgid "Filter"
msgstr "Filtr"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filtrovat odznaky"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Žádný návrh automatického doplňování"
msgid "No background"
msgstr "Bez pozadí"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Žádné odznaky neodpovídají."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Žádní zabanovaní uživatelé"
@@ -32974,6 +32998,11 @@ msgstr "Zobrazit \"Právě aktivní\" na domovské obrazovce, abyste viděli př
msgid "Show activity on other accounts"
msgstr "Zobrazit aktivitu na jiných účtech"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Zobrazit všechny odznaky"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/da/messages.po b/fluxer_app/src/features/i18n/locales/da/messages.po
index f04d9ee3a..aa1d84052 100644
--- a/fluxer_app/src/features/i18n/locales/da/messages.po
+++ b/fluxer_app/src/features/i18n/locales/da/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# aktivt abonnement} other {# aktive abonnementer}}
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# vedhæftet fil} other {# vedhæftede filer}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# badge passer} other {# badges passer}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# år} other {# år}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# badge mere, vis alle} other {+# badges mere, vis alle}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Skjul (# linje)} other {Skjul (# linjer)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Antal på badge og væg: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Badges"
@@ -16568,6 +16582,11 @@ msgstr "Fylder loginsiden bag formularen og gøres mørkere, så formularen er l
msgid "Filter"
msgstr "Filtrer"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filtrer badges"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Ingen forslag til autofuldførelse"
msgid "No background"
msgstr "Ingen baggrund"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Ingen badges passer."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Ingen udelukkede brugere"
@@ -32974,6 +32998,11 @@ msgstr "Vis Aktiv nu på startskærmen for at se venner, der er aktive i taleopk
msgid "Show activity on other accounts"
msgstr "Vis aktivitet på andre konti"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Vis alle badges"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/de/messages.po b/fluxer_app/src/features/i18n/locales/de/messages.po
index a59ee7a79..9952bd63c 100644
--- a/fluxer_app/src/features/i18n/locales/de/messages.po
+++ b/fluxer_app/src/features/i18n/locales/de/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# aktives Abo} other {# aktive Abos}}"
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# Anhang} other {# Anhänge}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# Abzeichen gefunden} other {# Abzeichen gefunden}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# J} other {# J}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# weiteres Abzeichen, alle anzeigen} other {+# weitere Abzeichen, alle anzeigen}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Einklappen (# Zeile)} other {Einklappen (# Zeilen)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Anzahl für Abzeichen und Wand: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Abzeichen"
@@ -16568,6 +16582,11 @@ msgstr "Füllt die Anmeldeseite hinter dem Formular aus und wird abgedunkelt, da
msgid "Filter"
msgstr "Filter"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Abzeichen filtern"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Kein Vorschlag zur Autovervollständigung"
msgid "No background"
msgstr "Kein Hintergrund"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Keine Abzeichen gefunden."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Keine gebannten Nutzer"
@@ -32974,6 +32998,11 @@ msgstr "Zeige \"Jetzt aktiv\" auf dem Startbildschirm an, um Freunde zu sehen, d
msgid "Show activity on other accounts"
msgstr "Aktivität auf anderen Konten anzeigen"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Alle Abzeichen anzeigen"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/el/messages.po b/fluxer_app/src/features/i18n/locales/el/messages.po
index 17e040987..3e138853a 100644
--- a/fluxer_app/src/features/i18n/locales/el/messages.po
+++ b/fluxer_app/src/features/i18n/locales/el/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# ενεργή συνδρομή} other {# ενερ
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# συνημμένο} other {# συνημμένα}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# σήμα ταιριάζει} other {# σήματα ταιριάζουν}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# χρ} other {# χρ}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# ακόμα σήμα, εμφάνιση όλων} other {+# ακόμα σήματα, εμφάνιση όλων}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Σύμπτυξη (# γραμμή)} other {Σύμπτυξη (# γραμμές)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Αριθμός για το σήμα και τον τοίχο: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Σήματα"
@@ -16568,6 +16582,11 @@ msgstr "Καλύπτει τη σελίδα σύνδεσης πίσω από τη
msgid "Filter"
msgstr "Φίλτρο"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Φιλτράρισμα σημάτων"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Καμία πρόταση αυτόματης συμπλήρωσης"
msgid "No background"
msgstr "Χωρίς φόντο"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Κανένα σήμα δεν ταιριάζει."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Δεν υπάρχουν αποκλεισμένοι χρήστες"
@@ -32974,6 +32998,11 @@ msgstr "Εμφάνιση \"Ενεργός τώρα\" στην αρχική οθ
msgid "Show activity on other accounts"
msgstr "Εμφάνιση δραστηριότητας σε άλλους λογαριασμούς"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Εμφάνιση όλων των σημάτων"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/en-GB/messages.po b/fluxer_app/src/features/i18n/locales/en-GB/messages.po
index 520eeca03..b3c7fad17 100644
--- a/fluxer_app/src/features/i18n/locales/en-GB/messages.po
+++ b/fluxer_app/src/features/i18n/locales/en-GB/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# active subscription} other {# active subscription
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# attachment} other {# attachments}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# badge matches} other {# badges match}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {#y} other {#y}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Badge and wall count: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Badges"
@@ -16568,6 +16582,11 @@ msgstr "Fills the sign-in page behind the form, darkened so the form stays easy
msgid "Filter"
msgstr "Filter"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filter badges"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "No autocomplete suggestion"
msgid "No background"
msgstr "No background"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "No badges match."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "No banned users"
@@ -32974,6 +32998,11 @@ msgstr "Show active now on the home screen to surface friends active in voice. Y
msgid "Show activity on other accounts"
msgstr "Show activity on other accounts"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Show all badges"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/en-US/messages.po b/fluxer_app/src/features/i18n/locales/en-US/messages.po
index 575dce11d..61a53af18 100644
--- a/fluxer_app/src/features/i18n/locales/en-US/messages.po
+++ b/fluxer_app/src/features/i18n/locales/en-US/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# active subscription} other {# active subscription
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# attachment} other {# attachments}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# badge matches} other {# badges match}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {#y} other {#y}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Badge and wall count: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Badges"
@@ -16568,6 +16582,11 @@ msgstr "Fills the sign-in page behind the form, darkened so the form stays easy
msgid "Filter"
msgstr "Filter"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filter badges"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "No autocomplete suggestion"
msgid "No background"
msgstr "No background"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "No badges match."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "No banned users"
@@ -32974,6 +32998,11 @@ msgstr "Show active now on the home screen to surface friends active in voice. Y
msgid "Show activity on other accounts"
msgstr "Show activity on other accounts"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Show all badges"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/es-419/messages.po b/fluxer_app/src/features/i18n/locales/es-419/messages.po
index 13c94af52..23d4f4750 100644
--- a/fluxer_app/src/features/i18n/locales/es-419/messages.po
+++ b/fluxer_app/src/features/i18n/locales/es-419/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# suscripción activa} other {# suscripciones activ
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# archivo adjunto} other {# archivos adjuntos}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# insignia coincide} other {# insignias coinciden}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# a} other {# a}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# insignia más, mostrar todas} other {+# insignias más, mostrar todas}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Contraer (# línea)} other {Contraer (# líneas)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Cantidad para la insignia y el muro: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Insignias"
@@ -16568,6 +16582,11 @@ msgstr "Ocupa la página de inicio de sesión detrás del formulario, oscurecido
msgid "Filter"
msgstr "Filtrar"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filtrar insignias"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Ninguna sugerencia de autocompletar"
msgid "No background"
msgstr "Sin fondo"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Ninguna insignia coincide."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "No hay usuarios baneados"
@@ -32974,6 +32998,11 @@ msgstr "Muestra \"Activo ahora\" en la pantalla de inicio para ver a los amigos
msgid "Show activity on other accounts"
msgstr "Mostrar actividad en otras cuentas"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Mostrar todas las insignias"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/es-ES/messages.po b/fluxer_app/src/features/i18n/locales/es-ES/messages.po
index d0a3deebc..e0d1eabe6 100644
--- a/fluxer_app/src/features/i18n/locales/es-ES/messages.po
+++ b/fluxer_app/src/features/i18n/locales/es-ES/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# suscripción activa} other {# suscripciones activ
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# archivo adjunto} other {# archivos adjuntos}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# insignia coincide} other {# insignias coinciden}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# a} many {# a} other {# a}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# insignia más, mostrar todas} other {+# insignias más, mostrar todas}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Contraer (# línea)} other {Contraer (# líneas)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Cantidad para la insignia y el muro: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Insignias"
@@ -16568,6 +16582,11 @@ msgstr "Ocupa la página de inicio de sesión detrás del formulario, oscurecido
msgid "Filter"
msgstr "Filtrar"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filtrar insignias"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Ninguna sugerencia de autocompletar"
msgid "No background"
msgstr "Sin fondo"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Ninguna insignia coincide."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "No hay usuarios baneados"
@@ -32974,6 +32998,11 @@ msgstr "Muestra \"Activo ahora\" en la pantalla de inicio para ver a los amigos
msgid "Show activity on other accounts"
msgstr "Mostrar actividad en otras cuentas"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Mostrar todas las insignias"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/fi/messages.po b/fluxer_app/src/features/i18n/locales/fi/messages.po
index af40f150d..d2d788f1d 100644
--- a/fluxer_app/src/features/i18n/locales/fi/messages.po
+++ b/fluxer_app/src/features/i18n/locales/fi/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# aktiivinen tilaus} other {# aktiivista tilausta}}
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# liite} other {# liitettä}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# merkki vastaa hakua} other {# merkkiä vastaa hakua}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# v} other {# v}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# merkki lisää, näytä kaikki} other {+# merkkiä lisää, näytä kaikki}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Tiivistä (# rivi)} other {Tiivistä (# riviä)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Merkin ja seinän passimäärä: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Merkit"
@@ -16568,6 +16582,11 @@ msgstr "Täyttää kirjautumissivun lomakkeen takana, ja sitä tummennetaan, jot
msgid "Filter"
msgstr "Suodatin"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Suodata merkkejä"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Ei automaattista täydennysehdotusta"
msgid "No background"
msgstr "Ei taustakuvaa"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Yksikään merkki ei vastaa hakua."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Ei porttikiellettyjä käyttäjiä"
@@ -32974,6 +32998,11 @@ msgstr "Näytä Aktiiviset nyt -paneeli aloitusnäytöllä, niin löydät ääni
msgid "Show activity on other accounts"
msgstr "Näytä toiminta muilla tileillä"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Näytä kaikki merkit"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/fr/messages.po b/fluxer_app/src/features/i18n/locales/fr/messages.po
index 30b51c832..4bbc44319 100644
--- a/fluxer_app/src/features/i18n/locales/fr/messages.po
+++ b/fluxer_app/src/features/i18n/locales/fr/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# abonnement actif} other {# abonnements actifs}}"
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# pièce jointe} other {# pièces jointes}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# badge correspond} other {# badges correspondent}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# an} many {# ans} other {# ans}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# badge de plus, tout afficher} other {+# badges de plus, tout afficher}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Réduire (# ligne)} other {Réduire (# lignes)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Nombre pour le badge et le mur : {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Badges"
@@ -16568,6 +16582,11 @@ msgstr "Remplit la page de connexion derrière le formulaire. L'image est assomb
msgid "Filter"
msgstr "Filtrer"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filtrer les badges"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Aucune suggestion de saisie semi-automatique"
msgid "No background"
msgstr "Pas d'arrière-plan"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Aucun badge ne correspond."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Aucun utilisateur banni"
@@ -32974,6 +32998,11 @@ msgstr "Affichez « Actif en ce moment » sur l’écran d’accueil pour retrou
msgid "Show activity on other accounts"
msgstr "Afficher l'activité sur d'autres comptes"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Afficher tous les badges"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/he/messages.po b/fluxer_app/src/features/i18n/locales/he/messages.po
index 5da047a1a..00c22e50f 100644
--- a/fluxer_app/src/features/i18n/locales/he/messages.po
+++ b/fluxer_app/src/features/i18n/locales/he/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# מנוי פעיל} other {# מנויים פעיל
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# קובץ מצורף} other {# קבצים מצורפים}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {תג אחד תואם} other {# תגים תואמים}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# שנ׳} two {# שנ׳} other {# שנ׳}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# תג נוסף, הצגת הכול} other {+# תגים נוספים, הצגת הכול}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {כווץ (שורה אחת)} other {כווץ (# שורות)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "מספר לתג ולקיר: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "תגים"
@@ -16568,6 +16582,11 @@ msgstr "ממלא את דף ההתחברות מאחורי הטופס, בהחשכ
msgid "Filter"
msgstr "סינון"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "סינון תגים"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "אין הצעות להשלמה אוטומטית"
msgid "No background"
msgstr "ללא רקע"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "אין תגים תואמים."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "אין משתמשים חסומים"
@@ -32974,6 +32998,11 @@ msgstr "הצג \"פעיל עכשיו\" במסך הבית כדי לראות חב
msgid "Show activity on other accounts"
msgstr "הצג פעילות בחשבונות אחרים"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "הצגת כל התגים"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/hi/messages.po b/fluxer_app/src/features/i18n/locales/hi/messages.po
index 4b70c34ea..a28d589ba 100644
--- a/fluxer_app/src/features/i18n/locales/hi/messages.po
+++ b/fluxer_app/src/features/i18n/locales/hi/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# सक्रिय सदस्यता} other {
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# अटैचमेंट} other {# अटैचमेंट}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# बैज मेल खाता है} other {# बैज मेल खाते हैं}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# साल} other {# साल}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# और बैज, सभी दिखाएँ} other {+# और बैज, सभी दिखाएँ}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {संक्षिप्त करें (# लाइन)} other {संक्षिप्त करें (# लाइनें)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "बैज और दीवार के लिए गिनती: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "बैज"
@@ -16568,6 +16582,11 @@ msgstr "साइन-इन पेज पर फ़ॉर्म के पीछ
msgid "Filter"
msgstr "फ़िल्टर"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "बैज फ़िल्टर करें"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "कोई ऑटो-कम्प्लीट सुझाव नही
msgid "No background"
msgstr "कोई बैकग्राउंड नहीं"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "कोई बैज मेल नहीं खाता।"
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "कोई बैन किया गया यूज़र नहीं"
@@ -32974,6 +32998,11 @@ msgstr "होम स्क्रीन पर 'अभी सक्रिय'
msgid "Show activity on other accounts"
msgstr "अन्य खातों पर गतिविधि दिखाएँ"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "सभी बैज दिखाएँ"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/hr/messages.po b/fluxer_app/src/features/i18n/locales/hr/messages.po
index c80454f42..519c9eaf7 100644
--- a/fluxer_app/src/features/i18n/locales/hr/messages.po
+++ b/fluxer_app/src/features/i18n/locales/hr/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# aktivna pretplata} few {# aktivne pretplate} othe
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# privitak} few {# privitka} other {# privitaka}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# značka odgovara} few {# značke odgovaraju} other {# znački odgovara}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# g.} few {# g.} other {# g.}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# značka više, prikaži sve} few {+# značke više, prikaži sve} other {+# znački više, prikaži sve}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Sažmi (# redak)} few {Sažmi (# retka)} other {Sažmi (# redaka)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Broj za značku i zid: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Značke"
@@ -16568,6 +16582,11 @@ msgstr "Ispunjava stranicu za prijavu iza obrasca i zatamnjena je kako bi obraza
msgid "Filter"
msgstr "Filtar"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filtriraj značke"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Nema prijedloga za automatsko dovršavanje"
msgid "No background"
msgstr "Bez pozadine"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Nijedna značka ne odgovara."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Nema zabranjenih korisnika"
@@ -32974,6 +32998,11 @@ msgstr "Prikažite \"Aktivno sada\" na početnom zaslonu kako biste vidjeli prij
msgid "Show activity on other accounts"
msgstr "Prikaži aktivnost na drugim računima"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Prikaži sve značke"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/hu/messages.po b/fluxer_app/src/features/i18n/locales/hu/messages.po
index 6b020f081..7697faea7 100644
--- a/fluxer_app/src/features/i18n/locales/hu/messages.po
+++ b/fluxer_app/src/features/i18n/locales/hu/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# aktív feliratkozás} other {# aktív feliratkoz
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# melléklet} other {# melléklet}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# jelvény egyezik} other {# jelvény egyezik}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# év} other {# év}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# további jelvény, összes megjelenítése} other {+# további jelvény, összes megjelenítése}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Összecsukás (# sor)} other {Összecsukás (# sor)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "A jelvényen és a falon számított mennyiség: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Jelvények"
@@ -16568,6 +16582,11 @@ msgstr "Kitölti a bejelentkezési oldalt az űrlap mögött, és sötétítve j
msgid "Filter"
msgstr "Szűrő"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Jelvények szűrése"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Nincs automatikus kiegészítési javaslat"
msgid "No background"
msgstr "Nincs háttér"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Nincs egyező jelvény."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Nincsenek kitiltott felhasználók"
@@ -32974,6 +32998,11 @@ msgstr "Jelenítsd meg a Most aktívak részt a kezdőképernyőn, hogy lásd a
msgid "Show activity on other accounts"
msgstr "Tevékenység más fiókokon"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Az összes jelvény megjelenítése"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/id/messages.po b/fluxer_app/src/features/i18n/locales/id/messages.po
index edde4166a..a1ca8d03c 100644
--- a/fluxer_app/src/features/i18n/locales/id/messages.po
+++ b/fluxer_app/src/features/i18n/locales/id/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# langganan aktif} other {# langganan aktif}}"
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# lampiran} other {# lampiran}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, other {# lencana cocok}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# thn} other {# thn}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, other {+# lencana lagi, tampilkan semua}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Ciutkan (# baris)} other {Ciutkan (# baris)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Jumlah untuk lencana dan dinding: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Lencana"
@@ -16568,6 +16582,11 @@ msgstr "Mengisi halaman masuk di belakang formulir, digelapkan agar formulir tet
msgid "Filter"
msgstr "Filter"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filter lencana"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Tidak ada saran pelengkapan otomatis"
msgid "No background"
msgstr "Tanpa latar belakang"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Tidak ada lencana yang cocok."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Tidak ada pengguna yang diblokir"
@@ -32974,6 +32998,11 @@ msgstr "Tampilkan status aktif sekarang di layar utama untuk memunculkan teman y
msgid "Show activity on other accounts"
msgstr "Tampilkan aktivitas di akun lain"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Tampilkan semua lencana"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/it/messages.po b/fluxer_app/src/features/i18n/locales/it/messages.po
index 296ff96cf..372967aa6 100644
--- a/fluxer_app/src/features/i18n/locales/it/messages.po
+++ b/fluxer_app/src/features/i18n/locales/it/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# abbonamento attivo} other {# abbonamenti attivi}}
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# allegato} other {# allegati}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# badge corrisponde} other {# badge corrispondono}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# anno} many {# anni} other {# anni}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# altro badge, mostra tutti} other {+# altri badge, mostra tutti}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Comprimi (# riga)} other {Comprimi (# righe)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Conteggio per badge e muro: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Badge"
@@ -16568,6 +16582,11 @@ msgstr "Riempie la pagina di accesso dietro il modulo ed è scurita in modo che
msgid "Filter"
msgstr "Filtra"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filtra badge"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Nessun suggerimento di completamento automatico"
msgid "No background"
msgstr "Nessuno sfondo"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Nessun badge corrisponde."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Nessun utente bannato"
@@ -32974,6 +32998,11 @@ msgstr "Mostra \"Attivi ora\" nella schermata Home per vedere gli amici attivi n
msgid "Show activity on other accounts"
msgstr "Mostra attività su altri account"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Mostra tutti i badge"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/ja/messages.po b/fluxer_app/src/features/i18n/locales/ja/messages.po
index 77ad32f38..c36d6ea29 100644
--- a/fluxer_app/src/features/i18n/locales/ja/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ja/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, other {#件の有効なサブスクリプション}}"
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {#件の添付ファイル} other {#件の添付ファイル}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, other {#個のバッジが一致}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {#年} other {#年}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, other {+#個のバッジ、すべて表示}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {折りたたむ(#行)} other {折りたたむ(#行)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "バッジとウォールの枚数:{count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "バッジ"
@@ -16568,6 +16582,11 @@ msgstr "サインイン画面のフォームの背後全体に表示されます
msgid "Filter"
msgstr "フィルター"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "バッジを絞り込む"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "入力候補なし"
msgid "No background"
msgstr "背景なし"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "一致するバッジはありません。"
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "BANしたユーザーはいません"
@@ -32974,6 +32998,11 @@ msgstr "ホーム画面に「オンライン中」を表示して、通話中の
msgid "Show activity on other accounts"
msgstr "他のアカウントのアクティビティを表示"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "すべてのバッジを表示"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/ko/messages.po b/fluxer_app/src/features/i18n/locales/ko/messages.po
index 3b6bb3373..0e9e6575a 100644
--- a/fluxer_app/src/features/i18n/locales/ko/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ko/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {#개 활성 구독} other {#개 활성 구독}}"
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {#개 첨부파일} other {#개 첨부파일}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, other {배지 #개 일치}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, other {#년}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, other {+#개 배지 더 있음, 모두 보기}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {접기 (#줄)} other {접기 (#줄)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "배지와 벽에 표시되는 수: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "배지"
@@ -16568,6 +16582,11 @@ msgstr "로그인 페이지에서 양식 뒤를 가득 채우며, 양식이 잘
msgid "Filter"
msgstr "필터"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "배지 필터"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "자동 완성 제안 없음"
msgid "No background"
msgstr "배경 없음"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "일치하는 배지가 없어요."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "차단된 사용자 없음"
@@ -32974,6 +32998,11 @@ msgstr "홈 화면에 지금 활동 중을 표시하면 음성 채널에 있는
msgid "Show activity on other accounts"
msgstr "다른 계정의 활동 보기"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "모든 배지 보기"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/lt/messages.po b/fluxer_app/src/features/i18n/locales/lt/messages.po
index 9407bdb0e..d5f9ebacd 100644
--- a/fluxer_app/src/features/i18n/locales/lt/messages.po
+++ b/fluxer_app/src/features/i18n/locales/lt/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# aktyvi prenumerata} few {# aktyvios prenumeratos}
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# priedas} few {# priedai} other {# priedų}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# ženklelis atitinka} few {# ženkleliai atitinka} many {# ženklelio atitinka} other {# ženklelių atitinka}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# m.} few {# m.} many {# m.} other {# m.}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# ženklelis daugiau, rodyti visus} few {+# ženkleliai daugiau, rodyti visus} many {+# ženklelio daugiau, rodyti visus} other {+# ženklelių daugiau, rodyti visus}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Sutraukti (# eilutė)} few {Sutraukti (# eilutės)} other {Sutraukti (# eilučių)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Ženklelio ir sienos skaičius: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Ženkleliai"
@@ -16568,6 +16582,11 @@ msgstr "Užpildo prisijungimo puslapį už formos ir yra patamsinamas, kad form
msgid "Filter"
msgstr "Filtruoti"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filtruoti ženklelius"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24263,6 +24282,11 @@ msgstr "Nėra automatinio užbaigimo pasiūlymų"
msgid "No background"
msgstr "Be fono"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Nėra atitinkančių ženklelių."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Nėra užblokuotų narių"
@@ -32975,6 +32999,11 @@ msgstr "Rodyti „Aktyvūs dabar“ pagrindiniame ekrane, kad matytumėte draugu
msgid "Show activity on other accounts"
msgstr "Rodyti veiklą kitose paskyrose"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Rodyti visus ženklelius"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/nl/messages.po b/fluxer_app/src/features/i18n/locales/nl/messages.po
index 094b57457..64bc9da73 100644
--- a/fluxer_app/src/features/i18n/locales/nl/messages.po
+++ b/fluxer_app/src/features/i18n/locales/nl/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# actief abonnement} other {# actieve abonnementen}
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# bijlage} other {# bijlagen}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# badge gevonden} other {# badges gevonden}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# jr} other {# jr}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# badge meer, alles tonen} other {+# badges meer, alles tonen}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Inklappen (# regel)} other {Inklappen (# regels)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Aantal voor badge en muur: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Badges"
@@ -16568,6 +16582,11 @@ msgstr "Vult de inlogpagina achter het formulier en wordt donkerder gemaakt zoda
msgid "Filter"
msgstr "Filteren"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Badges filteren"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Geen automatische aanvulling"
msgid "No background"
msgstr "Geen achtergrond"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Geen badges gevonden."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Geen verbannen gebruikers"
@@ -32974,6 +32998,11 @@ msgstr "Toon Nu actief op het startscherm om vrienden te zien die actief zijn in
msgid "Show activity on other accounts"
msgstr "Activiteit op andere accounts weergeven"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Alle badges tonen"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/no/messages.po b/fluxer_app/src/features/i18n/locales/no/messages.po
index a42fe9c0c..cea23579f 100644
--- a/fluxer_app/src/features/i18n/locales/no/messages.po
+++ b/fluxer_app/src/features/i18n/locales/no/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# aktivt abonnement} other {# aktive abonnementer}}
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# vedlegg} other {# vedlegg}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# merke passer} other {# merker passer}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# år} other {# år}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# merke til, vis alle} other {+# merker til, vis alle}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Skjul (# linje)} other {Skjul (# linjer)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Antall på merket og veggen: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Merker"
@@ -16568,6 +16582,11 @@ msgstr "Fyller påloggingssiden bak skjemaet og gjøres mørkere slik at skjemae
msgid "Filter"
msgstr "Filter"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filtrer merker"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Ingen autofullføringsforslag"
msgid "No background"
msgstr "Ingen bakgrunn"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Ingen merker passer."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Ingen utestengte brukere"
@@ -32974,6 +32998,11 @@ msgstr "Vis «Aktiv nå» på startskjermen for å se venner som er aktive i tal
msgid "Show activity on other accounts"
msgstr "Vis aktivitet på andre kontoer"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Vis alle merker"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/pl/messages.po b/fluxer_app/src/features/i18n/locales/pl/messages.po
index 24428fe4a..0211c6c6b 100644
--- a/fluxer_app/src/features/i18n/locales/pl/messages.po
+++ b/fluxer_app/src/features/i18n/locales/pl/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# aktywna subskrypcja} few {# aktywne subskrypcje}
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# załącznik} few {# załączniki} many {# załączników} other {# załączników}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# pasująca odznaka} few {# pasujące odznaki} many {# pasujących odznak} other {# pasującej odznaki}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# r.} few {# l.} many {# l.} other {# r.}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# odznaka więcej, pokaż wszystkie} few {+# odznaki więcej, pokaż wszystkie} many {+# odznak więcej, pokaż wszystkie} other {+# odznaki więcej, pokaż wszystkie}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Zwiń (# wiersz)} few {Zwiń (# wiersze)} many {Zwiń (# wierszy)} other {Zwiń (# wiersza)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Liczba na odznace i ścianie: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Odznaki"
@@ -16568,6 +16582,11 @@ msgstr "Wypełnia stronę logowania za formularzem i jest przyciemnione, aby for
msgid "Filter"
msgstr "Filtruj"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filtruj odznaki"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Brak sugestii autouzupełniania"
msgid "No background"
msgstr "Brak tła"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Brak pasujących odznak."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Brak zbanowanych użytkowników"
@@ -32974,6 +32998,11 @@ msgstr "Pokaż sekcję „Aktywni teraz” na ekranie głównym, aby łatwiej zn
msgid "Show activity on other accounts"
msgstr "Pokaż aktywność na innych kontach"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Pokaż wszystkie odznaki"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/pt-BR/messages.po b/fluxer_app/src/features/i18n/locales/pt-BR/messages.po
index 40f6dbb56..b3fe5f1ac 100644
--- a/fluxer_app/src/features/i18n/locales/pt-BR/messages.po
+++ b/fluxer_app/src/features/i18n/locales/pt-BR/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, =0 {# assinaturas ativas} one {# assinatura ativa} other
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, =0 {# anexos} one {# anexo} other {# anexos}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# insígnia corresponde} other {# insígnias correspondem}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# ano} many {# anos} other {# anos}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# insígnia a mais, mostrar todas} other {+# insígnias a mais, mostrar todas}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, =0 {Recolher (# linhas)} one {Recolher (# linha)} other {Recolher (# linhas)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Quantidade para o selo e o mural: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Selos"
@@ -16568,6 +16582,11 @@ msgstr "Preenche a página de login atrás do formulário e fica escurecida para
msgid "Filter"
msgstr "Filtrar"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filtrar selos"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Nenhuma sugestão de preenchimento automático"
msgid "No background"
msgstr "Sem plano de fundo"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Nenhuma insígnia corresponde."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Nenhum usuário banido"
@@ -32974,6 +32998,11 @@ msgstr "Mostre a seção Ativos agora na tela inicial para encontrar amigos em c
msgid "Show activity on other accounts"
msgstr "Mostrar atividade em outras contas"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Mostrar todos os selos"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/ro/messages.po b/fluxer_app/src/features/i18n/locales/ro/messages.po
index 5cadd40e3..502a311c1 100644
--- a/fluxer_app/src/features/i18n/locales/ro/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ro/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# abonament activ} few {# abonamente active} other
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# atașament} few {# atașamente} other {# de atașamente}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# insignă se potrivește} few {# insigne se potrivesc} other {# de insigne se potrivesc}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# a} few {# a} other {# a}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# insignă în plus, arată toate} few {+# insigne în plus, arată toate} other {+# de insigne în plus, arată toate}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Restrânge (# linie)} few {Restrânge (# linii)} other {Restrânge (# de linii)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Număr pentru insignă și perete: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Insigne"
@@ -16568,6 +16582,11 @@ msgstr "Umple pagina de conectare în spatele formularului și este întunecată
msgid "Filter"
msgstr "Filtrare"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filtrează insignele"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Nicio sugestie de completare automată"
msgid "No background"
msgstr "Fără fundal"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Nicio insignă nu se potrivește."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Niciun utilizator banat"
@@ -32974,6 +32998,11 @@ msgstr "Afișează „Activ acum” pe ecranul principal pentru a vedea prieteni
msgid "Show activity on other accounts"
msgstr "Afișează activitatea pe alte conturi"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Afișează toate insignele"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/ru/messages.po b/fluxer_app/src/features/i18n/locales/ru/messages.po
index c51cf989e..7b6cef345 100644
--- a/fluxer_app/src/features/i18n/locales/ru/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ru/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# активная подписка} few {# акт
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# вложение} few {# вложения} many {# вложений} other {# вложений}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {Найден # значок} few {Найдено # значка} many {Найдено # значков} other {Найдено # значка}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# г.} few {# г.} many {# г.} other {# г.}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# значок, показать все} few {+# значка, показать все} many {+# значков, показать все} other {+# значка, показать все}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Свернуть (# строка)} few {Свернуть (# строки)} many {Свернуть (# строк)} other {Свернуть (# строк)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Количество для значка и стены: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Значки"
@@ -16568,6 +16582,11 @@ msgstr "Заполняет страницу входа за формой и за
msgid "Filter"
msgstr "Фильтр"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Фильтр значков"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Нет вариантов автозаполнения"
msgid "No background"
msgstr "Без фона"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Подходящих значков нет."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Забаненных пользователей нет"
@@ -32974,6 +32998,11 @@ msgstr "Показывать раздел «Сейчас онлайн» на г
msgid "Show activity on other accounts"
msgstr "Показать активность в других аккаунтах"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Показать все значки"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/sv-SE/messages.po b/fluxer_app/src/features/i18n/locales/sv-SE/messages.po
index 5fe653c70..c5c0ddf68 100644
--- a/fluxer_app/src/features/i18n/locales/sv-SE/messages.po
+++ b/fluxer_app/src/features/i18n/locales/sv-SE/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# aktivt abonnemang} other {# aktiva abonnemang}}"
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# bilaga} other {# bilagor}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# märke matchar} other {# märken matchar}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# år} other {# år}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# märke till, visa alla} other {+# märken till, visa alla}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Dölj (# rad)} other {Dölj (# rader)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Antal på märket och väggen: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Märken"
@@ -16568,6 +16582,11 @@ msgstr "Fyller inloggningssidan bakom formuläret och mörkas så att formuläre
msgid "Filter"
msgstr "Filtrera"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Filtrera märken"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Inget förslag för automatisk komplettering"
msgid "No background"
msgstr "Ingen bakgrund"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Inga märken matchar."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Inga bannlysta användare"
@@ -32974,6 +32998,11 @@ msgstr "Visa Aktiva nu på startskärmen för att se vänner som är aktiva i r
msgid "Show activity on other accounts"
msgstr "Visa aktivitet på andra konton"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Visa alla märken"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/th/messages.po b/fluxer_app/src/features/i18n/locales/th/messages.po
index eaf8f3ba9..0b89fe197 100644
--- a/fluxer_app/src/features/i18n/locales/th/messages.po
+++ b/fluxer_app/src/features/i18n/locales/th/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {การสมัครรับการแจ้
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {ไฟล์แนบ # รายการ} other {ไฟล์แนบ # รายการ}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, other {ตรงกัน # เหรียญตรา}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, other {#ปี}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, other {+# เหรียญตราเพิ่มเติม แสดงทั้งหมด}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {ย่อ (# บรรทัด)} other {ย่อ (# บรรทัด)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "จำนวนสำหรับป้ายและกำแพง: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "ป้าย"
@@ -16568,6 +16582,11 @@ msgstr "แสดงเต็มหน้าลงชื่อเข้าใช
msgid "Filter"
msgstr "ตัวกรอง"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "กรองป้าย"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "ไม่มีคำแนะนำการเติมข้อคว
msgid "No background"
msgstr "ไม่มีพื้นหลัง"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "ไม่มีเหรียญตราที่ตรงกัน"
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "ไม่มีผู้ใช้ที่ถูกแบน"
@@ -32974,6 +32998,11 @@ msgstr "แสดงสถานะกำลังใช้งานบนหน
msgid "Show activity on other accounts"
msgstr "แสดงกิจกรรมในบัญชีอื่น"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "แสดงป้ายทั้งหมด"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/tr/messages.po b/fluxer_app/src/features/i18n/locales/tr/messages.po
index 5867f80e0..c43c32f98 100644
--- a/fluxer_app/src/features/i18n/locales/tr/messages.po
+++ b/fluxer_app/src/features/i18n/locales/tr/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# aktif abonelik} other {# aktif abonelik}}"
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# ek} other {# ek}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {# rozet eşleşiyor} other {# rozet eşleşiyor}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# y} other {# y}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# rozet daha, tümünü göster} other {+# rozet daha, tümünü göster}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Daralt (# satır)} other {Daralt (# satır)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Rozet ve duvar sayısı: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Rozetler"
@@ -16568,6 +16582,11 @@ msgstr "Giriş sayfasında formun arkasını doldurur ve form kolayca okunabilsi
msgid "Filter"
msgstr "Filtrele"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Rozetleri filtrele"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Otomatik tamamlama önerisi yok"
msgid "No background"
msgstr "Arka plan yok"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Eşleşen rozet yok."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Yasaklı kullanıcı yok"
@@ -32974,6 +32998,11 @@ msgstr "Sesli sohbette aktif olan arkadaşları öne çıkarmak için ana ekrand
msgid "Show activity on other accounts"
msgstr "Diğer hesaplardaki etkinliği göster"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Tüm rozetleri göster"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/uk/messages.po b/fluxer_app/src/features/i18n/locales/uk/messages.po
index 975fe504f..5787b2b9c 100644
--- a/fluxer_app/src/features/i18n/locales/uk/messages.po
+++ b/fluxer_app/src/features/i18n/locales/uk/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# активна підписка} few {# акти
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# вкладення} few {# вкладення} many {# вкладень} other {# вкладення}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, one {Знайдено # значок} few {Знайдено # значки} many {Знайдено # значків} other {Знайдено # значка}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {# р.} few {# р.} many {# р.} other {# р.}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, one {+# значок, показати всі} few {+# значки, показати всі} many {+# значків, показати всі} other {+# значка, показати всі}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Згорнути (# рядок)} few {Згорнути (# рядки)} many {Згорнути (# рядків)} other {Згорнути (# рядка)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Кількість для значка та стіни: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Значки"
@@ -16568,6 +16582,11 @@ msgstr "Заповнює сторінку входу за формою і зат
msgid "Filter"
msgstr "Фільтр"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Фільтр значків"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Немає підказок для автозаповнення"
msgid "No background"
msgstr "Без фону"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Немає відповідних значків."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Немає заблокованих користувачів"
@@ -32974,6 +32998,11 @@ msgstr "Показувати «Зараз активні» на головном
msgid "Show activity on other accounts"
msgstr "Показати активність в інших облікових записах"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Показати всі значки"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/vi/messages.po b/fluxer_app/src/features/i18n/locales/vi/messages.po
index 5a1fde8b6..b518fd19b 100644
--- a/fluxer_app/src/features/i18n/locales/vi/messages.po
+++ b/fluxer_app/src/features/i18n/locales/vi/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# đăng ký đang hoạt động} other {# đăng
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# tệp đính kèm} other {# tệp đính kèm}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, other {# huy hiệu khớp}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, other {# năm}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, other {+# huy hiệu khác, hiện tất cả}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {Thu gọn (# dòng)} other {Thu gọn (# dòng)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "Số lượng cho huy hiệu và tường: {count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "Huy hiệu"
@@ -16568,6 +16582,11 @@ msgstr "Phủ kín trang đăng nhập phía sau biểu mẫu, được làm t
msgid "Filter"
msgstr "Lọc"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "Lọc huy hiệu"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "Không có gợi ý tự động hoàn tất"
msgid "No background"
msgstr "Không có ảnh nền"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "Không có huy hiệu nào khớp."
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "Không có người dùng bị cấm"
@@ -32974,6 +32998,11 @@ msgstr "Hiển thị trạng thái hoạt động trên màn hình chính để
msgid "Show activity on other accounts"
msgstr "Hiển thị hoạt động trên các tài khoản khác"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "Hiện tất cả huy hiệu"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/zh-CN/messages.po b/fluxer_app/src/features/i18n/locales/zh-CN/messages.po
index 310695939..16dcd4b61 100644
--- a/fluxer_app/src/features/i18n/locales/zh-CN/messages.po
+++ b/fluxer_app/src/features/i18n/locales/zh-CN/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, other {# 个有效订阅}}"
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, other {# 个附件}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, other {# 个徽章匹配}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, other {#年}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, other {+# 个徽章,显示全部}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, other {收起(# 行)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "徽章和墙上的数量:{count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "徽章"
@@ -16568,6 +16582,11 @@ msgstr "铺满登录页面中表单后方的区域,并会调暗,让表单保
msgid "Filter"
msgstr "过滤"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "筛选徽章"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "无自动补全建议"
msgid "No background"
msgstr "无背景"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "没有匹配的徽章。"
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "暂无封禁用户"
@@ -32974,6 +32998,11 @@ msgstr "在首页显示“当前活跃”,方便发现正在语音中的好友
msgid "Show activity on other accounts"
msgstr "显示其他账号的动态"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "显示所有徽章"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/i18n/locales/zh-TW/messages.po b/fluxer_app/src/features/i18n/locales/zh-TW/messages.po
index f809e241f..3c1bd7ce2 100644
--- a/fluxer_app/src/features/i18n/locales/zh-TW/messages.po
+++ b/fluxer_app/src/features/i18n/locales/zh-TW/messages.po
@@ -1166,6 +1166,11 @@ msgstr "{count, plural, one {# 個啟用中的訂閱} other {# 個啟用中的
msgid "{count, plural, one {# attachment} other {# attachments}}"
msgstr "{count, plural, one {# 個附件} other {# 個附件}}"
+#. Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "{count, plural, one {# badge matches} other {# badges match}}"
+msgstr "{count, plural, other {# 個徽章符合}}"
+
#. Label on the collapsed block in the message list that hides messages from blocked users. count is how many messages are hidden; clicking the label reveals them.
#: src/features/channel/components/BlockedMessageGroups.tsx
msgid "{count, plural, one {# blocked message} other {# blocked messages}}"
@@ -1352,6 +1357,11 @@ msgctxt "short-relative-time"
msgid "{count, plural, one {#y} other {#y}}"
msgstr "{count, plural, one {#年} other {#年}}"
+#. Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "{count, plural, one {+# more badge, show all} other {+# more badges, show all}}"
+msgstr "{count, plural, other {+# 個徽章,顯示全部}}"
+
#: src/features/channel/components/embeds/attachments/TextualAttachmentPreviewFooter.tsx
msgid "{count, plural, one {Collapse (# line)} other {Collapse (# lines)}}"
msgstr "{count, plural, one {收合(# 行)} other {收合(# 行)}}"
@@ -2459,7 +2469,9 @@ msgid "/tts"
msgstr "/tts"
#. Badge on the forward modal preview thumbnail. count is the number of other attachments that the thumbnail does not show.
+#. Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.
#: src/features/messaging/components/modals/ForwardMessagePreview.tsx
+#: src/features/user/utils/UserMessageDescriptors.ts
msgid "+{count}"
msgstr "+{count}"
@@ -6115,6 +6127,8 @@ msgid "Badge and wall count: {count}"
msgstr "徽章和牆上的數量:{count}"
#. Title of the profile settings section that lists the badges you hold and lets you hide each one.
+#. Title of the window that lists every badge of a person or community.
+#: src/features/user/components/modals/BadgeListModal.tsx
#: src/features/user/utils/UserMessageDescriptors.ts
msgid "Badges"
msgstr "徽章"
@@ -16568,6 +16582,11 @@ msgstr "鋪滿登入頁面中表單後方的區域,並會調暗,讓表單維
msgid "Filter"
msgstr "篩選"
+#. Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "Filter badges"
+msgstr "篩選徽章"
+
#. Accessible label for the account-age filter chip on the community members page.
#: src/features/channel/components/guild_members_page/MembersTableHeaderRow.tsx
msgid "Filter by account creation date"
@@ -24262,6 +24281,11 @@ msgstr "沒有自動完成建議"
msgid "No background"
msgstr "無背景"
+#. Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.
+#: src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+msgid "No badges match."
+msgstr "沒有符合的徽章。"
+
#: src/features/guild/components/modals/guild_tabs/GuildBansTab.tsx
msgid "No banned users"
msgstr "沒有遭停權的使用者"
@@ -32974,6 +32998,11 @@ msgstr "在主畫面顯示「目前在線上」狀態,讓您看到正在語音
msgid "Show activity on other accounts"
msgstr "顯示其他帳號的活動"
+#. Tooltip for the +3 style button that opens the full list of badges.
+#: src/features/user/utils/UserMessageDescriptors.ts
+msgid "Show all badges"
+msgstr "顯示所有徽章"
+
#. Short label for an advanced media button preference.
#: src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedChatControls.tsx
msgid "Show attachment expiration indicator"
diff --git a/fluxer_app/src/features/user/components/modals/BadgeListModal.module.css b/fluxer_app/src/features/user/components/modals/BadgeListModal.module.css
new file mode 100644
index 000000000..ef1b2e8e4
--- /dev/null
+++ b/fluxer_app/src/features/user/components/modals/BadgeListModal.module.css
@@ -0,0 +1,67 @@
+/* SPDX-License-Identifier: AGPL-3.0-or-later */
+
+.list {
+ display: flex;
+ flex-direction: column;
+ gap: 0.25rem;
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+.row {
+ display: flex;
+ align-items: flex-start;
+ gap: 0.75rem;
+ border-radius: 0.375rem;
+ padding: 0.5rem;
+ color: inherit;
+ text-decoration: none;
+}
+
+a.row:hover {
+ background: var(--background-modifier-hover);
+ text-decoration: none;
+}
+
+.image {
+ flex-shrink: 0;
+ width: 2rem;
+ height: 2rem;
+ object-fit: contain;
+}
+
+.caption {
+ display: inline-flex;
+ flex-shrink: 0;
+ align-items: center;
+ justify-content: center;
+ min-width: 2rem;
+ height: 2rem;
+ color: var(--brand-primary-light);
+ font-weight: 700;
+ font-size: 1.25rem;
+ font-variant-numeric: tabular-nums;
+}
+
+.text {
+ display: flex;
+ min-width: 0;
+ flex-direction: column;
+ gap: 0.125rem;
+}
+
+.title {
+ color: var(--text-primary);
+ font-weight: 600;
+ font-size: 0.875rem;
+ line-height: 1.25rem;
+ overflow-wrap: anywhere;
+}
+
+.line {
+ color: var(--text-secondary);
+ font-size: 0.8125rem;
+ line-height: 1.125rem;
+ overflow-wrap: anywhere;
+}
diff --git a/fluxer_app/src/features/user/components/modals/BadgeListModal.tsx b/fluxer_app/src/features/user/components/modals/BadgeListModal.tsx
new file mode 100644
index 000000000..c8c0bcecf
--- /dev/null
+++ b/fluxer_app/src/features/user/components/modals/BadgeListModal.tsx
@@ -0,0 +1,92 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import * as Modal from '@app/features/app/components/dialogs/Modal';
+import {handleExternalLinkClick} from '@app/features/ui/utils/NativeUtils';
+import styles from '@app/features/user/components/modals/BadgeListModal.module.css';
+import {msg} from '@lingui/core/macro';
+import {useLingui} from '@lingui/react/macro';
+import {observer} from 'mobx-react-lite';
+
+const BADGES_DESCRIPTOR = msg({
+ message: 'Badges',
+ comment: 'Title of the window that lists every badge of a person or community.',
+});
+
+export interface BadgeListItem {
+ readonly key: string;
+ readonly imageUrl: string | null;
+ readonly caption: string | null;
+ readonly title: string;
+ readonly lines: ReadonlyArray<string>;
+ readonly href: string | null;
+}
+
+export const BadgeListModal = observer(function BadgeListModal({
+ items,
+ 'data-flx': dataFlx = 'user.badge-list-modal',
+}: {
+ readonly items: ReadonlyArray<BadgeListItem>;
+ readonly 'data-flx'?: string;
+}) {
+ const {i18n} = useLingui();
+ return (
+ <Modal.Root size="small" centered data-flx={`${dataFlx}.modal-root`}>
+ <Modal.Header title={i18n._(BADGES_DESCRIPTOR)} data-flx={`${dataFlx}.modal-header`} />
+ <Modal.Content data-flx={`${dataFlx}.modal-content`}>
+ <ul className={styles.list} data-flx={`${dataFlx}.list`}>
+ {items.map((item) => {
+ const body = (
+ <>
+ {item.imageUrl !== null ? (
+ <img
+ src={item.imageUrl}
+ alt=""
+ loading="lazy"
+ decoding="async"
+ className={styles.image}
+ data-flx={`${dataFlx}.image`}
+ />
+ ) : (
+ <span className={styles.caption} aria-hidden="true" data-flx={`${dataFlx}.caption`}>
+ {item.caption}
+ </span>
+ )}
+ <span className={styles.text} data-flx={`${dataFlx}.text`}>
+ <span className={styles.title} data-flx={`${dataFlx}.title`}>
+ {item.title}
+ </span>
+ {item.lines.map((line) => (
+ <span key={line} className={styles.line} data-flx={`${dataFlx}.line`}>
+ {line}
+ </span>
+ ))}
+ </span>
+ </>
+ );
+ const href = item.href;
+ return (
+ <li key={item.key} data-flx={`${dataFlx}.item`}>
+ {href ? (
+ <a
+ href={href}
+ target="_blank"
+ rel="noopener noreferrer"
+ className={styles.row}
+ onClick={(event) => handleExternalLinkClick(event, href)}
+ data-flx={`${dataFlx}.link`}
+ >
+ {body}
+ </a>
+ ) : (
+ <div className={styles.row} data-flx={`${dataFlx}.row`}>
+ {body}
+ </div>
+ )}
+ </li>
+ );
+ })}
+ </ul>
+ </Modal.Content>
+ </Modal.Root>
+ );
+});
diff --git a/fluxer_app/src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.module.css b/fluxer_app/src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.module.css
index 805af890b..86c1af871 100644
--- a/fluxer_app/src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.module.css
+++ b/fluxer_app/src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.module.css
@@ -93,3 +93,19 @@
align-items: center;
gap: 0.75rem;
}
+
+.filter {
+ margin-bottom: 0.75rem;
+}
+
+.srOnly {
+ position: absolute;
+ width: 0.0625rem;
+ height: 0.0625rem;
+ padding: 0;
+ margin: -0.0625rem;
+ overflow: hidden;
+ clip: rect(0, 0, 0, 0);
+ white-space: nowrap;
+ border: 0;
+}
diff --git a/fluxer_app/src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx b/fluxer_app/src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
index 68e6f4e6b..dd21695d7 100644
--- a/fluxer_app/src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
+++ b/fluxer_app/src/features/user/components/modals/tabs/my_profile_tab/ProfileBadgeSettings.tsx
@@ -4,7 +4,9 @@ import {SettingsSection} from '@app/features/app/components/dialogs/shared/Setti
import {OPERATOR_PASS_NAME} from '@app/features/app/config/I18nDisplayConstants';
import {TRY_AGAIN_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
import {getPremiumProductName} from '@app/features/premium/utils/PremiumUtils';
+import {remFromPx} from '@app/features/theme/layout/RemFromPx';
import {Button} from '@app/features/ui/button/Button';
+import {Input} from '@app/features/ui/components/form/FormInput';
import {Switch} from '@app/features/ui/components/form/FormSwitch';
import {Spinner} from '@app/features/ui/components/Spinner';
import {PROFILE_BADGES_SECTION_ID} from '@app/features/user/commands/UserSettingsModalCommands';
@@ -16,8 +18,9 @@ import type {OwnProfileBadgeResponse} from '@fluxer/schema/src/domains/user/Prof
import type {MessageDescriptor} from '@lingui/core';
import {msg} from '@lingui/core/macro';
import {useLingui} from '@lingui/react/macro';
+import {MagnifyingGlassIcon} from '@phosphor-icons/react';
import {observer} from 'mobx-react-lite';
-import {type ReactNode, useId} from 'react';
+import {type ReactNode, useId, useState} from 'react';
const BADGES_DESCRIPTION_DESCRIPTOR = msg({
message: 'Choose which badges other people see on your profile.',
@@ -38,6 +41,22 @@ const SHOW_BADGE_DESCRIPTOR = msg({
comment:
'Screen reader label for the switch next to one badge in the "Badges" profile settings. {badgeLabel} is the badge name, such as "Fluxer Staff" or "Operator Pass since November 14, 2026".',
});
+const FILTER_BADGES_DESCRIPTOR = msg({
+ message: 'Filter badges',
+ comment:
+ 'Placeholder and screen reader label of the text field above a long list of badges in the "Badges" profile settings. Typing in it shows only the badges whose name holds the text.',
+});
+const NO_BADGES_MATCH_DESCRIPTOR = msg({
+ message: 'No badges match.',
+ comment:
+ 'Shown under the badge filter in the "Badges" profile settings when the typed text matches none of your badges.',
+});
+const BADGE_FILTER_RESULTS_DESCRIPTOR = msg({
+ message: '{count, plural, one {# badge matches} other {# badges match}}',
+ comment:
+ 'Read out by screen readers while typing in the badge filter of the "Badges" profile settings, with the number of badges that match.',
+});
+const FILTER_THRESHOLD = 20;
const VISIONARY_NUMBER_NEEDS_VISIONARY_DESCRIPTOR = msg({
message: 'Shown only when your Visionary badge is visible and not masked.',
comment:
@@ -132,6 +151,8 @@ function BadgeArt({badge}: {badge: OwnProfileBadgeResponse}) {
<img
src={imageUrl}
alt=""
+ loading="lazy"
+ decoding="async"
className={styles.art}
style={badge.aspect_ratio ? {width: 'auto', aspectRatio: badge.aspect_ratio} : undefined}
data-flx="user.profile-badge-settings.art"
@@ -151,68 +172,100 @@ function BadgeList({
const hidden = new Set(hiddenProfileBadges);
const switchIdPrefix = useId();
const premiumProductName = getPremiumProductName();
+ const [filter, setFilter] = useState('');
+ const needle = filter.trim().toLocaleLowerCase();
+ const filtered =
+ needle === '' ? ownBadges : ownBadges.filter((badge) => badge.label.toLocaleLowerCase().includes(needle));
return (
- <ul className={styles.list} data-flx="user.profile-badge-settings.list">
- {ownBadges.map((badge) => {
- const shown = !hidden.has(badge.key);
- const switchId = `${switchIdPrefix}-${badge.key}`;
- const badgeProductName = badge.key === 'visionary' ? 'Visionary' : premiumProductName;
- const numberHasNoEffect =
- badge.key === 'visionary_number' && (hidden.has('visionary') || variants.premium_badge_masked);
- const badgeVariants = shown ? (BADGE_VARIANTS[badge.key] ?? []) : [];
- return (
- <li key={badge.key} className={styles.item} data-flx="user.profile-badge-settings.item">
- <div className={styles.row} data-flx="user.profile-badge-settings.row">
- <label htmlFor={switchId} className={styles.rowLabel} data-flx="user.profile-badge-settings.row-label">
- <span className={styles.artSlot} data-flx="user.profile-badge-settings.art-slot">
- <BadgeArt badge={badge} data-flx="user.profile-badge-settings.badge-art" />
- </span>
- <span className={styles.label} dir="auto" data-flx="user.profile-badge-settings.label">
- {badge.label}
- </span>
- </label>
- <Switch
- id={switchId}
- value={shown}
- onChange={(value) => onToggleHidden(badge.key, !value)}
- disabled={disabled || numberHasNoEffect}
- ariaLabel={i18n._(SHOW_BADGE_DESCRIPTOR, {badgeLabel: badge.label})}
- compact
- data-flx="user.profile-badge-settings.switch"
+ <>
+ {ownBadges.length > FILTER_THRESHOLD && (
+ <div className={styles.filter} data-flx="user.profile-badge-settings.filter">
+ <Input
+ placeholder={i18n._(FILTER_BADGES_DESCRIPTOR)}
+ leftIcon={
+ <MagnifyingGlassIcon
+ size={remFromPx(16)}
+ weight="bold"
+ data-flx="user.profile-badge-settings.filter-icon"
/>
- </div>
- {numberHasNoEffect && (
- <p className={styles.note} data-flx="user.profile-badge-settings.note">
- {i18n._(VISIONARY_NUMBER_NEEDS_VISIONARY_DESCRIPTOR)}
- </p>
- )}
- {badgeVariants.length > 0 && (
- <div className={styles.variants} data-flx="user.profile-badge-settings.variants">
- {badgeVariants.map((variant) => (
- <Switch
- key={variant.field}
- label={i18n._(variant.label, {
- premiumProductName: badgeProductName,
- operatorPassName: OPERATOR_PASS_NAME,
- })}
- description={
- variant.description
- ? i18n._(variant.description, {premiumProductName: badgeProductName})
- : undefined
- }
- value={variants[variant.field]}
- onChange={(value) => onToggleVariant(variant.field, value)}
- disabled={disabled}
- compact
- data-flx="user.profile-badge-settings.variant-switch"
- />
- ))}
+ }
+ value={filter}
+ onChange={(event) => setFilter(event.target.value)}
+ aria-label={i18n._(FILTER_BADGES_DESCRIPTOR)}
+ data-flx="user.profile-badge-settings.filter-input"
+ />
+ <span className={styles.srOnly} aria-live="polite" data-flx="user.profile-badge-settings.filter-results">
+ {needle === '' ? '' : i18n._(BADGE_FILTER_RESULTS_DESCRIPTOR, {count: filtered.length})}
+ </span>
+ </div>
+ )}
+ {filtered.length === 0 && (
+ <p className={styles.note} data-flx="user.profile-badge-settings.no-match">
+ {i18n._(NO_BADGES_MATCH_DESCRIPTOR)}
+ </p>
+ )}
+ <ul className={styles.list} data-flx="user.profile-badge-settings.list">
+ {filtered.map((badge) => {
+ const shown = !hidden.has(badge.key);
+ const switchId = `${switchIdPrefix}-${badge.key}`;
+ const badgeProductName = badge.key === 'visionary' ? 'Visionary' : premiumProductName;
+ const numberHasNoEffect =
+ badge.key === 'visionary_number' && (hidden.has('visionary') || variants.premium_badge_masked);
+ const badgeVariants = shown ? (BADGE_VARIANTS[badge.key] ?? []) : [];
+ return (
+ <li key={badge.key} className={styles.item} data-flx="user.profile-badge-settings.item">
+ <div className={styles.row} data-flx="user.profile-badge-settings.row">
+ <label htmlFor={switchId} className={styles.rowLabel} data-flx="user.profile-badge-settings.row-label">
+ <span className={styles.artSlot} data-flx="user.profile-badge-settings.art-slot">
+ <BadgeArt badge={badge} data-flx="user.profile-badge-settings.badge-art" />
+ </span>
+ <span className={styles.label} dir="auto" data-flx="user.profile-badge-settings.label">
+ {badge.label}
+ </span>
+ </label>
+ <Switch
+ id={switchId}
+ value={shown}
+ onChange={(value) => onToggleHidden(badge.key, !value)}
+ disabled={disabled || numberHasNoEffect}
+ ariaLabel={i18n._(SHOW_BADGE_DESCRIPTOR, {badgeLabel: badge.label})}
+ compact
+ data-flx="user.profile-badge-settings.switch"
+ />
</div>
- )}
- </li>
- );
- })}
- </ul>
+ {numberHasNoEffect && (
+ <p className={styles.note} data-flx="user.profile-badge-settings.note">
+ {i18n._(VISIONARY_NUMBER_NEEDS_VISIONARY_DESCRIPTOR)}
+ </p>
+ )}
+ {badgeVariants.length > 0 && (
+ <div className={styles.variants} data-flx="user.profile-badge-settings.variants">
+ {badgeVariants.map((variant) => (
+ <Switch
+ key={variant.field}
+ label={i18n._(variant.label, {
+ premiumProductName: badgeProductName,
+ operatorPassName: OPERATOR_PASS_NAME,
+ })}
+ description={
+ variant.description
+ ? i18n._(variant.description, {premiumProductName: badgeProductName})
+ : undefined
+ }
+ value={variants[variant.field]}
+ onChange={(value) => onToggleVariant(variant.field, value)}
+ disabled={disabled}
+ compact
+ data-flx="user.profile-badge-settings.variant-switch"
+ />
+ ))}
+ </div>
+ )}
+ </li>
+ );
+ })}
+ </ul>
+ </>
);
}
diff --git a/fluxer_app/src/features/user/components/popouts/UserProfileBadges.module.css b/fluxer_app/src/features/user/components/popouts/UserProfileBadges.module.css
index ec901bec2..3589216d2 100644
--- a/fluxer_app/src/features/user/components/popouts/UserProfileBadges.module.css
+++ b/fluxer_app/src/features/user/components/popouts/UserProfileBadges.module.css
@@ -143,3 +143,32 @@
width: 1rem;
height: 1rem;
}
+
+.moreButton {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ border: 0;
+ border-radius: 0.375rem;
+ padding: 0 0.375rem;
+ background: var(--background-modifier-accent);
+ color: var(--text-primary);
+ font: inherit;
+ font-weight: 600;
+ font-variant-numeric: tabular-nums;
+ line-height: 1;
+ white-space: nowrap;
+ cursor: pointer;
+}
+
+.moreButtonDesktop {
+ min-width: 1.5rem;
+ height: 1.5rem;
+ font-size: 0.75rem;
+}
+
+.moreButtonMobile {
+ min-width: 2rem;
+ height: 2rem;
+ font-size: 0.875rem;
+}
diff --git a/fluxer_app/src/features/user/components/popouts/UserProfileBadges.tsx b/fluxer_app/src/features/user/components/popouts/UserProfileBadges.tsx
index cf0bd4c8f..913472ce9 100644
--- a/fluxer_app/src/features/user/components/popouts/UserProfileBadges.tsx
+++ b/fluxer_app/src/features/user/components/popouts/UserProfileBadges.tsx
@@ -2,11 +2,18 @@
import * as ImageCacheUtils from '@app/features/messaging/utils/ImageCacheUtils';
import * as PremiumModalCommands from '@app/features/premium/commands/PremiumModalCommands';
+import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
import FocusRing from '@app/features/ui/focus_ring/FocusRing';
import {Tooltip} from '@app/features/ui/tooltip/Tooltip';
import {handleExternalLinkClick} from '@app/features/ui/utils/NativeUtils';
+import {BadgeListModal} from '@app/features/user/components/modals/BadgeListModal';
import styles from '@app/features/user/components/popouts/UserProfileBadges.module.css';
import {profileBadgeImageUrl} from '@app/features/user/utils/ProfileUtils';
+import {
+ MORE_BADGES_DESCRIPTOR,
+ SHOW_ALL_BADGES_COUNT_DESCRIPTOR,
+ SHOW_ALL_BADGES_DESCRIPTOR,
+} from '@app/features/user/utils/UserMessageDescriptors';
import type {ProfileBadgeResponse} from '@fluxer/schema/src/domains/user/ProfileBadgeSchemas';
import {msg} from '@lingui/core/macro';
import {useLingui} from '@lingui/react/macro';
@@ -20,6 +27,7 @@ interface UserProfileBadgesProps {
badges: ReadonlyArray<ProfileBadgeResponse>;
isModal?: boolean;
isMobile?: boolean;
+ maxVisible?: number;
onEditBadges?: () => void;
'data-flx'?: string;
}
@@ -31,6 +39,26 @@ const EDIT_BADGES_DESCRIPTOR = msg({
});
const BADGE_REVEAL_TIMEOUT_MS = 1000;
+const COMPACT_VISIBLE_BADGES = 7;
+const WIDE_VISIBLE_BADGES = 15;
+
+function openBadgeList(badges: ReadonlyArray<ProfileBadgeResponse>, dataFlx: string): void {
+ ModalCommands.push(
+ ModalCommands.modal(() => (
+ <BadgeListModal
+ items={badges.map((badge) => ({
+ key: badge.key,
+ imageUrl: profileBadgeImageUrl(badge),
+ caption: badge.caption ?? null,
+ title: badge.details?.title ?? badge.label,
+ lines: badge.details?.lines ?? [],
+ href: badge.href ?? null,
+ }))}
+ data-flx={`${dataFlx}.badge-list-modal`}
+ />
+ )),
+ );
+}
function isSettledImage(url: string): boolean {
return ImageCacheUtils.hasImage(url) || ImageCacheUtils.hasFailedImage(url);
@@ -97,9 +125,19 @@ function opensPremiumModal(badge: ProfileBadgeResponse): boolean {
}
export const UserProfileBadges: React.FC<UserProfileBadgesProps> = observer(
- ({badges, isModal = false, isMobile = false, onEditBadges, 'data-flx': dataFlx = 'user.user-profile-badges'}) => {
+ ({
+ badges,
+ isModal = false,
+ isMobile = false,
+ maxVisible,
+ onEditBadges,
+ 'data-flx': dataFlx = 'user.user-profile-badges',
+ }) => {
const {i18n} = useLingui();
- const ready = useBadgeImagesReady(badges);
+ const limit = maxVisible ?? (isModal && !isMobile ? WIDE_VISIBLE_BADGES : COMPACT_VISIBLE_BADGES);
+ const visible = badges.length > limit ? badges.slice(0, limit) : badges;
+ const hidden = badges.length - visible.length;
+ const ready = useBadgeImagesReady(visible);
if (badges.length === 0 && !onEditBadges) {
return null;
}
@@ -143,7 +181,7 @@ export const UserProfileBadges: React.FC<UserProfileBadgesProps> = observer(
};
return (
<div className={clsx(containerClassName, !ready && styles.pending)} data-flx={dataFlx}>
- {badges.map((badge) => {
+ {visible.map((badge) => {
const imageUrl = profileBadgeImageUrl(badge);
const content =
imageUrl !== null ? (
@@ -178,6 +216,21 @@ export const UserProfileBadges: React.FC<UserProfileBadgesProps> = observer(
</Tooltip>
);
})}
+ {hidden > 0 && (
+ <Tooltip text={i18n._(SHOW_ALL_BADGES_DESCRIPTOR)} data-flx={`${dataFlx}.more-tooltip`}>
+ <FocusRing offset={-2} data-flx={`${dataFlx}.more-focus-ring`}>
+ <button
+ type="button"
+ className={clsx(styles.moreButton, touch ? styles.moreButtonMobile : styles.moreButtonDesktop)}
+ aria-label={i18n._(SHOW_ALL_BADGES_COUNT_DESCRIPTOR, {count: hidden})}
+ onClick={() => openBadgeList(badges, dataFlx)}
+ data-flx={`${dataFlx}.more-button`}
+ >
+ {i18n._(MORE_BADGES_DESCRIPTOR, {count: hidden})}
+ </button>
+ </FocusRing>
+ </Tooltip>
+ )}
{onEditBadges && (
<Tooltip text={i18n._(EDIT_BADGES_DESCRIPTOR)} data-flx={`${dataFlx}.edit-tooltip`}>
<FocusRing offset={-2} data-flx={`${dataFlx}.edit-focus-ring`}>
diff --git a/fluxer_app/src/features/user/utils/UserMessageDescriptors.ts b/fluxer_app/src/features/user/utils/UserMessageDescriptors.ts
index e713dfb5f..466aed990 100644
--- a/fluxer_app/src/features/user/utils/UserMessageDescriptors.ts
+++ b/fluxer_app/src/features/user/utils/UserMessageDescriptors.ts
@@ -242,6 +242,23 @@ export const PROFILE_BADGES_DESCRIPTOR = msg({
comment: 'Title of the profile settings section that lists the badges you hold and lets you hide each one.',
});
+export const MORE_BADGES_DESCRIPTOR = msg({
+ message: '+{count}',
+ comment:
+ 'Short count of badges that are not shown next to a name or on a profile, such as +3. Pressing it opens the full list. Keep it as short as possible.',
+});
+
+export const SHOW_ALL_BADGES_DESCRIPTOR = msg({
+ message: 'Show all badges',
+ comment: 'Tooltip for the +3 style button that opens the full list of badges.',
+});
+
+export const SHOW_ALL_BADGES_COUNT_DESCRIPTOR = msg({
+ message: '{count, plural, one {+# more badge, show all} other {+# more badges, show all}}',
+ comment:
+ 'Screen reader label for the +3 style button that opens the full list of badges. It starts with the same +3 text that is shown on the button, so voice control users can say it.',
+});
+
export const COMMUNITY_NICKNAME_DESCRIPTOR = msg({
message: 'Community nickname',
comment: 'Settings search entry label. Also used as a search synonym in the settings search bar.',
diff --git a/fluxer_docs/src/content/docs/admin-api/badges.mdx b/fluxer_docs/src/content/docs/admin-api/badges.mdx
index 8b46934ff..2b4f53920 100644
--- a/fluxer_docs/src/content/docs/admin-api/badges.mdx
+++ b/fluxer_docs/src/content/docs/admin-api/badges.mdx
@@ -6,11 +6,13 @@ description: Admin API routes for making custom badges and giving them to users
import RouteHeader from '@/components/RouteHeader.astro';
-A custom badge is an image that instance admins make and give out. A user badge shows on the [profile](/http-api/users/#profile-badge-object) of each account it's given to, after the built-in badges. A guild badge shows next to the guild name, after its verified, partnered or discoverable badge, and [instance discovery](/http-api/instance/#guild-badge-object) lists every guild badge for clients.
+A custom badge is an image that instance admins make and give out. A user badge shows on the [profile](/http-api/users/#profile-badge-object) of each account it's given to, after the built-in badges. A guild badge shows next to the guild name, after its verified, partnered or discoverable badge. Clients get guild badges from [List guild badges](/http-api/instance/#list-guild-badges), and [instance discovery](/http-api/instance/#guild-badge-object) lists the first 100.
Admins can also replace the image of a built-in badge: staff or premium on profiles, and verified, partnered or discoverable on guilds. The badge keeps its name, tooltip and meaning, and everyone sees the new image in its place. See [Replace built-in badge image](#replace-built-in-badge-image).
-You can make up to 100 badges of each type, and an account or guild can have up to 10. Give badges with [Update user badges](/admin-api/users/#update-user-badges) and the `badge_ids` field of [Update guild](/admin-api/guilds/#update-guild). Deleting a badge takes it off everyone who had it. You can change the display order with [Reorder badges](#reorder-badges) or the Move up and Move down buttons on the Badges page of the admin panel.
+There is no limit on how many badges an instance can have. The [badge settings](#badge-settings-object) set how many one account or one guild can be given, 100 per account and 50 per guild by default. Give badges with [Update user badges](/admin-api/users/#update-user-badges) and the `badge_ids` field of [Update guild](/admin-api/guilds/#update-guild). Deleting a badge takes it off everyone who had it.
+
+Each badge type has its own display order. A new badge goes to the end of its type. [Move badge](#move-badge) moves one badge, and the Badges page of the admin panel uses it for its Move up, Move down, Move to top and Move to bottom buttons. [Reorder badges](#reorder-badges) sets the whole order on instances with up to 1,000 badges.
## Admin custom badge object
@@ -20,6 +22,7 @@ You can make up to 100 badges of each type, and an account or guild can have up
| --- | --- | --- |
| id | snowflake | The ID of the badge |
| type | string | `user` or `guild` |
+| position | string | The display position. Badges of a type show in ascending order of this 64-bit integer |
| name | string | The name of the badge (1-64 characters) |
| description | ?string | The tooltip text under the name (1-256 characters), or null |
| asset_url | string | The badge image as WebP from the media proxy |
@@ -31,6 +34,7 @@ You can make up to 100 badges of each type, and an account or guild can have up
{
"id": "1489002177550843904",
"type": "user",
+ "position": "4294967296",
"name": "Translator",
"description": "Helps translate Fluxer",
"asset_url": "https://media.example.com/custom-badges/1489002177550843904/3f2a9c1d.webp",
@@ -50,24 +54,55 @@ You can make up to 100 badges of each type, and an account or guild can have up
<sup>1</sup> One of the profile badges `staff` and `premium`, or one of the guild badges `guild_verified`, `guild_partnered` and `guild_discoverable`
+## Badge settings object
+
+### Structure
+
+| Field | Type | Description |
+| --- | --- | --- |
+| max_per_user | integer | How many custom badges one account can be given (1-1000, 100 by default) |
+| max_per_guild | integer | How many custom badges one guild can be given (1-200, 50 by default) |
+
+Lowering a limit keeps the badges already given. A change that adds a badge to an account or guild that would then be over the limit fails with `MAX_BADGES`. A change that only removes badges always works.
+
+Each profile response holds every custom badge of the account with its name, description and link, and each guild object holds every badge ID of the guild. A higher limit makes these responses larger. Older app versions show every badge of a profile or guild in one row, with no control that opens the rest in a list.
+
+Guilds have a lower ceiling because every guild a person is in sends its `badge_ids` in the Gateway Ready event. Every badge an account shows comes back in each [profile](/http-api/users/#full-user-profile-object). With 1,000 badges that have long descriptions and links, a profile response can be several megabytes.
+
## List badges
<RouteHeader method="GET" path="/v1/admin/badges" auditReason />
-Returns every custom badge in display order. A new badge goes to the end. You need `badge:list`.
+Returns one page of custom badges in display order, with the badge settings and the built-in badge images. Without `type` the list holds every user badge, then every guild badge. You need `badge:list`.
+
+### Query string parameters
+
+| Field | Type | Description |
+| --- | --- | --- |
+| type? | string | `user` or `guild` |
+| query? | string | Only badges whose ID is this value, or whose name holds it, ignoring case (1-64 characters) |
+| ids? | string | Up to 100 badge IDs separated by commas. Only these badges come back, and `next` is null. Can't be sent with `query` or `after` |
+| after? | string | The `next` value of the previous page |
+| limit? | integer | How many badges to return (1-200, default 100) |
+
+A page with `query` looks at up to 5,000 badges. It can hold fewer badges than `limit` and still have a `next` value. Keep asking until `next` is null.
### Response body
| Field | Type | Description |
| --- | --- | --- |
-| badges | array[[Admin custom badge](#admin-custom-badge-object) object] | The badges of both types |
+| badges | array[[Admin custom badge](#admin-custom-badge-object) object] | One page of badges |
+| next | ?string | Send this as `after` to get the next page, or null when there are no more badges to look at |
+| version | string | The catalog version, the same value as `custom_badges_version` in [instance discovery](/http-api/instance/#instance-discovery-object) |
+| settings | [badge settings](#badge-settings-object) object | The badge limits |
| built_in | array[[Built-in badge image](#built-in-badge-image-object) object] | Every built-in badge and the image the instance shows for it |
### Response
| Status | Body | Condition |
| --- | --- | --- |
-| 200 | response body | The badges were returned |
+| 200 | response body | The page was returned |
+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` for a bad parameter, a cursor of the other type, or `ids` sent with `query` or `after` |
The rate limit is 200 requests per minute, on the `admin:lookup` bucket.
@@ -94,7 +129,7 @@ Uploads the image to the media proxy, makes the badge and returns it. You need `
| Status | Body | Condition |
| --- | --- | --- |
| 200 | [Admin custom badge](#admin-custom-badge-object) object | The badge was made |
-| 400 | [error response](/admin-api/#error-response) | `MAX_BADGES` when the type already has 100 badges, or `INVALID_FORM_BODY` for a bad field |
+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` for a bad field |
| 400 | [error response](/admin-api/#error-response) | `IMAGE_SIZE_EXCEEDS_LIMIT`, `INVALID_IMAGE_FORMAT` or `FAILED_TO_UPLOAD_IMAGE` for a bad image |
The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.
@@ -133,6 +168,8 @@ The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.
Deletes a badge and its image and returns 204. Accounts and guilds that had it stop showing it. You need `badge:delete`.
+The image of a badge made before the upgrade that moved badges into their own tables stays in storage. The instance settings keep a copy of those badges for older versions, and a later release removes that copy.
+
### Response
| Status | Body | Condition |
@@ -142,40 +179,85 @@ Deletes a badge and its image and returns 204. Accounts and guilds that had it s
The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.
+## Move badge
+
+<RouteHeader method="PATCH" path="/v1/admin/badges/order" auditReason />
+
+Moves one badge within the badges of its type and returns it. Send either `direction` or `after_id`. Moving the first badge up or the last badge down changes nothing. You need `badge:update`.
+
+### JSON body
+
+| Field | Type | Description |
+| --- | --- | --- |
+| badge_id | snowflake | The badge to move |
+| direction? | string | `up` or `down` to swap places with the badge before or after it, `first` or `last` to put it before or after every other badge of its type |
+| after_id? | ?snowflake | Put the badge right after this badge of the same type, or first when null |
+
+### Response
+
+| Status | Body | Condition |
+| --- | --- | --- |
+| 200 | [Admin custom badge](#admin-custom-badge-object) object | The badge was moved, or was already in place |
+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` when the body has both or neither of `direction` and `after_id`, or `after_id` is the badge itself |
+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_BADGE` when the badge doesn't exist, or `after_id` isn't a badge of the same type |
+
+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.
+
## Reorder badges
<RouteHeader method="PUT" path="/v1/admin/badges/order" auditReason />
-Sets the display order of the custom badges and returns them in the new order. Send every user and guild badge on the instance exactly once. Profiles and guilds show their badges in this order. You need `badge:update`.
+Sets the display order of the custom badges and returns the first page of [List badges](#list-badges) with up to 200 badges. Send every user and guild badge on the instance exactly once. Profiles and guilds show their badges in this order. You need `badge:update`.
+
+It works on instances with up to 1,000 badges. Larger instances move badges one at a time with [Move badge](#move-badge). The new order is saved in groups of badges. A request that fails part of the way can leave part of the new order. Sending the same request again finishes it.
### JSON body
| Field | Type | Description |
| --- | --- | --- |
-| badge_ids | array[snowflake] | Every badge ID on the instance in the new order (up to 200) |
+| badge_ids | array[snowflake] | Every badge ID on the instance in the new order (up to 1000) |
-### Response body
+### Response
+
+| Status | Body | Condition |
+| --- | --- | --- |
+| 200 | [List badges](#list-badges) response body | The order was saved |
+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` when `badge_ids` leaves out a badge or lists one twice, or the instance has more than 1,000 badges |
+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_BADGE` when an ID isn't a badge on the instance |
+
+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.
+
+## Update badge settings
+
+<RouteHeader method="PATCH" path="/v1/admin/badges/settings" auditReason />
+
+Changes the [badge settings](#badge-settings-object) and returns them. Leave a field out to keep its value. You need `badge:update`.
+
+### JSON body
| Field | Type | Description |
| --- | --- | --- |
-| badges | array[[Admin custom badge](#admin-custom-badge-object) object] | The badges of both types in the new order |
-| built_in | array[[Built-in badge image](#built-in-badge-image-object) object] | Every built-in badge and the image the instance shows for it |
+| max_per_user? | integer | How many custom badges one account can be given (1-1000) |
+| max_per_guild? | integer | How many custom badges one guild can be given (1-200) |
### Response
| Status | Body | Condition |
| --- | --- | --- |
-| 200 | response body | The order was saved |
-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` when `badge_ids` leaves out a badge or lists one twice |
-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_BADGE` when an ID isn't a badge on the instance |
+| 200 | [badge settings](#badge-settings-object) object | The settings were saved |
+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` for a value out of range |
The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.
+## Errors while a change is published
+
+Every create, edit, delete and move saves the badge and then publishes a new catalog version, which tells API servers and clients to load the badges again. If the API can't publish the version, the request fails with 503 `SERVICE_UNAVAILABLE` although the change was saved. The next badge change, or the next API restart, publishes it. Until then some clients can show the old badge. An image that the change replaced or deleted is cleaned up the same way as when the version is published.
+
## Replace built-in badge image
<RouteHeader method="PUT" path="/v1/admin/badges/built-in/{kind}" auditReason />
-Uploads an image and shows it everywhere the built-in badge appears, then returns the same body as [List badges](#list-badges). Profiles and guilds keep the badge, its tooltip and its link. You need `badge:update`.
+Uploads an image and shows it everywhere the built-in badge appears, then returns the first page of [List badges](#list-badges) with up to 200 badges. Profiles and guilds keep the badge, its tooltip and its link. You need `badge:update`.
### JSON body
@@ -185,18 +267,11 @@ Uploads an image and shows it everywhere the built-in badge appears, then return
<sup>1</sup> The same formats and limits as [Create badge](#create-badge)
-### Response body
-
-| Field | Type | Description |
-| --- | --- | --- |
-| badges | array[[Admin custom badge](#admin-custom-badge-object) object] | The badges of both types |
-| built_in | array[[Built-in badge image](#built-in-badge-image-object) object] | Every built-in badge and the image the instance shows for it |
-
### Response
| Status | Body | Condition |
| --- | --- | --- |
-| 200 | response body | The image was replaced |
+| 200 | [List badges](#list-badges) response body | The image was replaced |
| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` for an unknown `kind` |
| 400 | [error response](/admin-api/#error-response) | `IMAGE_SIZE_EXCEEDS_LIMIT`, `INVALID_IMAGE_FORMAT` or `FAILED_TO_UPLOAD_IMAGE` for a bad image |
@@ -206,20 +281,13 @@ The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.
<RouteHeader method="DELETE" path="/v1/admin/badges/built-in/{kind}" auditReason />
-Goes back to the built-in image for a badge, deletes the uploaded one and returns the same body as [List badges](#list-badges). You need `badge:update`.
-
-### Response body
-
-| Field | Type | Description |
-| --- | --- | --- |
-| badges | array[[Admin custom badge](#admin-custom-badge-object) object] | The badges of both types |
-| built_in | array[[Built-in badge image](#built-in-badge-image-object) object] | Every built-in badge and the image the instance shows for it |
+Goes back to the built-in image for a badge, deletes the uploaded one and returns the first page of [List badges](#list-badges) with up to 200 badges. You need `badge:update`.
### Response
| Status | Body | Condition |
| --- | --- | --- |
-| 200 | response body | The built-in image is used again |
+| 200 | [List badges](#list-badges) response body | The built-in image is used again |
| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` for an unknown `kind` |
The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.
diff --git a/fluxer_docs/src/content/docs/admin-api/guilds.mdx b/fluxer_docs/src/content/docs/admin-api/guilds.mdx
index 0b81140a8..36d26dc97 100644
--- a/fluxer_docs/src/content/docs/admin-api/guilds.mdx
+++ b/fluxer_docs/src/content/docs/admin-api/guilds.mdx
@@ -80,7 +80,7 @@ The owner fields are null when the owner account doesn't exist.
| splash | ?string | The invite splash hash |
| embed_splash | ?string | The embedded invite splash hash |
| features | array[string] | The [guild features](/http-api/guilds/#guild-features) (at most 100) |
-| badge_ids | array[snowflake] | The [custom badges](/admin-api/badges/) of the guild (at most 10) |
+| badge_ids | array[snowflake] | The [custom badges](/admin-api/badges/) of the guild (at most 200) |
| verification_level | integer | The [verification level](/http-api/guilds/#verification-levels) |
| mfa_level | integer | The [MFA level](/http-api/guilds/#mfa-levels) moderators need |
| nsfw_level | integer | The [NSFW level](/http-api/guilds/#nsfw-levels) |
@@ -286,7 +286,7 @@ To change `afk_channel_id`, `system_channel_id` or `afk_timeout`, use [Modify gu
| new_owner_id?<sup>2</sup> | snowflake | The new owner |
| add_features?<sup>3</sup> | array[string] | [Guild features](/http-api/guilds/#guild-features) to add (at most 100) |
| remove_features?<sup>3</sup> | array[string] | [Guild features](/http-api/guilds/#guild-features) to remove (at most 100) |
-| badge_ids? | array[snowflake] | The guild badges to give, replacing the current ones (at most 10) |
+| badge_ids?<sup>4</sup> | array[snowflake] | The guild badges to give, replacing the current ones |
| fields? | array[string] | Images to clear, each `icon`, `banner`, `splash` or `embed_splash` (at most 10) |
| verification_level? | integer | The new [verification level](/http-api/guilds/#verification-levels) |
| mfa_level? | integer | The new [MFA level](/http-api/guilds/#mfa-levels) |
@@ -304,6 +304,8 @@ To change `afk_channel_id`, `system_channel_id` or `afk_timeout`, use [Modify gu
<sup>3</sup> A feature in both lists ends up removed. Adding `DISCOVERABLE` approves the guild's [discovery](/admin-api/discovery/) application, and removing it takes the guild out of discovery
+<sup>4</sup> A list that adds a badge can hold up to `max_per_guild` of the [badge settings](/admin-api/badges/#badge-settings-object), which is at most 200. A list that only removes badges always works
+
### Response body
| Field | Type | Description |
@@ -316,6 +318,7 @@ To change `afk_channel_id`, `system_channel_id` or `afk_timeout`, use [Modify gu
| --- | --- | --- |
| 200 | response body | The changes were applied |
| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` when the custom invite code is invalid or `THIS_VANITY_URL_IS_ALREADY_TAKEN` |
+| 400 | [error response](/admin-api/#error-response) | `MAX_BADGES` when `badge_ids` adds a badge and holds more than `max_per_guild` of the [badge settings](/admin-api/badges/#badge-settings-object) |
| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL` when you lack an ACL a field needs |
| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD` when the guild doesn't exist, or `UNKNOWN_BADGE` when an ID in `badge_ids` isn't a guild badge |
diff --git a/fluxer_docs/src/content/docs/admin-api/index.mdx b/fluxer_docs/src/content/docs/admin-api/index.mdx
index fc54886a4..48b568afa 100644
--- a/fluxer_docs/src/content/docs/admin-api/index.mdx
+++ b/fluxer_docs/src/content/docs/admin-api/index.mdx
@@ -434,6 +434,7 @@ These entries have `access` set to `write`.
| limit_features | A feature limit decision was recorded for an account |
| link_sso_identity | A single sign-on subject was bound to an account by hand |
| migrate_sso_identities | Single sign-on subjects were moved from an earlier provider ID to the provider in use |
+| move_badge | One custom badge was moved in the display order |
| purge_asset | A stored media asset was purged |
| purge_guild_emoji_asset | A guild emoji asset was purged |
| purge_guild_sticker_asset | A guild sticker asset was purged |
@@ -486,6 +487,7 @@ These entries have `access` set to `write`.
| unlink_sso_identities | The single sign-on subjects of an account were released |
| update_admin_api_key | An Admin API key was renamed or its ACLs were replaced |
| update_badge | A custom badge was updated |
+| update_badge_settings | The limits on how many custom badges an account or guild can have were changed |
| update_discovery_categories | Guilds were moved to a discovery category |
| update_discovery_listing | A discovery listing was edited |
| update_features | Guild features were added or removed |
diff --git a/fluxer_docs/src/content/docs/admin-api/users.mdx b/fluxer_docs/src/content/docs/admin-api/users.mdx
index dc5350fa1..62751eb62 100644
--- a/fluxer_docs/src/content/docs/admin-api/users.mdx
+++ b/fluxer_docs/src/content/docs/admin-api/users.mdx
@@ -53,7 +53,7 @@ The full admin view of one account, with the flags, lifecycle, contact and netwo
| enforcement_decision_id | ?snowflake | The [enforcement decision](/admin-api/enforcement/) that owns the account's state |
| acls | array[string] | The [Admin ACLs](/admin-api/#acl-registry) set on the account |
| traits | array[string] | The operator labels on the account, sorted (at most 100) |
-| badge_ids | array[snowflake] | The [custom badges](/admin-api/badges/) given to the account (at most 10) |
+| badge_ids | array[snowflake] | The [custom badges](/admin-api/badges/) given to the account (at most 1000) |
| has_totp | boolean | Whether a TOTP authenticator is registered |
| has_password | boolean | Whether the account has a password |
| claimed | boolean | Whether the account can sign in from another device |
@@ -844,7 +844,7 @@ Replaces the [custom badges](/admin-api/badges/) given to the account and return
| Field | Type | Description |
| --- | --- | --- |
-| badge_ids | array[snowflake] | The user badges to give, replacing the current ones (at most 10) |
+| badge_ids | array[snowflake] | The user badges to give, replacing the current ones (at most 1000) |
### Response body
@@ -857,8 +857,11 @@ Replaces the [custom badges](/admin-api/badges/) given to the account and return
| Status | Body | Condition |
| --- | --- | --- |
| 200 | response body | The badges were replaced |
+| 400 | [error response](/admin-api/#error-response) | `MAX_BADGES` when the list adds a badge and holds more than `max_per_user` of the [badge settings](/admin-api/badges/#badge-settings-object) |
| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_BADGE` when an ID isn't a user badge, or `UNKNOWN_USER` |
+A list that only removes badges always works, even when the account still has more than the limit after a limit was lowered.
+
The profile shows the change the next time someone loads it, and Fluxer sends no Gateway event.
The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.
diff --git a/fluxer_docs/src/content/docs/http-api/discovery.mdx b/fluxer_docs/src/content/docs/http-api/discovery.mdx
index 29fd0f4ad..2b590528f 100644
--- a/fluxer_docs/src/content/docs/http-api/discovery.mdx
+++ b/fluxer_docs/src/content/docs/http-api/discovery.mdx
@@ -29,7 +29,7 @@ An approved guild listing as search returns it.
| member_count | integer | The approximate member count of the guild |
| online_count | integer | The approximate online member count of the guild |
| features | array[string] | The [guild features](/http-api/guilds/#guild-features) of the guild |
-| badge_ids | array[snowflake] | The [custom badges](/http-api/instance/#guild-badge-object) of the guild |
+| badge_ids | array[snowflake] | The [custom badges](/http-api/instance/#guild-badge-object) of the guild. Look them up with [List guild badges](/http-api/instance/#list-guild-badges) |
| verification_level | integer | The [verification level](/http-api/guilds/#verification-levels) of the guild (at least `1`) |
| visits_enabled? | boolean | Whether you can [visit](/http-api/guilds/#visiting-guilds) the guild before joining |
diff --git a/fluxer_docs/src/content/docs/http-api/errors.md b/fluxer_docs/src/content/docs/http-api/errors.md
index 76f12c307..482472165 100644
--- a/fluxer_docs/src/content/docs/http-api/errors.md
+++ b/fluxer_docs/src/content/docs/http-api/errors.md
@@ -235,7 +235,7 @@ These are the values of the top-level `code`, and the [OpenAPI document](/http-a
| `IP_BAN_LINKED_TO_DECISION` | This network block belongs to an enforcement decision |
| `MAX_ACTIVE_THREADS` | This community has reached its active thread limit of {count} |
| `MAX_APPLICATIONS` | You've reached the maximum of {limit} applications |
-| `MAX_BADGES` | You've reached the maximum of {count} badges for this type |
+| `MAX_BADGES` | The limit is {count} badges |
| `MAX_BOOKMARKS` | You've reached the maximum of {count} bookmarks |
| `MAX_CATEGORY_CHANNELS` | You've reached the maximum of {count} category channels |
| `MAX_EMOJIS` | You've reached the maximum of {count} emojis |
diff --git a/fluxer_docs/src/content/docs/http-api/guilds.mdx b/fluxer_docs/src/content/docs/http-api/guilds.mdx
index a08f132e9..a1242072d 100644
--- a/fluxer_docs/src/content/docs/http-api/guilds.mdx
+++ b/fluxer_docs/src/content/docs/http-api/guilds.mdx
@@ -35,7 +35,7 @@ A guild is a community with its own channels, roles, members and settings. Membe
| afk_channel_id | ?snowflake | Voice channel that inactive members are moved to |
| afk_timeout | integer | AFK timeout in seconds (60-3600) |
| features | array[string] | [Guild features](#guild-features), in no fixed order |
-| badge_ids | array[string] | [Badge](/http-api/instance/#guild-badge-object) IDs |
+| badge_ids | array[string] | [Badge](/http-api/instance/#guild-badge-object) IDs, in no fixed order. Look them up with [List guild badges](/http-api/instance/#list-guild-badges) (at most 200) |
| verification_level | integer | [Verification level](#verification-levels) |
| mfa_level | integer | [MFA level](#mfa-levels) |
| nsfw_level | integer | [NSFW level](#nsfw-levels) |
@@ -119,7 +119,7 @@ Invites return this smaller guild object, and its asset fields follow the same f
| embed_splash_width | ?integer | Embedded invite splash width in pixels |
| embed_splash_height | ?integer | Embedded invite splash height in pixels |
| features | array[string] | [Guild features](#guild-features) |
-| badge_ids | array[string] | [Badge](/http-api/instance/#guild-badge-object) IDs |
+| badge_ids | array[string] | [Badge](/http-api/instance/#guild-badge-object) IDs, in no fixed order. Look them up with [List guild badges](/http-api/instance/#list-guild-badges) (at most 200) |
| visits_enabled?<sup>1</sup> | boolean | Whether you can [visit](#visiting-guilds) the guild from this invite |
<sup>1</sup> Only [Get invite](/http-api/invites/#get-invite) returns this field, and only with the `guild_visits` assignment
diff --git a/fluxer_docs/src/content/docs/http-api/instance.mdx b/fluxer_docs/src/content/docs/http-api/instance.mdx
index b8acb6ab2..919ec649f 100644
--- a/fluxer_docs/src/content/docs/http-api/instance.mdx
+++ b/fluxer_docs/src/content/docs/http-api/instance.mdx
@@ -31,13 +31,17 @@ The public description of one instance.
| app_public | [public application configuration](#public-application-configuration-object) object | Branding, setup state and legal links |
| age_policy? | [age policy](#age-policy-object) object | Regional age policy |
| notice? | ?[instance notice](#instance-notice-object) object | The current notice from the instance admins, or null |
-| guild_badges? | array[[guild badge](#guild-badge-object) object] | The custom badges that guilds can show next to their name, in display order (at most 10) |
+| guild_badges?<sup>1</sup> | array[[guild badge](#guild-badge-object) object] | The first custom badges that guilds can show next to their name, in display order (at most 100) |
+| guild_badges_partial? | boolean | True when the instance has more guild badges than `guild_badges` lists |
+| custom_badges_version? | string | The badge catalog version. It changes whenever a badge is created, edited, deleted or moved |
| built_in_guild_badge_images? | [built-in guild badge images](#built-in-guild-badge-images-object) object | The images the instance shows in place of the built-in guild badges |
| voice_origins? | array[string] | The origin of every voice server endpoint, such as `wss://voice.example.com`, for content security policies (at most 1000) |
+<sup>1</sup> An instance can have any number of guild badges. Discovery lists the first 100 in display order, and [List guild badges](#list-guild-badges) serves every one. A client that knows only `guild_badges` can't show a badge past the first 100
+
## Guild badge object
-A custom badge that instance admins give to guilds. A guild lists the badges it has in `badge_ids`, and clients skip any ID that isn't in `guild_badges`.
+A custom badge that instance admins give to guilds. A guild lists the badges it has in `badge_ids`. Clients look up the IDs they don't know with [List guild badges](#list-guild-badges), skip the IDs it leaves out, and show the badges in ascending `position` order.
### Structure
@@ -48,6 +52,18 @@ A custom badge that instance admins give to guilds. A guild lists the badges it
| description | ?string | The tooltip text under the name, or null |
| asset_url | string | The badge image as WebP from the media proxy. Add a `size` query parameter to get it at the size you draw it |
| href | ?string | The `https` URL a click opens, or null |
+| position? | string | The display position, a 64-bit integer as a string. Older instances leave it out, and clients then keep the order of `guild_badges` |
+
+### Loading badges
+
+A client can show guild badges without holding the whole catalog.
+
+1. Keep the badges from `guild_badges` and the `custom_badges_version` of the discovery document.
+2. For each guild, look up the IDs in `badge_ids` that you don't know, in batches of up to 100, with `ids` and `version` set.
+3. Remember the IDs the response leaves out, and don't ask for them again while the version stays the same.
+4. When discovery or a lookup returns a newer version, forget the badges you looked up and ask again when you need them.
+
+An instance without `custom_badges_version` doesn't have [List guild badges](#list-guild-badges). Use `guild_badges` alone and fetch discovery again for an unknown ID.
## Built-in guild badge images object
@@ -513,6 +529,48 @@ Returns the [instance discovery object](#instance-discovery-object). The respons
The rate limit is 60 requests per minute, on the `instance:info` bucket.
+## List guild badges
+
+<RouteHeader method="GET" path="/v1/instance/badges" unauthenticated />
+
+Returns custom guild badges in display order. Send `ids` to look up the badges of some guilds, or page through every badge with `after` and `limit`. User badges aren't listed here. They come back in each [profile](/http-api/users/#profile-badge-object) instead.
+
+### Query string parameters
+
+| Field | Type | Description |
+| --- | --- | --- |
+| ids? | string | Up to 100 badge IDs separated by commas. Can't be sent with `after` |
+| after? | string | The `next` value of the previous page |
+| limit? | integer | How many badges to return when paging (1-200, default 100) |
+| version? | string | The `custom_badges_version` the client holds |
+
+### Response body
+
+| Field | Type | Description |
+| --- | --- | --- |
+| version | string | The current badge catalog version |
+| badges | array[[guild badge](#guild-badge-object) object] | The badges in display order. IDs that are unknown, deleted or user badges are left out |
+| next | ?string | Send this as `after` to get the next page, or null on the last page and for a lookup by `ids` |
+
+### Caching
+
+| Request | `Cache-Control` |
+| --- | --- |
+| `version` is the current version | `public, max-age=86400, immutable` |
+| no `version`, or an older one | `public, max-age=60, must-revalidate` |
+
+The response has an `ETag` header, and a request with a matching `If-None-Match` gets 304 with no body. A response read while the catalog changes gets the short lifetime and no `ETag`. The version also changes when the instance moves to a new media URL, because every `asset_url` changes with it.
+
+### Response
+
+| Status | Body | Condition |
+| --- | --- | --- |
+| 200 | response body | The badges were returned |
+| 304 | None | The badges haven't changed |
+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` for a bad parameter, a cursor from another list, or `ids` sent with `after` |
+
+The rate limit is 60 requests per minute, on the `instance:badges` bucket. A request with a valid token counts against the account, and a request without one counts against the IP address.
+
## Get client geolocation
<RouteHeader method="GET" path="/v1/ip" unauthenticated />
diff --git a/fluxer_docs/src/content/docs/http-api/messages.mdx b/fluxer_docs/src/content/docs/http-api/messages.mdx
index 124e6613e..5850a9b9a 100644
--- a/fluxer_docs/src/content/docs/http-api/messages.mdx
+++ b/fluxer_docs/src/content/docs/http-api/messages.mdx
@@ -709,7 +709,7 @@ To get the next page, set `before` to the `pinned_at` of the last item. Skip mes
| banner | ?string | The guild banner hash |
| description | ?string | The discovery description, or null when the guild isn't in discovery |
| features | array of strings | `VERIFIED`, `PARTNERED` and `DISCOVERABLE` from [guild features](/http-api/guilds/#guild-features) |
-| badge_ids | array[snowflake] | The [custom badges](/http-api/instance/#guild-badge-object) of the guild |
+| badge_ids | array[snowflake] | The [custom badges](/http-api/instance/#guild-badge-object) of the guild. Look them up with [List guild badges](/http-api/instance/#list-guild-badges) |
| approximate_member_count | ?integer | About how many members the guild has |
| approximate_presence_count | ?integer | About how many members are online |
| discoverable | boolean | Whether you can join through [Join discovery guild](/http-api/discovery/#join-discovery-guild) |
diff --git a/fluxer_docs/src/content/docs/http-api/users/current-user.mdx b/fluxer_docs/src/content/docs/http-api/users/current-user.mdx
index fb786ea47..00c5479da 100644
--- a/fluxer_docs/src/content/docs/http-api/users/current-user.mdx
+++ b/fluxer_docs/src/content/docs/http-api/users/current-user.mdx
@@ -88,7 +88,7 @@ Changes the account and returns the updated [user](/http-api/users/#user-object)
| accent_color? | ?integer | Packed 24-bit RGB color (0-16777215), or null to clear |
| timezone?<sup>8</sup> | ?string | IANA timezone identifier (1-128 characters), or null to clear |
| timezone_privacy_flags? | integer | [Profile field privacy flags](/http-api/users/#profile-field-privacy-flags) for the timezone |
-| hidden_profile_badges?<sup>12</sup> | array[string] | The full list of [badge keys](/http-api/users/#hiding-badges) to hide from other people, at most 18 |
+| hidden_profile_badges?<sup>12</sup> | array[string] | The full list of [badge keys](/http-api/users/#hiding-badges) to hide from other people, at most 1008 |
| premium_badge_hidden?<sup>13</sup> | boolean | Deprecated. Use the hidden badge list |
| premium_badge_masked? | boolean | Whether to show a lifetime badge as an ordinary subscription badge |
| premium_badge_timestamp_hidden? | boolean | Whether to hide the premium activation time |
diff --git a/fluxer_docs/src/content/docs/operator/running.mdx b/fluxer_docs/src/content/docs/operator/running.mdx
index bd5dbb554..e4d6e3085 100644
--- a/fluxer_docs/src/content/docs/operator/running.mdx
+++ b/fluxer_docs/src/content/docs/operator/running.mdx
@@ -61,6 +61,12 @@ This goes back to the version you had before your last upgrade and keeps your da
If that backup leaves out uploads, the uploads stay as they are. Files uploaded since the upgrade stay on disk, and attachments deleted since the upgrade don't come back. For backups before upgrades that also hold uploads, run `rexctl auto-upgrade on` again with your other flags and `--backup full`, or pass `--backup full` to `rexctl upgrade`. This applies from the next upgrade.
+### Custom badges and rollbacks
+
+Custom badges are stored in their own tables. The first start of a version with these tables copies the badges from the instance settings into them, and it does nothing on later starts. If you roll back past that version, the older version shows the badges as they were before the upgrade, with their images. Badges you made, changed or moved after the upgrade come back when you upgrade again. Changes you make while the older version runs aren't copied when you upgrade again. A badge you make there is missing after the upgrade, and a badge you delete or give a new image there comes back without its image. Delete it or upload its image again.
+
+Set how many badges one user or one guild can have under Limits on the Badges page of the admin panel.
+
## Back up and restore
```sh
diff --git a/packages/constants/src/BadgeConstants.ts b/packages/constants/src/BadgeConstants.ts
index 4d768bfab..ef4244504 100644
--- a/packages/constants/src/BadgeConstants.ts
+++ b/packages/constants/src/BadgeConstants.ts
@@ -9,8 +9,15 @@ export const CustomBadgeTypes = {
export type CustomBadgeType = ValueOf<typeof CustomBadgeTypes>;
-export const MAX_CUSTOM_BADGES_PER_TYPE = 100;
-export const MAX_CUSTOM_BADGES_PER_ENTITY = 10;
+export const CUSTOM_BADGES_PER_USER_CEILING = 1000;
+export const CUSTOM_BADGES_PER_GUILD_CEILING = 200;
+export const DEFAULT_CUSTOM_BADGES_PER_USER = 100;
+export const DEFAULT_CUSTOM_BADGES_PER_GUILD = 50;
+export const DISCOVERY_GUILD_BADGE_LIMIT = 100;
+export const CUSTOM_BADGE_LOOKUP_IDS_MAX = 100;
+export const CUSTOM_BADGE_PAGE_LIMIT_MAX = 200;
+export const CUSTOM_BADGE_PAGE_LIMIT_DEFAULT = 100;
+export const CUSTOM_BADGE_REORDER_IDS_MAX = 1000;
export const CUSTOM_BADGE_NAME_MAX_LENGTH = 64;
export const CUSTOM_BADGE_DESCRIPTION_MAX_LENGTH = 256;
const PROFILE_BADGE_KINDS = [
@@ -28,7 +35,7 @@ export type ProfileBadgeKind = (typeof PROFILE_BADGE_KINDS)[number];
export type ProfileBadgeKey = ProfileBadgeKind | `custom:${string}`;
-export const MAX_HIDDEN_PROFILE_BADGES = PROFILE_BADGE_KINDS.length + MAX_CUSTOM_BADGES_PER_ENTITY;
+export const MAX_HIDDEN_PROFILE_BADGES = PROFILE_BADGE_KINDS.length + CUSTOM_BADGES_PER_USER_CEILING;
const BUILT_IN_GUILD_BADGE_KINDS = ['verified', 'partnered', 'discoverable'] as const;
diff --git a/packages/errors/src/i18n/ErrorI18nMessages.ts b/packages/errors/src/i18n/ErrorI18nMessages.ts
index 29dc146da..4b26af9a9 100644
--- a/packages/errors/src/i18n/ErrorI18nMessages.ts
+++ b/packages/errors/src/i18n/ErrorI18nMessages.ts
@@ -567,8 +567,7 @@ export const ERROR_I18N_MESSAGES = {
'misc.invalid_snowflake': 'Invalid snowflake.',
'misc_limits.max_applications_reached':
"You've reached the maximum of {limit, plural, one {# application} other {# applications}}.",
- 'misc_limits.max_badges_reached':
- "You've reached the maximum of {count, plural, one {# badge} other {# badges}} for this type.",
+ 'misc_limits.max_badges_reached': 'The limit is {count, plural, one {# badge} other {# badges}}.',
'misc_limits.max_bookmarks_reached':
"You've reached the maximum of {count, plural, one {# bookmark} other {# bookmarks}}.",
'misc_limits.max_category_channels_reached':
diff --git a/packages/errors/src/i18n/weblate/locales/ar.json b/packages/errors/src/i18n/weblate/locales/ar.json
index 2b6e6ad7c..ed638354b 100644
--- a/packages/errors/src/i18n/weblate/locales/ar.json
+++ b/packages/errors/src/i18n/weblate/locales/ar.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "طلب غير صالح.",
"misc.invalid_snowflake": "معرف Snowflake غير صالح.",
"misc_limits.max_applications_reached": "لقد وصلت إلى الحد الأقصى وهو {limit, plural, zero {# تطبيق} one {تطبيق واحد} two {تطبيقان} few {# تطبيقات} many {# تطبيقًا} other {# تطبيق}}.",
- "misc_limits.max_badges_reached": "لقد وصلت إلى الحد الأقصى لهذا النوع وهو {count, plural, zero {# شارة} one {شارة واحدة} two {شارتان} few {# شارات} many {# شارة} other {# شارة}}.",
+ "misc_limits.max_badges_reached": "الحد الأقصى هو {count, plural, zero {# شارة} one {شارة واحدة} two {شارتان} few {# شارات} many {# شارة} other {# شارة}}.",
"misc_limits.max_bookmarks_reached": "لقد وصلت إلى الحد الأقصى وهو {count, plural, zero {# إشارة مرجعية} one {إشارة مرجعية واحدة} two {إشارتان مرجعيتان} few {# إشارات مرجعية} many {# إشارة مرجعية} other {# إشارة مرجعية}}.",
"misc_limits.max_category_channels_reached": "لقد وصلت إلى الحد الأقصى وهو {count, plural, zero {# قناة} one {قناة واحدة} two {قناتان} few {# قنوات} many {# قناة} other {# قناة}} في الفئة الواحدة.",
"misc_limits.max_friends_reached": "لقد وصلت إلى الحد الأقصى وهو {count, plural, zero {# صديق} one {صديق واحد} two {صديقان} few {# أصدقاء} many {# صديقًا} other {# صديق}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/bg.json b/packages/errors/src/i18n/weblate/locales/bg.json
index 456e76210..7742455d4 100644
--- a/packages/errors/src/i18n/weblate/locales/bg.json
+++ b/packages/errors/src/i18n/weblate/locales/bg.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Невалидна заявка.",
"misc.invalid_snowflake": "Невалиден snowflake.",
"misc_limits.max_applications_reached": "Достигна максимума от {limit} {limit, plural, one {приложение} other {приложения}}.",
- "misc_limits.max_badges_reached": "Достигна максимума от {count} {count, plural, one {значка} other {значки}} за този тип.",
+ "misc_limits.max_badges_reached": "Ограничението е {count} {count, plural, one {значка} other {значки}}.",
"misc_limits.max_bookmarks_reached": "Достигна максимума от {count} {count, plural, one {отметка} other {отметки}}.",
"misc_limits.max_category_channels_reached": "Достигна максимума от {count} {count, plural, one {категория} other {категории}}.",
"misc_limits.max_friends_reached": "Достигна максимума от {count} {count, plural, one {приятел} other {приятели}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/cs.json b/packages/errors/src/i18n/weblate/locales/cs.json
index f9fc0a5b1..310511b2b 100644
--- a/packages/errors/src/i18n/weblate/locales/cs.json
+++ b/packages/errors/src/i18n/weblate/locales/cs.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Neplatný požadavek.",
"misc.invalid_snowflake": "Neplatný identifikátor Snowflake.",
"misc_limits.max_applications_reached": "Dosáhli jste limitu {limit, plural, one {# aplikace} few {# aplikací} many {# aplikace} other {# aplikací}}.",
- "misc_limits.max_badges_reached": "Dosáhli jste limitu {count, plural, one {# odznaku} few {# odznaků} many {# odznaku} other {# odznaků}} pro tento typ.",
+ "misc_limits.max_badges_reached": "Limit je {count, plural, one {# odznak} few {# odznaky} many {# odznaku} other {# odznaků}}.",
"misc_limits.max_bookmarks_reached": "Dosáhli jste limitu {count, plural, one {# záložky} few {# záložek} many {# záložky} other {# záložek}}.",
"misc_limits.max_category_channels_reached": "Dosáhli jste limitu {count, plural, one {# kanálu} few {# kanálů} many {# kanálu} other {# kanálů}} v kategorii.",
"misc_limits.max_friends_reached": "Dosáhli jste limitu {count, plural, one {# přítele} few {# přátel} many {# přítele} other {# přátel}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/da.json b/packages/errors/src/i18n/weblate/locales/da.json
index 5c0029367..5e52b4ab1 100644
--- a/packages/errors/src/i18n/weblate/locales/da.json
+++ b/packages/errors/src/i18n/weblate/locales/da.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Ugyldig anmodning.",
"misc.invalid_snowflake": "Ugyldig snowflake.",
"misc_limits.max_applications_reached": "Du har nået det maksimale antal på {limit} {limit, plural, one {applikation} other {applikationer}}.",
- "misc_limits.max_badges_reached": "Du har nået grænsen på {count, plural, one {# badge} other {# badges}} for denne type.",
+ "misc_limits.max_badges_reached": "Grænsen er {count, plural, one {# badge} other {# badges}}.",
"misc_limits.max_bookmarks_reached": "Du har nået grænsen på {count, plural, one {# gemt besked} other {# gemte beskeder}}.",
"misc_limits.max_category_channels_reached": "Du har nået det maksimale antal på {count} {count, plural, one {kategorikanal} other {kategorikanaler}}.",
"misc_limits.max_friends_reached": "Du har nået det maksimale antal på {count} {count, plural, one {ven} other {venner}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/de.json b/packages/errors/src/i18n/weblate/locales/de.json
index 2417f9564..7dcdb977f 100644
--- a/packages/errors/src/i18n/weblate/locales/de.json
+++ b/packages/errors/src/i18n/weblate/locales/de.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Ungültige Anfrage.",
"misc.invalid_snowflake": "Ungültige Snowflake-Kennung.",
"misc_limits.max_applications_reached": "Du hast die maximale Anzahl von {limit, plural, one {# Anwendung} other {# Anwendungen}} erreicht.",
- "misc_limits.max_badges_reached": "Du hast die maximale Anzahl von {count, plural, one {# Abzeichen} other {# Abzeichen}} für diesen Typ erreicht.",
+ "misc_limits.max_badges_reached": "Das Limit liegt bei {count, plural, one {# Abzeichen} other {# Abzeichen}}.",
"misc_limits.max_bookmarks_reached": "Du hast die maximale Anzahl von {count, plural, one {# Lesezeichen} other {# Lesezeichen}} erreicht.",
"misc_limits.max_category_channels_reached": "Du hast das Limit von {count, plural, one {# Kanal} other {# Kanälen}} pro Kategorie erreicht.",
"misc_limits.max_friends_reached": "Du hast das Limit von {count, plural, one {# Freund} other {# Freunden}} erreicht.",
diff --git a/packages/errors/src/i18n/weblate/locales/el.json b/packages/errors/src/i18n/weblate/locales/el.json
index d3f86f1b2..c073a0e9e 100644
--- a/packages/errors/src/i18n/weblate/locales/el.json
+++ b/packages/errors/src/i18n/weblate/locales/el.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Μη έγκυρο αίτημα.",
"misc.invalid_snowflake": "Μη έγκυρο snowflake.",
"misc_limits.max_applications_reached": "Έχεις φτάσει το μέγιστο των {limit} {limit, plural, one {εφαρμογής} other {εφαρμογών}}.",
- "misc_limits.max_badges_reached": "Έχεις φτάσει το μέγιστο των {count} {count, plural, one {σήματος} other {σημάτων}} για αυτόν τον τύπο.",
+ "misc_limits.max_badges_reached": "Το όριο είναι {count} {count, plural, one {σήμα} other {σήματα}}.",
"misc_limits.max_bookmarks_reached": "Έχεις φτάσει το μέγιστο των {count} {count, plural, one {σελιδοδείκτη} other {σελιδοδεικτών}}.",
"misc_limits.max_category_channels_reached": "Έχεις φτάσει το μέγιστο των {count} {count, plural, one {καναλιού κατηγορίας} other {καναλιών κατηγορίας}}.",
"misc_limits.max_friends_reached": "Έχεις φτάσει το μέγιστο των {count} {count, plural, one {φίλου} other {φίλων}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/en-GB.json b/packages/errors/src/i18n/weblate/locales/en-GB.json
index d9f886e4f..cfaf15485 100644
--- a/packages/errors/src/i18n/weblate/locales/en-GB.json
+++ b/packages/errors/src/i18n/weblate/locales/en-GB.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Invalid request.",
"misc.invalid_snowflake": "Invalid snowflake.",
"misc_limits.max_applications_reached": "You've reached the maximum of {limit, plural, one {# application} other {# applications}}.",
- "misc_limits.max_badges_reached": "You've reached the maximum of {count, plural, one {# badge} other {# badges}} for this type.",
+ "misc_limits.max_badges_reached": "The limit is {count, plural, one {# badge} other {# badges}}.",
"misc_limits.max_bookmarks_reached": "You've reached the maximum of {count, plural, one {# bookmark} other {# bookmarks}}.",
"misc_limits.max_category_channels_reached": "You've reached the maximum of {count, plural, one {# category channel} other {# category channels}}.",
"misc_limits.max_friends_reached": "You've reached the maximum of {count, plural, one {# friend} other {# friends}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/es-419.json b/packages/errors/src/i18n/weblate/locales/es-419.json
index 891629444..6d2c3b734 100644
--- a/packages/errors/src/i18n/weblate/locales/es-419.json
+++ b/packages/errors/src/i18n/weblate/locales/es-419.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Solicitud no válida.",
"misc.invalid_snowflake": "Snowflake no válido.",
"misc_limits.max_applications_reached": "Has alcanzado el máximo de {limit} {limit, plural, one {aplicación} other {aplicaciones}}.",
- "misc_limits.max_badges_reached": "Has alcanzado el máximo de {count, plural, one {# insignia} other {# insignias}} para este tipo.",
+ "misc_limits.max_badges_reached": "El límite es de {count, plural, one {# insignia} other {# insignias}}.",
"misc_limits.max_bookmarks_reached": "Has alcanzado el máximo de {count, plural, one {# mensaje guardado} other {# mensajes guardados}}.",
"misc_limits.max_category_channels_reached": "Has alcanzado el máximo de {count} {count, plural, one {canal de categoría} other {canales de categoría}}.",
"misc_limits.max_friends_reached": "Has alcanzado el máximo de {count} {count, plural, one {amigo} other {amigos}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/es-ES.json b/packages/errors/src/i18n/weblate/locales/es-ES.json
index d9cffe960..0cdec8e2c 100644
--- a/packages/errors/src/i18n/weblate/locales/es-ES.json
+++ b/packages/errors/src/i18n/weblate/locales/es-ES.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Solicitud no válida.",
"misc.invalid_snowflake": "ID de snowflake no válido.",
"misc_limits.max_applications_reached": "Has alcanzado el máximo de {limit} {limit, plural, one {aplicación} other {aplicaciones}}.",
- "misc_limits.max_badges_reached": "Has alcanzado el máximo de {count, plural, one {# insignia} other {# insignias}} para este tipo.",
+ "misc_limits.max_badges_reached": "El límite es de {count, plural, one {# insignia} other {# insignias}}.",
"misc_limits.max_bookmarks_reached": "Has alcanzado el máximo de {count, plural, one {# mensaje guardado} other {# mensajes guardados}}.",
"misc_limits.max_category_channels_reached": "Has alcanzado el máximo de {count} {count, plural, one {canal de categoría} other {canales de categoría}}.",
"misc_limits.max_friends_reached": "Has alcanzado el máximo de {count} {count, plural, one {amigo} other {amigos}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/fi.json b/packages/errors/src/i18n/weblate/locales/fi.json
index 4a4767c22..39b4aecb8 100644
--- a/packages/errors/src/i18n/weblate/locales/fi.json
+++ b/packages/errors/src/i18n/weblate/locales/fi.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Virheellinen pyyntö.",
"misc.invalid_snowflake": "Virheellinen Snowflake-tunnus.",
"misc_limits.max_applications_reached": "Olet saavuttanut sovellusten enimmäismäärän: {limit, plural, one {# sovellus} other {# sovellusta}}.",
- "misc_limits.max_badges_reached": "Olet saavuttanut tämän tyypin merkkien enimmäismäärän: {count, plural, one {# merkki} other {# merkkiä}}.",
+ "misc_limits.max_badges_reached": "Raja on {count, plural, one {# merkki} other {# merkkiä}}.",
"misc_limits.max_bookmarks_reached": "Olet saavuttanut tallennettujen viestien enimmäismäärän: {count, plural, one {# viesti} other {# viestiä}}.",
"misc_limits.max_category_channels_reached": "Luokan kanavien enimmäismäärä on saavutettu: {count, plural, one {# kanava} other {# kanavaa}}.",
"misc_limits.max_friends_reached": "Olet saavuttanut kaverien enimmäismäärän: {count, plural, one {# kaveri} other {# kaveria}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/fr.json b/packages/errors/src/i18n/weblate/locales/fr.json
index 8b81b6e22..5c3f9c19a 100644
--- a/packages/errors/src/i18n/weblate/locales/fr.json
+++ b/packages/errors/src/i18n/weblate/locales/fr.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Requête invalide.",
"misc.invalid_snowflake": "Snowflake invalide.",
"misc_limits.max_applications_reached": "Vous avez atteint le maximum de {limit, plural, =1 {# application} other {# applications}}.",
- "misc_limits.max_badges_reached": "Vous avez atteint le maximum de {count, plural, one {# badge} other {# badges}} pour ce type.",
+ "misc_limits.max_badges_reached": "La limite est de {count, plural, one {# badge} other {# badges}}.",
"misc_limits.max_bookmarks_reached": "Vous avez atteint le maximum de {count, plural, =1 {# message enregistré} other {# messages enregistrés}}.",
"misc_limits.max_category_channels_reached": "Vous avez atteint le maximum de {count, plural, =1 {# salon par catégorie} other {# salons par catégorie}}.",
"misc_limits.max_friends_reached": "Vous avez atteint le maximum de {count, plural, =1 {# ami} other {# amis}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/he.json b/packages/errors/src/i18n/weblate/locales/he.json
index 9d991e4ba..d600d80fa 100644
--- a/packages/errors/src/i18n/weblate/locales/he.json
+++ b/packages/errors/src/i18n/weblate/locales/he.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "בקשה שגויה.",
"misc.invalid_snowflake": "snowflake שגוי.",
"misc_limits.max_applications_reached": "הגעת למספר המרבי של {limit} {limit, plural, one {אפליקציה} other {אפליקציות}}.",
- "misc_limits.max_badges_reached": "הגעת למספר המרבי של {count} {count, plural, one {תג} other {תגים}} מסוג זה.",
+ "misc_limits.max_badges_reached": "המגבלה היא {count} {count, plural, one {תג} other {תגים}}.",
"misc_limits.max_bookmarks_reached": "הגעת למספר המרבי של {count} {count, plural, one {סימנייה} other {סימניות}}.",
"misc_limits.max_category_channels_reached": "הגעת למספר המרבי של {count} {count, plural, one {קטגוריה} other {קטגוריות}}.",
"misc_limits.max_friends_reached": "הגעת למספר המרבי של {count} {count, plural, one {חבר} other {חברים}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/hi.json b/packages/errors/src/i18n/weblate/locales/hi.json
index 0e349fbe8..8ec4c7219 100644
--- a/packages/errors/src/i18n/weblate/locales/hi.json
+++ b/packages/errors/src/i18n/weblate/locales/hi.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "अमान्य रिक्वेस्ट।",
"misc.invalid_snowflake": "अमान्य स्नोफ्लेक।",
"misc_limits.max_applications_reached": "आप अधिकतम {limit} {limit, plural, one {एप्लिकेशन} other {एप्लिकेशन}} तक पहुँच गए हैं।",
- "misc_limits.max_badges_reached": "आप इस प्रकार के अधिकतम {count} {count, plural, one {बैज} other {बैज}} तक पहुँच गए हैं।",
+ "misc_limits.max_badges_reached": "सीमा {count} {count, plural, one {बैज} other {बैज}} है।",
"misc_limits.max_bookmarks_reached": "आप अधिकतम {count} {count, plural, one {बुकमार्क} other {बुकमार्क}} तक पहुँच गए हैं।",
"misc_limits.max_category_channels_reached": "आप अधिकतम {count} कैटेगरी {count, plural, one {चैनल} other {चैनल}} तक पहुँच गए हैं।",
"misc_limits.max_friends_reached": "आप अधिकतम {count} {count, plural, one {दोस्त} other {दोस्त}} तक पहुँच गए हैं।",
diff --git a/packages/errors/src/i18n/weblate/locales/hr.json b/packages/errors/src/i18n/weblate/locales/hr.json
index 075b97af9..d66df8a5c 100644
--- a/packages/errors/src/i18n/weblate/locales/hr.json
+++ b/packages/errors/src/i18n/weblate/locales/hr.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Nevažeći zahtjev.",
"misc.invalid_snowflake": "Nevažeći snowflake.",
"misc_limits.max_applications_reached": "Dosegnut je maksimum od {limit, plural, one {# aplikacije} few {# aplikacije} other {# aplikacija}}.",
- "misc_limits.max_badges_reached": "Dosegnut je maksimum od {count, plural, one {# značke} few {# značke} other {# znački}} za ovu vrstu.",
+ "misc_limits.max_badges_reached": "Ograničenje je {count, plural, one {# značka} few {# značke} other {# znački}}.",
"misc_limits.max_bookmarks_reached": "Dosegnut je maksimum od {count, plural, one {# oznake} few {# oznake} other {# oznaka}}.",
"misc_limits.max_category_channels_reached": "Dosegnut je maksimum od {count, plural, one {# kanala kategorije} few {# kanala kategorije} other {# kanala kategorije}}.",
"misc_limits.max_friends_reached": "Dosegnut je maksimum od {count, plural, one {# prijatelja} few {# prijatelja} other {# prijatelja}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/hu.json b/packages/errors/src/i18n/weblate/locales/hu.json
index 80ee90b11..3cf69121f 100644
--- a/packages/errors/src/i18n/weblate/locales/hu.json
+++ b/packages/errors/src/i18n/weblate/locales/hu.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Érvénytelen kérés.",
"misc.invalid_snowflake": "Érvénytelen snowflake-azonosító.",
"misc_limits.max_applications_reached": "Elérted az alkalmazások megengedett számát ({limit, plural, one {#} other {#}}).",
- "misc_limits.max_badges_reached": "Elérted az ilyen típusú jelvények megengedett számát ({count, plural, one {#} other {#}}).",
+ "misc_limits.max_badges_reached": "A korlát {count, plural, one {# jelvény} other {# jelvény}}.",
"misc_limits.max_bookmarks_reached": "Elérted a mentett üzenetek megengedett számát ({count, plural, one {#} other {#}}).",
"misc_limits.max_category_channels_reached": "Elérted a kategóriacsatornák megengedett számát ({count, plural, one {#} other {#}}).",
"misc_limits.max_friends_reached": "Elérted az ismerősök megengedett számát ({count, plural, one {#} other {#}}).",
diff --git a/packages/errors/src/i18n/weblate/locales/id.json b/packages/errors/src/i18n/weblate/locales/id.json
index 988e50f93..138daf509 100644
--- a/packages/errors/src/i18n/weblate/locales/id.json
+++ b/packages/errors/src/i18n/weblate/locales/id.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Permintaan tidak valid.",
"misc.invalid_snowflake": "Snowflake tidak valid.",
"misc_limits.max_applications_reached": "Kamu telah mencapai batas maksimal {limit} {limit, plural, other {aplikasi}}.",
- "misc_limits.max_badges_reached": "Kamu telah mencapai batas maksimal {count} {count, plural, other {lencana}} untuk jenis ini.",
+ "misc_limits.max_badges_reached": "Batasnya adalah {count} {count, plural, other {lencana}}.",
"misc_limits.max_bookmarks_reached": "Kamu telah mencapai batas maksimal {count} {count, plural, other {bookmark}}.",
"misc_limits.max_category_channels_reached": "Kamu telah mencapai batas maksimal {count} {count, plural, other {saluran kategori}}.",
"misc_limits.max_friends_reached": "Kamu telah mencapai batas maksimal {count} {count, plural, other {teman}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/it.json b/packages/errors/src/i18n/weblate/locales/it.json
index 25b047432..ebdf5ba31 100644
--- a/packages/errors/src/i18n/weblate/locales/it.json
+++ b/packages/errors/src/i18n/weblate/locales/it.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Richiesta non valida.",
"misc.invalid_snowflake": "ID Snowflake non valido.",
"misc_limits.max_applications_reached": "Hai raggiunto il massimo di {limit, plural, one {# applicazione} other {# applicazioni}}.",
- "misc_limits.max_badges_reached": "Hai raggiunto il limite di {count, plural, one {# badge} other {# badge}} per questo tipo.",
+ "misc_limits.max_badges_reached": "Il limite è di {count, plural, one {# badge} other {# badge}}.",
"misc_limits.max_bookmarks_reached": "Hai raggiunto il limite di {count, plural, one {# messaggio salvato} other {# messaggi salvati}}.",
"misc_limits.max_category_channels_reached": "Hai raggiunto il massimo di {count, plural, one {# canale} other {# canali}} per categoria.",
"misc_limits.max_friends_reached": "Hai raggiunto il massimo di {count, plural, one {# amico} other {# amici}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/ja.json b/packages/errors/src/i18n/weblate/locales/ja.json
index d24084c27..29b76dc84 100644
--- a/packages/errors/src/i18n/weblate/locales/ja.json
+++ b/packages/errors/src/i18n/weblate/locales/ja.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "リクエストが無効です。",
"misc.invalid_snowflake": "Snowflakeが無効です。",
"misc_limits.max_applications_reached": "アプリケーションの上限{limit, plural, other {#件}}に達しました。",
- "misc_limits.max_badges_reached": "この種類のバッジの上限{count, plural, other {#個}}に達しました。",
+ "misc_limits.max_badges_reached": "上限は{count, plural, other {#個}}です。",
"misc_limits.max_bookmarks_reached": "ブックマークの上限{count, plural, other {#件}}に達しました。",
"misc_limits.max_category_channels_reached": "カテゴリチャンネルの上限{count, plural, other {#件}}に達しました。",
"misc_limits.max_friends_reached": "友だちの上限{count, plural, other {#人}}に達しました。",
diff --git a/packages/errors/src/i18n/weblate/locales/ko.json b/packages/errors/src/i18n/weblate/locales/ko.json
index b747b5bf6..c03c11b10 100644
--- a/packages/errors/src/i18n/weblate/locales/ko.json
+++ b/packages/errors/src/i18n/weblate/locales/ko.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "요청이 올바르지 않아요.",
"misc.invalid_snowflake": "스노플레이크가 올바르지 않아요.",
"misc_limits.max_applications_reached": "애플리케이션은 최대 {limit, plural, other {#개}}까지 등록할 수 있어요.",
- "misc_limits.max_badges_reached": "이 유형의 배지는 최대 {count, plural, other {#개}}까지 만들 수 있어요.",
+ "misc_limits.max_badges_reached": "배지는 최대 {count, plural, other {#개}}까지예요.",
"misc_limits.max_bookmarks_reached": "북마크는 최대 {count, plural, other {#개}}까지 등록할 수 있어요.",
"misc_limits.max_category_channels_reached": "카테고리 채널은 최대 {count, plural, other {#개}}까지 만들 수 있어요.",
"misc_limits.max_friends_reached": "친구는 최대 {count, plural, other {#명}}까지 추가할 수 있어요.",
diff --git a/packages/errors/src/i18n/weblate/locales/lt.json b/packages/errors/src/i18n/weblate/locales/lt.json
index 391b70ed5..e6da64af6 100644
--- a/packages/errors/src/i18n/weblate/locales/lt.json
+++ b/packages/errors/src/i18n/weblate/locales/lt.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Neteisinga užklausa.",
"misc.invalid_snowflake": "Neteisingas snowflake.",
"misc_limits.max_applications_reached": "Pasiekei {limit, plural, one {# programos} few {# programų} many {# programos} other {# programų}} ribą.",
- "misc_limits.max_badges_reached": "Pasiekei šio tipo {count, plural, one {# ženklelio} few {# ženklelių} many {# ženklelio} other {# ženklelių}} ribą.",
+ "misc_limits.max_badges_reached": "Riba yra {count, plural, one {# ženklelis} few {# ženkleliai} many {# ženklelio} other {# ženklelių}}.",
"misc_limits.max_bookmarks_reached": "Pasiekei {count, plural, one {# žymės} few {# žymių} many {# žymės} other {# žymių}} ribą.",
"misc_limits.max_category_channels_reached": "Pasiekei {count, plural, one {# kategorijos kanalo} few {# kategorijos kanalų} many {# kategorijos kanalo} other {# kategorijos kanalų}} ribą.",
"misc_limits.max_friends_reached": "Pasiekei {count, plural, one {# draugo} few {# draugų} many {# draugo} other {# draugų}} ribą.",
diff --git a/packages/errors/src/i18n/weblate/locales/nl.json b/packages/errors/src/i18n/weblate/locales/nl.json
index 8fc7338d8..d2d412bf7 100644
--- a/packages/errors/src/i18n/weblate/locales/nl.json
+++ b/packages/errors/src/i18n/weblate/locales/nl.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Ongeldig verzoek.",
"misc.invalid_snowflake": "Ongeldige snowflake.",
"misc_limits.max_applications_reached": "Je hebt het maximum van {limit, plural, one {# app} other {# apps}} bereikt.",
- "misc_limits.max_badges_reached": "Je hebt het maximum van {count, plural, one {# badge} other {# badges}} voor dit type bereikt.",
+ "misc_limits.max_badges_reached": "De limiet is {count, plural, one {# badge} other {# badges}}.",
"misc_limits.max_bookmarks_reached": "Je hebt het maximum van {count, plural, one {# opgeslagen bericht} other {# opgeslagen berichten}} bereikt.",
"misc_limits.max_category_channels_reached": "Je hebt het maximum van {count, plural, one {# kanaal in een categorie} other {# kanalen in een categorie}} bereikt.",
"misc_limits.max_friends_reached": "Je hebt het maximum van {count, plural, one {# vriend} other {# vrienden}} bereikt.",
diff --git a/packages/errors/src/i18n/weblate/locales/no.json b/packages/errors/src/i18n/weblate/locales/no.json
index d96da02f1..c67fb6840 100644
--- a/packages/errors/src/i18n/weblate/locales/no.json
+++ b/packages/errors/src/i18n/weblate/locales/no.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Ugyldig forespørsel.",
"misc.invalid_snowflake": "Ugyldig snowflake-ID.",
"misc_limits.max_applications_reached": "Du har nådd grensen på {limit, plural, one {# app} other {# apper}}.",
- "misc_limits.max_badges_reached": "Du har nådd grensen på {count, plural, one {# merke} other {# merker}} for denne typen.",
+ "misc_limits.max_badges_reached": "Grensen er {count, plural, one {# merke} other {# merker}}.",
"misc_limits.max_bookmarks_reached": "Du har nådd grensen på {count, plural, one {# lagret melding} other {# lagrede meldinger}}.",
"misc_limits.max_category_channels_reached": "Du har nådd grensen på {count, plural, one {# kategorikanal} other {# kategorikanaler}}.",
"misc_limits.max_friends_reached": "Du har nådd grensen på {count, plural, one {# venn} other {# venner}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/pl.json b/packages/errors/src/i18n/weblate/locales/pl.json
index 183f3c4cd..4e76a9b5b 100644
--- a/packages/errors/src/i18n/weblate/locales/pl.json
+++ b/packages/errors/src/i18n/weblate/locales/pl.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Nieprawidłowe żądanie.",
"misc.invalid_snowflake": "Nieprawidłowy identyfikator Snowflake.",
"misc_limits.max_applications_reached": "Osiągnięto limit {limit, plural, one {# aplikacji} few {# aplikacji} many {# aplikacji} other {# aplikacji}}.",
- "misc_limits.max_badges_reached": "Osiągnięto limit {count, plural, one {# odznaki} few {# odznak} many {# odznak} other {# odznaki}} dla tego typu.",
+ "misc_limits.max_badges_reached": "Limit wynosi {count, plural, one {# odznakę} few {# odznaki} many {# odznak} other {# odznaki}}.",
"misc_limits.max_bookmarks_reached": "Osiągnięto limit {count, plural, one {# zakładki} few {# zakładek} many {# zakładek} other {# zakładki}}.",
"misc_limits.max_category_channels_reached": "Osiągnięto limit {count, plural, one {# kanału} few {# kanałów} many {# kanałów} other {# kanału}} w kategorii.",
"misc_limits.max_friends_reached": "Osiągnięto limit {count, plural, one {# znajomego} few {# znajomych} many {# znajomych} other {# znajomego}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/pt-BR.json b/packages/errors/src/i18n/weblate/locales/pt-BR.json
index cabe14bd7..50b7ef73e 100644
--- a/packages/errors/src/i18n/weblate/locales/pt-BR.json
+++ b/packages/errors/src/i18n/weblate/locales/pt-BR.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Solicitação inválida.",
"misc.invalid_snowflake": "Snowflake inválido.",
"misc_limits.max_applications_reached": "Você atingiu o máximo de {limit, plural, =1 {# aplicativo} other {# aplicativos}}.",
- "misc_limits.max_badges_reached": "Você atingiu o limite de {count, plural, one {# insígnia} other {# insígnias}} para este tipo.",
+ "misc_limits.max_badges_reached": "O limite é de {count, plural, one {# insígnia} other {# insígnias}}.",
"misc_limits.max_bookmarks_reached": "Você atingiu o limite de {count, plural, =1 {# mensagem salva} other {# mensagens salvas}}.",
"misc_limits.max_category_channels_reached": "Você atingiu o limite de {count, plural, =1 {# canal por categoria} other {# canais por categoria}}.",
"misc_limits.max_friends_reached": "Você atingiu o máximo de {count, plural, =1 {# amigo} other {# amigos}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/ro.json b/packages/errors/src/i18n/weblate/locales/ro.json
index 73f9d9a72..9d947896f 100644
--- a/packages/errors/src/i18n/weblate/locales/ro.json
+++ b/packages/errors/src/i18n/weblate/locales/ro.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Solicitare invalidă.",
"misc.invalid_snowflake": "ID-ul Snowflake este invalid.",
"misc_limits.max_applications_reached": "Ai atins numărul maxim de {limit, plural, one {# aplicație} few {# aplicații} other {# de aplicații}}.",
- "misc_limits.max_badges_reached": "Ai atins numărul maxim de {count, plural, one {# insignă} few {# insigne} other {# de insigne}} pentru acest tip.",
+ "misc_limits.max_badges_reached": "Limita este de {count, plural, one {# insignă} few {# insigne} other {# de insigne}}.",
"misc_limits.max_bookmarks_reached": "Ai atins numărul maxim de {count, plural, one {# marcaj} few {# marcaje} other {# de marcaje}}.",
"misc_limits.max_category_channels_reached": "Ai atins numărul maxim de {count, plural, one {# canal de tip categorie} few {# canale de tip categorie} other {# de canale de tip categorie}}.",
"misc_limits.max_friends_reached": "Ai atins numărul maxim de {count, plural, one {# prieten} few {# prieteni} other {# de prieteni}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/ru.json b/packages/errors/src/i18n/weblate/locales/ru.json
index dcd19cff3..276c85d1b 100644
--- a/packages/errors/src/i18n/weblate/locales/ru.json
+++ b/packages/errors/src/i18n/weblate/locales/ru.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Неверный запрос.",
"misc.invalid_snowflake": "Недействительный ID Snowflake.",
"misc_limits.max_applications_reached": "Ты достиг максимума: {limit} {limit, plural, one {приложение} few {приложения} many {приложений} other {приложения}}.",
- "misc_limits.max_badges_reached": "Достигнут максимум для этого типа: {count} {count, plural, one {значок} few {значка} many {значков} other {значка}}.",
+ "misc_limits.max_badges_reached": "Максимум {count} {count, plural, one {значок} few {значка} many {значков} other {значка}}.",
"misc_limits.max_bookmarks_reached": "Ты достиг максимума: {count} {count, plural, one {закладка} few {закладки} many {закладок} other {закладки}}.",
"misc_limits.max_category_channels_reached": "Ты достиг максимума: {count} {count, plural, one {канал} few {канала} many {каналов} other {канала}} в категории.",
"misc_limits.max_friends_reached": "Ты достиг максимума: {count} {count, plural, one {друг} few {друга} many {друзей} other {друга}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/sv-SE.json b/packages/errors/src/i18n/weblate/locales/sv-SE.json
index 0f0c52646..921ab3e1d 100644
--- a/packages/errors/src/i18n/weblate/locales/sv-SE.json
+++ b/packages/errors/src/i18n/weblate/locales/sv-SE.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Ogiltig begäran.",
"misc.invalid_snowflake": "Ogiltig snowflake.",
"misc_limits.max_applications_reached": "Du har nått gränsen på {limit, plural, one {# applikation} other {# applikationer}}.",
- "misc_limits.max_badges_reached": "Du har nått gränsen på {count, plural, one {# märke} other {# märken}} för den här typen.",
+ "misc_limits.max_badges_reached": "Gränsen är {count, plural, one {# märke} other {# märken}}.",
"misc_limits.max_bookmarks_reached": "Du har nått gränsen på {count, plural, one {# bokmärke} other {# bokmärken}}.",
"misc_limits.max_category_channels_reached": "Du har nått gränsen på {count, plural, one {# kanal} other {# kanaler}} i en kategori.",
"misc_limits.max_friends_reached": "Du har nått gränsen på {count, plural, one {# vän} other {# vänner}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/th.json b/packages/errors/src/i18n/weblate/locales/th.json
index c887bf43b..d2b6f22e5 100644
--- a/packages/errors/src/i18n/weblate/locales/th.json
+++ b/packages/errors/src/i18n/weblate/locales/th.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "คำขอไม่ถูกต้อง",
"misc.invalid_snowflake": "Snowflake ไม่ถูกต้อง",
"misc_limits.max_applications_reached": "คุณมีแอปพลิเคชันครบ {limit} {limit, plural, other {รายการ}} แล้ว",
- "misc_limits.max_badges_reached": "คุณมีเหรียญตราประเภทนี้ครบ {count} {count, plural, other {รายการ}} แล้ว",
+ "misc_limits.max_badges_reached": "จำกัดไว้ที่ {count} {count, plural, other {รายการ}}",
"misc_limits.max_bookmarks_reached": "คุณมีบุ๊กมาร์กครบ {count} {count, plural, other {รายการ}} แล้ว",
"misc_limits.max_category_channels_reached": "คุณมีช่องหมวดหมู่ครบ {count} {count, plural, other {ช่อง}} แล้ว",
"misc_limits.max_friends_reached": "คุณมีเพื่อนครบ {count} {count, plural, other {คน}} แล้ว",
diff --git a/packages/errors/src/i18n/weblate/locales/tr.json b/packages/errors/src/i18n/weblate/locales/tr.json
index 5315057bb..e96719297 100644
--- a/packages/errors/src/i18n/weblate/locales/tr.json
+++ b/packages/errors/src/i18n/weblate/locales/tr.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Geçersiz istek.",
"misc.invalid_snowflake": "Geçersiz snowflake.",
"misc_limits.max_applications_reached": "{limit, plural, one {# uygulama} other {# uygulama}} sınırına ulaştın.",
- "misc_limits.max_badges_reached": "Bu tür için {count, plural, one {# rozet} other {# rozet}} sınırına ulaştın.",
+ "misc_limits.max_badges_reached": "Sınır {count, plural, one {# rozet} other {# rozet}}.",
"misc_limits.max_bookmarks_reached": "{count, plural, one {# yer işareti} other {# yer işareti}} sınırına ulaştın.",
"misc_limits.max_category_channels_reached": "{count, plural, one {# kategori kanalı} other {# kategori kanalı}} sınırına ulaştın.",
"misc_limits.max_friends_reached": "{count, plural, one {# arkadaş} other {# arkadaş}} sınırına ulaştın.",
diff --git a/packages/errors/src/i18n/weblate/locales/uk.json b/packages/errors/src/i18n/weblate/locales/uk.json
index ac6377252..2c65ea655 100644
--- a/packages/errors/src/i18n/weblate/locales/uk.json
+++ b/packages/errors/src/i18n/weblate/locales/uk.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Недійсний запит.",
"misc.invalid_snowflake": "Недійсний Snowflake ID.",
"misc_limits.max_applications_reached": "Досягнуто максимуму: {limit} {limit, plural, one {застосунок} few {застосунки} many {застосунків} other {застосунку}}.",
- "misc_limits.max_badges_reached": "Досягнуто максимуму для цього типу: {count} {count, plural, one {значок} few {значки} many {значків} other {значка}}.",
+ "misc_limits.max_badges_reached": "Максимум {count} {count, plural, one {значок} few {значки} many {значків} other {значка}}.",
"misc_limits.max_bookmarks_reached": "Досягнуто максимуму: {count} {count, plural, one {закладка} few {закладки} many {закладок} other {закладки}}.",
"misc_limits.max_category_channels_reached": "Досягнуто максимуму: {count} {count, plural, one {категорія} few {категорії} many {категорій} other {категорії}}.",
"misc_limits.max_friends_reached": "Досягнуто максимуму: {count} {count, plural, one {друг} few {друзі} many {друзів} other {друга}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/vi.json b/packages/errors/src/i18n/weblate/locales/vi.json
index 9901c04b4..7f6de2f08 100644
--- a/packages/errors/src/i18n/weblate/locales/vi.json
+++ b/packages/errors/src/i18n/weblate/locales/vi.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Yêu cầu không hợp lệ.",
"misc.invalid_snowflake": "ID Snowflake không hợp lệ.",
"misc_limits.max_applications_reached": "Bạn đã đạt tối đa {limit} {limit, plural, other {ứng dụng}}.",
- "misc_limits.max_badges_reached": "Bạn đã đạt tối đa {count} {count, plural, other {huy hiệu}} cho loại này.",
+ "misc_limits.max_badges_reached": "Giới hạn là {count} {count, plural, other {huy hiệu}}.",
"misc_limits.max_bookmarks_reached": "Bạn đã đạt tối đa {count} {count, plural, other {tin nhắn đã lưu}}.",
"misc_limits.max_category_channels_reached": "Bạn đã đạt tối đa {count} {count, plural, other {danh mục}}.",
"misc_limits.max_friends_reached": "Bạn đã đạt tối đa {count} {count, plural, other {bạn bè}}.",
diff --git a/packages/errors/src/i18n/weblate/locales/zh-CN.json b/packages/errors/src/i18n/weblate/locales/zh-CN.json
index cd1102be8..0ecba9d72 100644
--- a/packages/errors/src/i18n/weblate/locales/zh-CN.json
+++ b/packages/errors/src/i18n/weblate/locales/zh-CN.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "请求无效。",
"misc.invalid_snowflake": "雪花 ID 无效。",
"misc_limits.max_applications_reached": "你已达到 {limit, plural, other {# 个应用}}的上限。",
- "misc_limits.max_badges_reached": "此类型已达到 {count, plural, other {# 个徽章}}的上限。",
+ "misc_limits.max_badges_reached": "上限为 {count, plural, other {# 个徽章}}。",
"misc_limits.max_bookmarks_reached": "你已达到 {count, plural, other {# 条书签}}的上限。",
"misc_limits.max_category_channels_reached": "你已达到 {count, plural, other {# 个分类频道}}的上限。",
"misc_limits.max_friends_reached": "你已达到 {count, plural, other {# 位好友}}的上限。",
diff --git a/packages/errors/src/i18n/weblate/locales/zh-TW.json b/packages/errors/src/i18n/weblate/locales/zh-TW.json
index fbddbadf2..cb010100b 100644
--- a/packages/errors/src/i18n/weblate/locales/zh-TW.json
+++ b/packages/errors/src/i18n/weblate/locales/zh-TW.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "無效的要求。",
"misc.invalid_snowflake": "無效的 Snowflake。",
"misc_limits.max_applications_reached": "你已達到 {limit, plural, other {# 個應用程式}}的上限。",
- "misc_limits.max_badges_reached": "此類型已達到 {count, plural, other {# 個徽章}}的上限。",
+ "misc_limits.max_badges_reached": "上限為 {count, plural, other {# 個徽章}}。",
"misc_limits.max_bookmarks_reached": "你已達到 {count, plural, other {# 個書籤}}的上限。",
"misc_limits.max_category_channels_reached": "你已達到 {count, plural, other {# 個類別頻道}}的上限。",
"misc_limits.max_friends_reached": "你已達到 {count, plural, other {# 位好友}}的上限。",
diff --git a/packages/errors/src/i18n/weblate/messages.json b/packages/errors/src/i18n/weblate/messages.json
index 89c4a64ce..9b8b4a0c5 100644
--- a/packages/errors/src/i18n/weblate/messages.json
+++ b/packages/errors/src/i18n/weblate/messages.json
@@ -438,7 +438,7 @@
"misc.invalid_request_generic": "Invalid request.",
"misc.invalid_snowflake": "Invalid snowflake.",
"misc_limits.max_applications_reached": "You've reached the maximum of {limit, plural, one {# application} other {# applications}}.",
- "misc_limits.max_badges_reached": "You've reached the maximum of {count, plural, one {# badge} other {# badges}} for this type.",
+ "misc_limits.max_badges_reached": "The limit is {count, plural, one {# badge} other {# badges}}.",
"misc_limits.max_bookmarks_reached": "You've reached the maximum of {count, plural, one {# bookmark} other {# bookmarks}}.",
"misc_limits.max_category_channels_reached": "You've reached the maximum of {count, plural, one {# category channel} other {# category channels}}.",
"misc_limits.max_friends_reached": "You've reached the maximum of {count, plural, one {# friend} other {# friends}}.",
diff --git a/packages/instance_bootstrap/src/ClientRuntimeDiscovery.ts b/packages/instance_bootstrap/src/ClientRuntimeDiscovery.ts
index e15aecb88..b285668ad 100644
--- a/packages/instance_bootstrap/src/ClientRuntimeDiscovery.ts
+++ b/packages/instance_bootstrap/src/ClientRuntimeDiscovery.ts
@@ -63,6 +63,8 @@ export interface ClientRuntimeDiscovery {
readonly domainMigration: InstanceDomainMigration | null;
readonly notice?: InstanceNotice | null;
readonly guildBadges: ReadonlyArray<InstanceGuildBadge>;
+ readonly guildBadgesPartial: boolean;
+ readonly customBadgesVersion: string | null;
readonly builtInGuildBadgeImages: InstanceBuiltInGuildBadgeImages;
}
@@ -84,6 +86,8 @@ export function projectClientRuntimeDiscovery(document: InstanceDiscoveryDocumen
domainMigration: document.domainMigration,
notice: document.notice ?? null,
guildBadges: document.guildBadges ?? [],
+ guildBadgesPartial: document.guildBadgesPartial ?? false,
+ customBadgesVersion: document.customBadgesVersion ?? null,
builtInGuildBadgeImages: document.builtInGuildBadgeImages ?? NO_BUILT_IN_GUILD_BADGE_IMAGES,
};
}
diff --git a/packages/instance_bootstrap/src/Discovery.ts b/packages/instance_bootstrap/src/Discovery.ts
index a2872724e..5455dea71 100644
--- a/packages/instance_bootstrap/src/Discovery.ts
+++ b/packages/instance_bootstrap/src/Discovery.ts
@@ -146,6 +146,8 @@ export interface InstanceDiscoveryDocument {
readonly domainMigration: InstanceDomainMigration | null;
readonly notice?: InstanceNotice | null;
readonly guildBadges?: ReadonlyArray<InstanceGuildBadge>;
+ readonly guildBadgesPartial?: boolean;
+ readonly customBadgesVersion?: string | null;
readonly builtInGuildBadgeImages?: InstanceBuiltInGuildBadgeImages;
}
@@ -310,6 +312,8 @@ export function parseInstanceDiscoveryDocument(payload: unknown): InstanceDiscov
domainMigration: parseInstanceDomainMigration(source.domain_migration),
notice: parseNotice(source.notice),
guildBadges: parseGuildBadges(source.guild_badges),
+ guildBadgesPartial: source.guild_badges_partial === true,
+ customBadgesVersion: readNonEmptyString(source, 'custom_badges_version'),
builtInGuildBadgeImages: parseBuiltInGuildBadgeImages(source.built_in_guild_badge_images),
};
}
@@ -724,6 +728,7 @@ function parseGuildBadges(value: unknown): Array<InstanceGuildBadge> {
if (id == null || name == null || assetUrl == null) {
return [];
}
+ const position = readNonEmptyString(source, 'position');
return [
{
id,
@@ -731,6 +736,7 @@ function parseGuildBadges(value: unknown): Array<InstanceGuildBadge> {
description: readNonEmptyString(source, 'description'),
asset_url: assetUrl,
href: readAbsoluteHTTPURL(source, 'href'),
+ ...(position != null && /^-?[0-9]{1,19}$/.test(position) ? {position} : {}),
},
];
});
diff --git a/packages/schema/src/domains/admin/AdminBadgeSchemas.ts b/packages/schema/src/domains/admin/AdminBadgeSchemas.ts
index d139a5ef5..7318e0a9c 100644
--- a/packages/schema/src/domains/admin/AdminBadgeSchemas.ts
+++ b/packages/schema/src/domains/admin/AdminBadgeSchemas.ts
@@ -3,12 +3,17 @@
import {
BUILT_IN_BADGE_KINDS,
CUSTOM_BADGE_DESCRIPTION_MAX_LENGTH,
+ CUSTOM_BADGE_LOOKUP_IDS_MAX,
CUSTOM_BADGE_NAME_MAX_LENGTH,
+ CUSTOM_BADGE_PAGE_LIMIT_DEFAULT,
+ CUSTOM_BADGE_PAGE_LIMIT_MAX,
+ CUSTOM_BADGE_REORDER_IDS_MAX,
+ CUSTOM_BADGES_PER_GUILD_CEILING,
+ CUSTOM_BADGES_PER_USER_CEILING,
CustomBadgeTypes,
- MAX_CUSTOM_BADGES_PER_ENTITY,
- MAX_CUSTOM_BADGES_PER_TYPE,
} from '@fluxer/constants/src/BadgeConstants';
import {ValidationErrorCodes} from '@fluxer/constants/src/ValidationErrorCodes';
+import {createQueryIntegerType} from '@fluxer/schema/src/primitives/QueryValidators';
import {
createNamedStringLiteralUnion,
createStringType,
@@ -40,9 +45,20 @@ const CustomBadgeImageType = z
.max(16_000_000)
.describe('The badge image as a base64 data URL. PNG, JPEG, GIF, WebP and SVG images are accepted');
+export const CustomBadgePositionType = z
+ .string()
+ .regex(/^-?[0-9]{1,19}$/)
+ .describe('Display position of the badge. Badges are shown in ascending order of this value');
+
+export const CustomBadgeCursorType = z
+ .string()
+ .regex(/^[gu]-?[0-9]{1,19}$/)
+ .describe('Opaque cursor from the next field of a previous page');
+
export const AdminCustomBadgeResponse = z.object({
id: SnowflakeStringType.describe('The ID of the badge'),
type: CustomBadgeTypeSchema,
+ position: CustomBadgePositionType,
name: z.string().describe('The name of the badge'),
description: z.string().nullable().describe('Text shown under the name when hovering over the badge, or null'),
asset_url: z.string().describe('URL of the badge image, served as WebP by the media proxy'),
@@ -76,8 +92,60 @@ export const AdminBuiltInBadgeImageResponse = z.object({
export type AdminBuiltInBadgeImageResponse = z.infer<typeof AdminBuiltInBadgeImageResponse>;
+export const AdminCustomBadgeSettingsResponse = z.object({
+ max_per_user: z
+ .number()
+ .int()
+ .min(1)
+ .max(CUSTOM_BADGES_PER_USER_CEILING)
+ .describe('Most custom badges one user can be given'),
+ max_per_guild: z
+ .number()
+ .int()
+ .min(1)
+ .max(CUSTOM_BADGES_PER_GUILD_CEILING)
+ .describe('Most custom badges one community can be given'),
+});
+
+export type AdminCustomBadgeSettingsResponse = z.infer<typeof AdminCustomBadgeSettingsResponse>;
+
+export const UpdateCustomBadgeSettingsRequest = AdminCustomBadgeSettingsResponse.partial();
+
+export type UpdateCustomBadgeSettingsRequest = z.infer<typeof UpdateCustomBadgeSettingsRequest>;
+
+export const AdminCustomBadgeListQuery = z.object({
+ type: CustomBadgeTypeSchema.optional().describe(
+ 'Only list badges of this type. Without it the list holds every user badge, then every guild badge',
+ ),
+ query: createStringType(1, 64)
+ .optional()
+ .describe('Only list badges with this ID, or with this text anywhere in the name, ignoring case'),
+ ids: z
+ .string()
+ .regex(new RegExp(`^[0-9]{1,20}(?:,[0-9]{1,20}){0,${CUSTOM_BADGE_LOOKUP_IDS_MAX - 1}}$`))
+ .optional()
+ .describe(
+ `Up to ${CUSTOM_BADGE_LOOKUP_IDS_MAX} badge IDs separated by commas. Only these badges are listed, and the page has no next. Cannot be sent with query or after`,
+ ),
+ after: CustomBadgeCursorType.optional(),
+ limit: createQueryIntegerType({
+ defaultValue: CUSTOM_BADGE_PAGE_LIMIT_DEFAULT,
+ minValue: 1,
+ maxValue: CUSTOM_BADGE_PAGE_LIMIT_MAX,
+ }).describe(`Most badges to return, from 1 to ${CUSTOM_BADGE_PAGE_LIMIT_MAX}`),
+});
+
+export type AdminCustomBadgeListQuery = z.infer<typeof AdminCustomBadgeListQuery>;
+
export const AdminCustomBadgeListResponse = z.object({
- badges: z.array(AdminCustomBadgeResponse).describe('Badges defined on this instance, in display order'),
+ badges: z.array(AdminCustomBadgeResponse).describe('One page of badges, in display order'),
+ next: CustomBadgeCursorType.nullable().describe(
+ 'Pass this as after to get the next page, or null when there are no more badges to look at. A search page can hold fewer badges than the limit and still have a next page',
+ ),
+ version: z
+ .string()
+ .describe('Version of the badge catalog. It changes whenever a badge is created, edited, deleted or moved'),
+ settings: AdminCustomBadgeSettingsResponse,
built_in: z
.array(AdminBuiltInBadgeImageResponse)
.max(BUILT_IN_BADGE_KINDS.length)
@@ -117,8 +185,10 @@ export const CustomBadgeIdParam = z.object({
export const CustomBadgeIdsType = z
.array(SnowflakeType)
- .max(MAX_CUSTOM_BADGES_PER_ENTITY)
- .describe('IDs of the badges to assign, replacing the current ones');
+ .max(CUSTOM_BADGES_PER_USER_CEILING)
+ .describe(
+ 'IDs of the badges to assign, replacing the current ones. The badge settings set how many a user or community can have',
+ );
export const UpdateUserCustomBadgesRequest = z.object({
badge_ids: CustomBadgeIdsType,
@@ -129,15 +199,42 @@ export type UpdateUserCustomBadgesRequest = z.infer<typeof UpdateUserCustomBadge
export const ReorderCustomBadgesRequest = z.object({
badge_ids: z
.array(SnowflakeType)
- .max(MAX_CUSTOM_BADGES_PER_TYPE * 2)
- .describe('IDs of every custom badge on this instance, user and guild, in the new display order'),
+ .max(CUSTOM_BADGE_REORDER_IDS_MAX)
+ .describe(
+ `IDs of every custom badge on this instance, user and guild, in the new display order. Instances with more than ${CUSTOM_BADGE_REORDER_IDS_MAX} badges move badges one at a time`,
+ ),
});
export type ReorderCustomBadgesRequest = z.infer<typeof ReorderCustomBadgesRequest>;
+export const CustomBadgeMoveDirectionSchema = withOpenApiType(
+ createNamedStringLiteralUnion(
+ [
+ ['up', 'Up', 'Swap places with the badge shown before it'],
+ ['down', 'Down', 'Swap places with the badge shown after it'],
+ ['first', 'First', 'Show it before every other badge of its type'],
+ ['last', 'Last', 'Show it after every other badge of its type'],
+ ],
+ 'Where to move the badge',
+ ),
+ 'CustomBadgeMoveDirection',
+);
+
+export const MoveCustomBadgeRequest = z.object({
+ badge_id: SnowflakeType.describe('The ID of the badge to move'),
+ direction: CustomBadgeMoveDirectionSchema.optional(),
+ after_id: SnowflakeType.nullable()
+ .optional()
+ .describe(
+ 'Show the badge right after this badge of the same type, or first when null. Send either this or direction',
+ ),
+});
+
+export type MoveCustomBadgeRequest = z.infer<typeof MoveCustomBadgeRequest>;
+
export const CustomBadgeIdListResponse = z
.array(SnowflakeStringType)
- .max(MAX_CUSTOM_BADGES_PER_ENTITY)
+ .max(CUSTOM_BADGES_PER_USER_CEILING)
.describe('IDs of the custom badges assigned to it');
export const BuiltInBadgeKindParam = z.object({
diff --git a/packages/schema/src/domains/guild/GuildResponseSchemas.ts b/packages/schema/src/domains/guild/GuildResponseSchemas.ts
index d3adb5e59..0c021e231 100644
--- a/packages/schema/src/domains/guild/GuildResponseSchemas.ts
+++ b/packages/schema/src/domains/guild/GuildResponseSchemas.ts
@@ -157,7 +157,7 @@ export const GuildResponse = z.object({
afk_timeout: Int32Type.describe('AFK timeout in seconds before moving users to the AFK channel'),
features: GuildFeatureListSchema,
badge_ids: CustomBadgeIdListResponse.describe(
- 'IDs of the custom badges assigned to the community. Look them up in guild_badges of the instance discovery document and skip IDs that are not there',
+ 'IDs of the custom badges assigned to the community. Look them up in guild_badges of the instance discovery document. When guild_badges_partial is true, look up the IDs that are not there with GET /instance/badges?ids=...&version=custom_badges_version, and skip IDs that it does not return',
),
verification_level: withFieldDescription(
GuildVerificationLevelSchema,
diff --git a/packages/schema/src/domains/instance/InstanceSchemas.ts b/packages/schema/src/domains/instance/InstanceSchemas.ts
index 14007190f..bde62b66a 100644
--- a/packages/schema/src/domains/instance/InstanceSchemas.ts
+++ b/packages/schema/src/domains/instance/InstanceSchemas.ts
@@ -6,7 +6,12 @@ import {
AccountIdentityModes,
TagStyles,
} from '@fluxer/constants/src/AccountIdentityConstants';
-import {MAX_CUSTOM_BADGES_PER_TYPE} from '@fluxer/constants/src/BadgeConstants';
+import {
+ CUSTOM_BADGE_LOOKUP_IDS_MAX,
+ CUSTOM_BADGE_PAGE_LIMIT_DEFAULT,
+ CUSTOM_BADGE_PAGE_LIMIT_MAX,
+ DISCOVERY_GUILD_BADGE_LIMIT,
+} from '@fluxer/constants/src/BadgeConstants';
import {
CaptchaProviderSchema,
EffectiveVerificationBasisSchema,
@@ -15,8 +20,10 @@ import {
InstantAccountAvailabilitySchema,
InteractionTierModeSchema,
} from '@fluxer/schema/src/domains/account/AccountTierSchemas';
+import {CustomBadgeCursorType, CustomBadgePositionType} from '@fluxer/schema/src/domains/admin/AdminBadgeSchemas';
import {DomainMigrationDiscoveryResponse} from '@fluxer/schema/src/domains/admin/DomainMigrationSchemas';
import {SsoStatusResponse} from '@fluxer/schema/src/domains/auth/AuthSchemas';
+import {createQueryIntegerType} from '@fluxer/schema/src/primitives/QueryValidators';
import {
createNamedStringLiteralUnion,
createStringType,
@@ -395,10 +402,54 @@ export const InstanceGuildBadgeSchema = z.object({
description: z.string().nullable().describe('Text shown under the name when hovering over the badge, or null'),
asset_url: z.string().describe('URL of the badge image, served as WebP by the media proxy'),
href: z.string().nullable().describe('URL opened when the badge is clicked, or null'),
+ position: CustomBadgePositionType.optional(),
});
export type InstanceGuildBadge = z.infer<typeof InstanceGuildBadgeSchema>;
+export const InstanceBadgeSchema = InstanceGuildBadgeSchema.extend({position: CustomBadgePositionType});
+
+export type InstanceBadge = z.infer<typeof InstanceBadgeSchema>;
+
+const CustomBadgesVersionType = z
+ .string()
+ .max(64)
+ .describe('Version of the badge catalog. It changes whenever a badge is created, edited, deleted or moved');
+
+export const InstanceBadgesQuery = z.object({
+ ids: z
+ .string()
+ .regex(new RegExp(`^[0-9]{1,20}(?:,[0-9]{1,20}){0,${CUSTOM_BADGE_LOOKUP_IDS_MAX - 1}}$`))
+ .optional()
+ .describe(
+ `Up to ${CUSTOM_BADGE_LOOKUP_IDS_MAX} badge IDs separated by commas. Only these badges are returned. Cannot be sent with after`,
+ ),
+ after: CustomBadgeCursorType.optional(),
+ limit: createQueryIntegerType({
+ defaultValue: CUSTOM_BADGE_PAGE_LIMIT_DEFAULT,
+ minValue: 1,
+ maxValue: CUSTOM_BADGE_PAGE_LIMIT_MAX,
+ }).describe(`Most badges to return, from 1 to ${CUSTOM_BADGE_PAGE_LIMIT_MAX}. Not used with ids`),
+ version: CustomBadgesVersionType.optional().describe(
+ 'The catalog version the client already holds. When it is the current version the response can be cached for a day',
+ ),
+});
+
+export type InstanceBadgesQuery = z.infer<typeof InstanceBadgesQuery>;
+
+export const InstanceBadgesResponse = z.object({
+ version: CustomBadgesVersionType,
+ badges: z
+ .array(InstanceGuildBadgeSchema.required({position: true}))
+ .max(CUSTOM_BADGE_PAGE_LIMIT_MAX)
+ .describe('Community badges in display order. IDs that are unknown or deleted are left out'),
+ next: CustomBadgeCursorType.nullable().describe(
+ 'Pass this as after to get the next page, or null on the last page and for a lookup by ids',
+ ),
+});
+
+export type InstanceBadgesResponse = z.infer<typeof InstanceBadgesResponse>;
+
const BuiltInGuildBadgeImageType = z
.string()
.nullable()
@@ -435,9 +486,16 @@ export const WellKnownFluxerResponse = z.object({
),
guild_badges: z
.array(InstanceGuildBadgeSchema)
- .max(MAX_CUSTOM_BADGES_PER_TYPE)
+ .max(DISCOVERY_GUILD_BADGE_LIMIT)
+ .optional()
+ .describe(
+ `The first ${DISCOVERY_GUILD_BADGE_LIMIT} custom badges that communities on this instance can show next to their name, in display order. GET /instance/badges serves every badge`,
+ ),
+ guild_badges_partial: z
+ .boolean()
.optional()
- .describe('Custom badges that communities on this instance can show next to their name, in display order'),
+ .describe('True when the instance has more community badges than guild_badges lists'),
+ custom_badges_version: CustomBadgesVersionType.optional(),
built_in_guild_badge_images: InstanceBuiltInGuildBadgeImagesSchema.optional().describe(
'Images this instance shows in place of the built-in verified, partnered and discoverable community badges',
),
diff --git a/packages/schema/src/domains/message/CrosspostSourceSchemas.ts b/packages/schema/src/domains/message/CrosspostSourceSchemas.ts
index d555a72cf..9fb496a81 100644
--- a/packages/schema/src/domains/message/CrosspostSourceSchemas.ts
+++ b/packages/schema/src/domains/message/CrosspostSourceSchemas.ts
@@ -18,7 +18,7 @@ export const CrosspostSourceGuildResponse = z.object({
.array(GuildFeatureSchema)
.describe('The public badge features of the source community: VERIFIED, PARTNERED and DISCOVERABLE only'),
badge_ids: CustomBadgeIdListResponse.describe(
- 'IDs of the custom badges assigned to the source community. Look them up in guild_badges of the instance discovery document',
+ 'IDs of the custom badges assigned to the source community. Look them up in guild_badges of the instance discovery document. When guild_badges_partial is true, look up the IDs that are not there with GET /instance/badges?ids=...&version=custom_badges_version, and skip IDs that it does not return',
),
approximate_member_count: Int32Type.nullable().describe(
'Approximate number of members in the source community, or null when unavailable',
diff --git a/tools/dev/cassandra_target_schema.json b/tools/dev/cassandra_target_schema.json
index e0eda47fa..4ced0be6f 100644
--- a/tools/dev/cassandra_target_schema.json
+++ b/tools/dev/cassandra_target_schema.json
@@ -3752,6 +3752,84 @@
"primary_key": "((source_message_id), webhook_id)",
"options": ""
},
+ {
+ "name": "custom_badges",
+ "columns": [
+ {
+ "name": "badge_id",
+ "type": "bigint"
+ },
+ {
+ "name": "type",
+ "type": "text"
+ },
+ {
+ "name": "position",
+ "type": "bigint"
+ },
+ {
+ "name": "name",
+ "type": "text"
+ },
+ {
+ "name": "description",
+ "type": "text"
+ },
+ {
+ "name": "asset",
+ "type": "text"
+ },
+ {
+ "name": "href",
+ "type": "text"
+ },
+ {
+ "name": "updated_at",
+ "type": "timestamp"
+ }
+ ],
+ "primary_key": "((badge_id))",
+ "options": ""
+ },
+ {
+ "name": "custom_badges_by_position",
+ "columns": [
+ {
+ "name": "badge_id",
+ "type": "bigint"
+ },
+ {
+ "name": "type",
+ "type": "text"
+ },
+ {
+ "name": "position",
+ "type": "bigint"
+ },
+ {
+ "name": "name",
+ "type": "text"
+ },
+ {
+ "name": "description",
+ "type": "text"
+ },
+ {
+ "name": "asset",
+ "type": "text"
+ },
+ {
+ "name": "href",
+ "type": "text"
+ },
+ {
+ "name": "updated_at",
+ "type": "timestamp"
+ }
+ ],
+ "primary_key": "((type), position)",
+ "options": "CLUSTERING ORDER BY (position ASC) AND gc_grace_seconds = 86400"
+ },
{
"name": "data_service_search_index_files",
"columns": [