Merge branch 'tusooa/group-actor' into 'develop'

Support group actors

See merge request pleroma/pleroma-fe!1882
This commit is contained in:
tusooa 2024-01-24 01:50:45 +00:00
commit 9042792133
13 changed files with 66 additions and 27 deletions

View File

@ -0,0 +1 @@
Support group actors

View File

@ -261,6 +261,7 @@ const getNodeInfo = async ({ store }) => {
store.dispatch('setInstanceOption', { name: 'pollLimits', value: metadata.pollLimits }) store.dispatch('setInstanceOption', { name: 'pollLimits', value: metadata.pollLimits })
store.dispatch('setInstanceOption', { name: 'mailerEnabled', value: metadata.mailerEnabled }) store.dispatch('setInstanceOption', { name: 'mailerEnabled', value: metadata.mailerEnabled })
store.dispatch('setInstanceOption', { name: 'quotingAvailable', value: features.includes('quote_posting') }) store.dispatch('setInstanceOption', { name: 'quotingAvailable', value: features.includes('quote_posting') })
store.dispatch('setInstanceOption', { name: 'groupActorAvailable', value: features.includes('pleroma:group_actors') })
const uploadLimits = metadata.uploadLimits const uploadLimits = metadata.uploadLimits
store.dispatch('setInstanceOption', { name: 'uploadlimit', value: parseInt(uploadLimits.general) }) store.dispatch('setInstanceOption', { name: 'uploadlimit', value: parseInt(uploadLimits.general) })

View File

@ -51,7 +51,7 @@
</li> </li>
<li> <li>
<BooleanSetting path="hideBotIndication"> <BooleanSetting path="hideBotIndication">
{{ $t('settings.hide_bot_indication') }} {{ $t('settings.hide_actor_type_indication') }}
</BooleanSetting> </BooleanSetting>
</li> </li>
<ChoiceSetting <ChoiceSetting

View File

@ -9,6 +9,7 @@ import suggestor from 'src/components/emoji_input/suggestor.js'
import Autosuggest from 'src/components/autosuggest/autosuggest.vue' import Autosuggest from 'src/components/autosuggest/autosuggest.vue'
import Checkbox from 'src/components/checkbox/checkbox.vue' import Checkbox from 'src/components/checkbox/checkbox.vue'
import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue' import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue'
import Select from 'src/components/select/select.vue'
import BooleanSetting from '../helpers/boolean_setting.vue' import BooleanSetting from '../helpers/boolean_setting.vue'
import SharedComputedObject from '../helpers/shared_computed_object.js' import SharedComputedObject from '../helpers/shared_computed_object.js'
import localeService from 'src/services/locale/locale.service.js' import localeService from 'src/services/locale/locale.service.js'
@ -39,6 +40,7 @@ const ProfileTab = {
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,
bot: this.$store.state.users.currentUser.bot, bot: this.$store.state.users.currentUser.bot,
actorType: this.$store.state.users.currentUser.actor_type,
pickAvatarBtnVisible: true, pickAvatarBtnVisible: true,
bannerUploading: false, bannerUploading: false,
backgroundUploading: false, backgroundUploading: false,
@ -57,7 +59,8 @@ const ProfileTab = {
ProgressButton, ProgressButton,
Checkbox, Checkbox,
BooleanSetting, BooleanSetting,
InterfaceLanguageSwitcher InterfaceLanguageSwitcher,
Select
}, },
computed: { computed: {
user () { user () {
@ -116,6 +119,12 @@ const ProfileTab = {
bannerImgSrc () { bannerImgSrc () {
const src = this.$store.state.users.currentUser.cover_photo const src = this.$store.state.users.currentUser.cover_photo
return (!src) ? this.defaultBanner : src return (!src) ? this.defaultBanner : src
},
groupActorAvailable () {
return this.$store.state.instance.groupActorAvailable
},
availableActorTypes () {
return this.groupActorAvailable ? ['Person', 'Service', 'Group'] : ['Person', 'Service']
} }
}, },
methods: { methods: {
@ -127,7 +136,7 @@ const ProfileTab = {
/* eslint-disable camelcase */ /* eslint-disable camelcase */
display_name: this.newName, display_name: this.newName,
fields_attributes: this.newFields.filter(el => el != null), fields_attributes: this.newFields.filter(el => el != null),
bot: this.bot, actor_type: this.actorType,
show_role: this.showRole, show_role: this.showRole,
birthday: this.newBirthday || '', birthday: this.newBirthday || '',
show_birthday: this.showBirthday show_birthday: this.showBirthday

View File

@ -109,10 +109,24 @@
</button> </button>
</div> </div>
<p> <p>
<Checkbox v-model="bot"> <label>
{{ $t('settings.bot') }} {{ $t('settings.actor_type') }}
</Checkbox> <Select v-model="actorType">
<option
v-for="option in availableActorTypes"
:key="option"
:value="option"
>
{{ $t('settings.actor_type_' + option) }}
</option>
</Select>
</label>
</p> </p>
<div v-if="groupActorAvailable">
<small>
{{ $t('settings.actor_type_description') }}
</small>
</div>
<p> <p>
<interface-language-switcher <interface-language-switcher
:prompt-text="$t('settings.email_language')" :prompt-text="$t('settings.email_language')"

View File

@ -232,17 +232,11 @@ const Status = {
muteWordHits () { muteWordHits () {
return muteWordHits(this.status, this.muteWords) return muteWordHits(this.status, this.muteWords)
}, },
rtBotStatus () {
return this.statusoid.user.bot
},
botStatus () { botStatus () {
return this.status.user.bot return this.status.user.actor_type === 'Service'
}, },
botIndicator () { showActorTypeIndicator () {
return this.botStatus && !this.hideBotIndication return !this.hideBotIndication
},
rtBotIndicator () {
return this.rtBotStatus && !this.hideBotIndication
}, },
mentionsLine () { mentionsLine () {
if (!this.headTailLinks) return [] if (!this.headTailLinks) return []

View File

@ -79,7 +79,7 @@
<UserAvatar <UserAvatar
v-if="retweet" v-if="retweet"
class="left-side repeater-avatar" class="left-side repeater-avatar"
:bot="rtBotIndicator" :show-actor-type-indicator="showActorTypeIndicator"
:better-shadow="betterShadow" :better-shadow="betterShadow"
:user="statusoid.user" :user="statusoid.user"
/> />
@ -133,7 +133,7 @@
> >
<UserAvatar <UserAvatar
class="post-avatar" class="post-avatar"
:bot="botIndicator" :show-actor-type-indicator="showActorTypeIndicator"
:compact="compact" :compact="compact"
:better-shadow="betterShadow" :better-shadow="betterShadow"
:user="status.user" :user="status.user"
@ -559,7 +559,7 @@
<UserAvatar <UserAvatar
class="post-avatar" class="post-avatar"
:compact="compact" :compact="compact"
:bot="botIndicator" :show-actor-type-indicator="showActorTypeIndicator"
/> />
</div> </div>
<div class="right-side"> <div class="right-side">

View File

@ -3,11 +3,13 @@ import StillImage from '../still-image/still-image.vue'
import { library } from '@fortawesome/fontawesome-svg-core' import { library } from '@fortawesome/fontawesome-svg-core'
import { import {
faRobot faRobot,
faPeopleGroup
} from '@fortawesome/free-solid-svg-icons' } from '@fortawesome/free-solid-svg-icons'
library.add( library.add(
faRobot faRobot,
faPeopleGroup
) )
const UserAvatar = { const UserAvatar = {
@ -15,7 +17,7 @@ const UserAvatar = {
'user', 'user',
'betterShadow', 'betterShadow',
'compact', 'compact',
'bot' 'showActorTypeIndicator'
], ],
data () { data () {
return { return {

View File

@ -18,9 +18,14 @@
:class="{ '-compact': compact }" :class="{ '-compact': compact }"
/> />
<FAIcon <FAIcon
v-if="bot" v-if="showActorTypeIndicator && user?.actor_type === 'Service'"
icon="robot" icon="robot"
class="bot-indicator" class="actor-type-indicator"
/>
<FAIcon
v-if="showActorTypeIndicator && user?.actor_type === 'Group'"
icon="people-group"
class="actor-type-indicator"
/> />
</span> </span>
</template> </template>
@ -79,7 +84,7 @@
height: 100%; height: 100%;
} }
.bot-indicator { .actor-type-indicator {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
right: 0; right: 0;

View File

@ -124,11 +124,17 @@
{{ $t(`general.role.${visibleRole}`) }} {{ $t(`general.role.${visibleRole}`) }}
</span> </span>
<span <span
v-if="user.bot" v-if="user.actor_type === 'Service'"
class="alert user-role" class="alert user-role"
> >
{{ $t('user_card.bot') }} {{ $t('user_card.bot') }}
</span> </span>
<span
v-if="user.actor_type === 'Group'"
class="alert user-role"
>
{{ $t('user_card.group') }}
</span>
</template> </template>
<span v-if="user.locked"> <span v-if="user.locked">
<FAIcon <FAIcon

View File

@ -360,6 +360,11 @@
"remove_language": "Remove", "remove_language": "Remove",
"primary_language": "Primary language:", "primary_language": "Primary language:",
"fallback_language": "Fallback language {index}:", "fallback_language": "Fallback language {index}:",
"actor_type": "This account is:",
"actor_type_description": "Marking your account as a group will make it automatically repeat statuses that mention it.",
"actor_type_Person": "a normal user",
"actor_type_Service": "a bot",
"actor_type_Group": "a group",
"app_name": "App name", "app_name": "App name",
"expert_mode": "Show advanced", "expert_mode": "Show advanced",
"save": "Save changes", "save": "Save changes",
@ -424,7 +429,6 @@
"added_backup": "Added a new backup.", "added_backup": "Added a new backup.",
"add_backup_error": "Error adding a new backup: {error}", "add_backup_error": "Error adding a new backup: {error}",
"blocks_tab": "Blocks", "blocks_tab": "Blocks",
"bot": "This is a bot account",
"btnRadius": "Buttons", "btnRadius": "Buttons",
"cBlue": "Blue (Reply, follow)", "cBlue": "Blue (Reply, follow)",
"cGreen": "Green (Retweet)", "cGreen": "Green (Retweet)",
@ -496,7 +500,7 @@
"hide_media_previews": "Hide media previews", "hide_media_previews": "Hide media previews",
"hide_muted_posts": "Hide posts of muted users", "hide_muted_posts": "Hide posts of muted users",
"mute_bot_posts": "Mute bot posts", "mute_bot_posts": "Mute bot posts",
"hide_bot_indication": "Hide bot indication in posts", "hide_actor_type_indication": "Hide actor type (bots, groups, etc.) indication in posts",
"hide_scrobbles": "Hide scrobbles", "hide_scrobbles": "Hide scrobbles",
"hide_all_muted_posts": "Hide muted posts", "hide_all_muted_posts": "Hide muted posts",
"max_thumbnails": "Maximum amount of thumbnails per post (empty = no limit)", "max_thumbnails": "Maximum amount of thumbnails per post (empty = no limit)",
@ -1128,6 +1132,7 @@
"hide_repeats": "Hide repeats", "hide_repeats": "Hide repeats",
"show_repeats": "Show repeats", "show_repeats": "Show repeats",
"bot": "Bot", "bot": "Bot",
"group": "Group",
"birthday": "Born {birthday}", "birthday": "Born {birthday}",
"admin_menu": { "admin_menu": {
"moderation": "Moderation", "moderation": "Moderation",

View File

@ -137,6 +137,7 @@ const defaultState = {
suggestionsEnabled: false, suggestionsEnabled: false,
suggestionsWeb: '', suggestionsWeb: '',
quotingAvailable: false, quotingAvailable: false,
groupActorAvailable: false,
// Html stuff // Html stuff
instanceSpecificPanelContent: '', instanceSpecificPanelContent: '',

View File

@ -166,6 +166,7 @@ export const parseUser = (data) => {
output.show_role = data.source.pleroma.show_role output.show_role = data.source.pleroma.show_role
output.discoverable = data.source.pleroma.discoverable output.discoverable = data.source.pleroma.discoverable
output.show_birthday = data.pleroma.show_birthday output.show_birthday = data.pleroma.show_birthday
output.actor_type = data.source.pleroma.actor_type
} }
} }