diff --git a/app/components/Profile.vue b/app/components/Profile.vue index 846c5a366..0ee20d66f 100644 --- a/app/components/Profile.vue +++ b/app/components/Profile.vue @@ -6,6 +6,7 @@ import { buildFlags } from '#shared/flags.ts'; import { buildImageUrl } from '#shared/helpers.ts'; import type { Profile, UserWithProfiles } from '#shared/profile.ts'; import useConfig from '~/composables/useConfig.ts'; +import useDialogue from '~/composables/useDialogue'; import useMainPronoun from '~/composables/useMainPronoun.ts'; import useSpelling from '~/composables/useSpelling.ts'; import { loadCalendar, loadPronounLibrary } from '~/src/data.ts'; @@ -23,6 +24,7 @@ const props = withDefaults(defineProps<{ const { $translator: translator } = useNuxtApp(); const { convertName } = useSpelling(); const config = useConfig(); +const dialogue = useDialogue(); const pronounLibrary = await loadPronounLibrary(config); @@ -87,11 +89,24 @@ const usedOpinions = computed(() => {

@{{ user.username }}

-

- +

+ contact.team.member + + + user.personally.badge +

diff --git a/locale/en/translations.suml b/locale/en/translations.suml index 054192d47..0c8f89b17 100644 --- a/locale/en/translations.suml +++ b/locale/en/translations.suml @@ -917,6 +917,9 @@ user: Your account was created using a method that didn't share a verified email address with us. Please change the placeholder below to your email and confirm it with a code – this way you'll have a fallback login method in case you lose access to the one you used. + personally: + badge: 'Met us in person' + description: 'If you''ve met the team at a pride event or a workshop, reach out via email or our community discord to get a badge.' profile: description: 'Description' diff --git a/locale/pl/translations.suml b/locale/pl/translations.suml index 73da15341..cf11a36c0 100644 --- a/locale/pl/translations.suml +++ b/locale/pl/translations.suml @@ -1558,6 +1558,9 @@ user: Twoje konto zostało utworzone z użyciem metody logowania, która nie udostępniła nam zweryfikowanego adresu email. Aby mieć dostępny zapasowy sposób logowania, gdybyś straciłx dostęp do obecnego, wpisz swój adres email poniżej i potwierdź go kodem. + personally: + badge: 'Poznałx nas w realu' + description: 'Jeśli poznałxś osoby członkowskie kolektywu na wydarzeniu pridowym albo warsztatach, daj nam znać przez maila albo na naszym discordzie społeczności, aby otrzymać odznakę.' profile: description: 'Opis' diff --git a/migrations/093-user-personally.sql b/migrations/093-user-personally.sql new file mode 100644 index 000000000..d5b9ed24a --- /dev/null +++ b/migrations/093-user-personally.sql @@ -0,0 +1,6 @@ +-- Up + +ALTER TABLE users ADD COLUMN personally INT DEFAULT 0; + +-- Down + diff --git a/server/express/profile.ts b/server/express/profile.ts index 4c48965c3..632473198 100644 --- a/server/express/profile.ts +++ b/server/express/profile.ts @@ -588,11 +588,16 @@ router.get('/profile/get/:username', handleErrorAsync(async (req, res) => { users.bannedReason, users.bannedTerms, users.bannedBy, - users.roles NOT IN ('', '*-external') AS team + users.roles NOT IN ('', '*-external') AS team, + users.personally FROM users WHERE users.usernameNorm = ${normalise(req.params.username)} `); + if (!user) { + return res.status(404).json({ error: 'User not found' }); + } + return await fetchProfilesRoute(req, res, locale, user as User); })); @@ -608,11 +613,16 @@ router.get('/profile/get-id/:id', handleErrorAsync(async (req, res) => { users.bannedReason, users.bannedTerms, users.bannedBy, - users.roles NOT IN ('', '*-external') AS team + users.roles NOT IN ('', '*-external') AS team, + users.personally FROM users WHERE users.id = ${req.params.id} `); + if (!user) { + return res.status(404).json({ error: 'User not found' }); + } + return await fetchProfilesRoute(req, res, locale, user as User); })); diff --git a/server/express/user.ts b/server/express/user.ts index 588597b81..5263c54af 100644 --- a/server/express/user.ts +++ b/server/express/user.ts @@ -60,6 +60,7 @@ export interface UserRow { loginAttempts: string | null; timesheets: string | null; socialLookup: number; + personally: 0 | 1; } export interface AuthenticatorRow { diff --git a/shared/profile.ts b/shared/profile.ts index 6bf17e59f..3f005307d 100644 --- a/shared/profile.ts +++ b/shared/profile.ts @@ -12,6 +12,7 @@ export interface UserWithProfiles { bannedBy: string | null; team: string; profiles: Record; + personally: 0 | 1; } export interface Profile {