Added a setting to hide follow/follower count from the user profile

This commit is contained in:
eugenijm 2019-09-13 16:15:19 +03:00
parent 9b163d2816
commit aafb29c589
6 changed files with 37 additions and 1 deletions

View file

@ -41,6 +41,8 @@ const UserSettings = {
newDefaultScope: this.$store.state.users.currentUser.default_scope, newDefaultScope: this.$store.state.users.currentUser.default_scope,
hideFollows: this.$store.state.users.currentUser.hide_follows, hideFollows: this.$store.state.users.currentUser.hide_follows,
hideFollowers: this.$store.state.users.currentUser.hide_followers, hideFollowers: this.$store.state.users.currentUser.hide_followers,
hideFollowsCount: this.$store.state.users.currentUser.hide_follows_count,
hideFollowersCount: this.$store.state.users.currentUser.hide_followers_count,
showRole: this.$store.state.users.currentUser.show_role, showRole: this.$store.state.users.currentUser.show_role,
role: this.$store.state.users.currentUser.role, role: this.$store.state.users.currentUser.role,
pickAvatarBtnVisible: true, pickAvatarBtnVisible: true,
@ -142,6 +144,8 @@ const UserSettings = {
no_rich_text: this.newNoRichText, no_rich_text: this.newNoRichText,
hide_follows: this.hideFollows, hide_follows: this.hideFollows,
hide_followers: this.hideFollowers, hide_followers: this.hideFollowers,
hide_follows_count: this.hideFollowsCount,
hide_followers_count: this.hideFollowersCount,
show_role: this.showRole show_role: this.showRole
/* eslint-enable camelcase */ /* eslint-enable camelcase */
} }).then((user) => { } }).then((user) => {

View file

@ -88,6 +88,15 @@
> >
<label for="account-hide-follows">{{ $t('settings.hide_follows_description') }}</label> <label for="account-hide-follows">{{ $t('settings.hide_follows_description') }}</label>
</p> </p>
<p class="setting-subitem">
<input
id="account-hide-follows-count"
v-model="hideFollowsCount"
type="checkbox"
:disabled="!hideFollows"
>
<label for="account-hide-follows-count">{{ $t('settings.hide_follows_count_description') }}</label>
</p>
<p> <p>
<input <input
id="account-hide-followers" id="account-hide-followers"
@ -96,6 +105,15 @@
> >
<label for="account-hide-followers">{{ $t('settings.hide_followers_description') }}</label> <label for="account-hide-followers">{{ $t('settings.hide_followers_description') }}</label>
</p> </p>
<p class="setting-subitem">
<input
id="account-hide-followers-count"
v-model="hideFollowersCount"
type="checkbox"
:disabled="!hideFollowers"
>
<label for="account-hide-followers-count">{{ $t('settings.hide_followers_count_description') }}</label>
</p>
<p> <p>
<input <input
id="account-show-role" id="account-show-role"
@ -617,5 +635,9 @@
width: 10em; width: 10em;
} }
} }
.setting-subitem {
margin-left: 1.75em;
}
} }
</style> </style>

View file

@ -277,6 +277,8 @@
"no_mutes": "No mutes", "no_mutes": "No mutes",
"hide_follows_description": "Don't show who I'm following", "hide_follows_description": "Don't show who I'm following",
"hide_followers_description": "Don't show who's following me", "hide_followers_description": "Don't show who's following me",
"hide_follows_count_description": "Don't show follow count",
"hide_followers_count_description": "Don't show follower count",
"show_admin_badge": "Show Admin badge in my profile", "show_admin_badge": "Show Admin badge in my profile",
"show_moderator_badge": "Show Moderator badge in my profile", "show_moderator_badge": "Show Moderator badge in my profile",
"nsfw_clickthrough": "Enable clickthrough NSFW attachment hiding", "nsfw_clickthrough": "Enable clickthrough NSFW attachment hiding",

View file

@ -178,6 +178,8 @@
"no_rich_text_description": "Убрать форматирование из всех постов", "no_rich_text_description": "Убрать форматирование из всех постов",
"hide_follows_description": "Не показывать кого я читаю", "hide_follows_description": "Не показывать кого я читаю",
"hide_followers_description": "Не показывать кто читает меня", "hide_followers_description": "Не показывать кто читает меня",
"hide_follows_count_description": "Не показывать число читаемых пользователей",
"hide_followers_count_description": "Не показывать число моих подписчиков",
"show_admin_badge": "Показывать значок администратора в моем профиле", "show_admin_badge": "Показывать значок администратора в моем профиле",
"show_moderator_badge": "Показывать значок модератора в моем профиле", "show_moderator_badge": "Показывать значок модератора в моем профиле",
"nsfw_clickthrough": "Включить скрытие NSFW вложений", "nsfw_clickthrough": "Включить скрытие NSFW вложений",

View file

@ -74,6 +74,8 @@ export const parseUser = (data) => {
output.hide_follows = data.pleroma.hide_follows output.hide_follows = data.pleroma.hide_follows
output.hide_followers = data.pleroma.hide_followers output.hide_followers = data.pleroma.hide_followers
output.hide_follows_count = data.pleroma.hide_follows_count
output.hide_followers_count = data.pleroma.hide_followers_count
output.rights = { output.rights = {
moderator: data.pleroma.is_moderator, moderator: data.pleroma.is_moderator,
@ -140,6 +142,8 @@ export const parseUser = (data) => {
output.default_scope = data.default_scope output.default_scope = data.default_scope
output.hide_follows = data.hide_follows output.hide_follows = data.hide_follows
output.hide_followers = data.hide_followers output.hide_followers = data.hide_followers
output.hide_follows_count = data.hide_follows_count
output.hide_followers_count = data.hide_followers_count
output.background_image = data.background_image output.background_image = data.background_image
// on mastoapi this info is contained in a "relationship" // on mastoapi this info is contained in a "relationship"
output.following = data.following output.following = data.following

View file

@ -278,10 +278,12 @@ describe('API Entities normalizer', () => {
}) })
it('adds hide_follows and hide_followers user settings', () => { it('adds hide_follows and hide_followers user settings', () => {
const user = makeMockUserMasto({ pleroma: { hide_followers: true, hide_follows: false } }) const user = makeMockUserMasto({ pleroma: { hide_followers: true, hide_follows: false, hide_followers_count: false, hide_follows_count: true } })
expect(parseUser(user)).to.have.property('hide_followers', true) expect(parseUser(user)).to.have.property('hide_followers', true)
expect(parseUser(user)).to.have.property('hide_follows', false) expect(parseUser(user)).to.have.property('hide_follows', false)
expect(parseUser(user)).to.have.property('hide_followers_count', false)
expect(parseUser(user)).to.have.property('hide_follows_count', true)
}) })
}) })