Skip to content

Commit

Permalink
add anonymous i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
juunini committed Jan 5, 2025
1 parent e80080b commit 9f681ac
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3177,3 +3177,6 @@ _searchSite:
otherDescription: "Use other search engine"
query: "Query"
queryDescription: "Input query scheme for search engine. For example, if https://www.google.com/search?q=test, input 'q'."
_yodangang:
anonymousChannel: "Anonymous channel"
anonymousUsername: "Anonymous"
3 changes: 3 additions & 0 deletions locales/ko-KR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3192,3 +3192,6 @@ _searchSite:
otherDescription: "검색 엔진을 직접 지정할 수 있어요."
query: "검색 쿼리"
queryDescription: "검색 엔진이 사용할 쿼리를 입력해 주세요. (예: https://www.google.com/search?q=test 의 경우 q를 입력)"
_yodangang:
anonymousChannel: "익명 채널"
anonymousUsername: "익명의 유령"
2 changes: 1 addition & 1 deletion packages/backend/src/anonymize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function anonymizeNote(note: MiNote | any, meId: string | null = '') {

note.replyUserId = note.replyUserId ? 'anonymous' : null;
note.renoteUserId = note.replyUserId ? 'anonymous' : null;

if (meId == null) {
note.cw = null;
note.fileIds = [];
Expand Down
6 changes: 6 additions & 0 deletions packages/frontend/src/components/MkNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,12 @@ function emitUpdReaction(emoji: string, delta: number) {
emit('reaction', emoji);
}
}

if (note.value.channel?.anonymous && $i.id !== note.value.userId) {
note.value.userId = '';
note.value.user.id = '';
note.value.user.username = i18n.ts._yodangang.anonymousUsername;
}
</script>

<style lang="scss" module>
Expand Down
6 changes: 6 additions & 0 deletions packages/frontend/src/components/MkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,12 @@ if (appearNote.value.reply && appearNote.value.reply.replyId && defaultStore.sta
function showOnRemote() {
if (props.note.user.instance !== undefined) window.open(props.note.url ?? props.note.uri, '_blank', 'noopener');
}

if (note.value.channel?.anonymous && $i.id !== note.value.userId) {
note.value.userId = '';
note.value.user.id = '';
note.value.user.username = i18n.ts._yodangang.anonymousUsername;
}
</script>

<style lang="scss" module>
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/channel-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkSwitch>

<MkSwitch v-model="anonymous">
<template #label>Anonymous</template>
<template #label>{{ i18n.ts._yodangang.anonymousChannel }}</template>
</MkSwitch>

<div>
Expand Down

0 comments on commit 9f681ac

Please sign in to comment.