Birthdays

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2022-02-13 19:07:49 +01:00
parent 8ade11783a
commit 79d02bddbe
8 changed files with 60 additions and 5 deletions

View File

@ -29,6 +29,8 @@ const ProfileTab = {
newLocked: this.$store.state.users.currentUser.locked,
newNoRichText: this.$store.state.users.currentUser.no_rich_text,
newDefaultScope: this.$store.state.users.currentUser.default_scope,
newBirthday: this.$store.state.users.currentUser.birthday,
showBirthday: this.$store.state.users.currentUser.show_birthday,
newFields: this.$store.state.users.currentUser.fields.map(field => ({ name: field.name, value: field.value })),
hideFollows: this.$store.state.users.currentUser.hide_follows,
hideFollowers: this.$store.state.users.currentUser.hide_followers,
@ -132,7 +134,9 @@ const ProfileTab = {
allow_following_move: this.allowFollowingMove,
hide_follows_count: this.hideFollowsCount,
hide_followers_count: this.hideFollowersCount,
show_role: this.showRole
show_role: this.showRole,
birthday: this.newBirthday || null,
show_birthday: this.showBirthday
/* eslint-enable camelcase */
} }).then((user) => {
this.newFields.splice(user.fields.length)

View File

@ -124,4 +124,9 @@
padding: 0 0.5em;
}
}
.birthday-input {
display: block;
margin-bottom: 1em;
}
}

View File

@ -95,6 +95,18 @@
{{ $t('settings.discoverable') }}
</Checkbox>
</p>
<div>
<p>{{ $t('settings.birthday.label') }}</p>
<input
id="birthday"
v-model="newBirthday"
type="date"
class="birthday-input"
>
<Checkbox v-model="showBirthday">
{{ $t('settings.birthday.show_birthday') }}
</Checkbox>
</div>
<div v-if="maxFields > 0">
<p>{{ $t('settings.profile_fields.label') }}</p>
<div

View File

@ -7,13 +7,16 @@ import TabSwitcher from 'src/components/tab_switcher/tab_switcher.js'
import RichContent from 'src/components/rich_content/rich_content.jsx'
import List from '../list/list.vue'
import withLoadMore from '../../hocs/with_load_more/with_load_more'
import localeService from 'src/services/locale/locale.service.js'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
faCircleNotch
faCircleNotch,
faBirthdayCake
} from '@fortawesome/free-solid-svg-icons'
library.add(
faCircleNotch
faCircleNotch,
faBirthdayCake
)
const FollowerList = withLoadMore({
@ -75,6 +78,10 @@ const UserProfile = {
},
followersTabVisible () {
return this.isUs || !this.user.hide_followers
},
formattedBirthday () {
const browserLocale = localeService.internalToBrowserLocale(this.$i18n.locale)
return this.user.birthday && new Date(Date.parse(this.user.birthday)).toLocaleDateString(browserLocale, { timeZone: 'UTC', day: 'numeric', month: 'long', year: 'numeric' })
}
},
methods: {

View File

@ -11,6 +11,16 @@
:allow-zooming-avatar="true"
rounded="top"
/>
<span
v-if="!!user.birthday"
class="user-birthday"
>
<FAIcon
class="fa-old-padding"
icon="birthday-cake"
/>
{{ $t('user_card.birthday', { birthday: formattedBirthday }) }}
</span>
<div
v-if="user.fields_html && user.fields_html.length > 0"
class="user-profile-fields"
@ -138,6 +148,10 @@
flex: 2;
flex-basis: 500px;
.user-birthday {
margin: 0 0.75em 0.5em;
}
.user-profile-fields {
margin: 0 0.5em;

View File

@ -399,6 +399,10 @@
"name": "Label",
"value": "Content"
},
"birthday": {
"label": "Birthday",
"show_birthday": "Show my birthday"
},
"use_contain_fit": "Don't crop the attachment in thumbnails",
"name": "Name",
"name_bio": "Name & bio",
@ -774,6 +778,7 @@
"hide_repeats": "Hide repeats",
"show_repeats": "Show repeats",
"bot": "Bot",
"birthday": "Born {birthday}",
"admin_menu": {
"moderation": "Moderation",
"grant_admin": "Grant Admin",

View File

@ -633,7 +633,11 @@
"reply_visibility_following_short": "Pokazuj odpowiedzi obserwującym",
"reply_visibility_self_short": "Pokazuj odpowiedzi tylko do mnie",
"sensitive_by_default": "Domyślnie oznaczaj wpisy jako wrażliwe",
"hide_shoutbox": "Ukryj shoutbox instancji"
"hide_shoutbox": "Ukryj shoutbox instancji",
"birthday": {
"label": "Urodziny",
"show_birthday": "Pokazuj moją datę urodzenia"
}
},
"time": {
"day": "{0} dzień",
@ -770,7 +774,8 @@
"highlight": {
"disabled": "Bez wyróżnienia"
},
"bot": "Bot"
"bot": "Bot",
"birthday": "Urodzony(-a) {birthday}"
},
"user_profile": {
"timeline_title": "Oś czasu użytkownika",

View File

@ -118,6 +118,8 @@ export const parseUser = (data) => {
} else {
output.role = 'member'
}
output.birthday = data.pleroma.birthday
}
if (data.source) {
@ -128,6 +130,7 @@ export const parseUser = (data) => {
output.no_rich_text = data.source.pleroma.no_rich_text
output.show_role = data.source.pleroma.show_role
output.discoverable = data.source.pleroma.discoverable
output.show_birthday = data.pleroma.show_birthday
}
}