From 2b7f12613ec04e3ce8be62b169457ad62aa83a65 Mon Sep 17 00:00:00 2001 From: Alexander Tumin Date: Tue, 1 Mar 2022 00:35:00 +0300 Subject: [PATCH] Add bot indication to user icon on statuses --- src/boot/after_store.js | 1 + .../settings_modal/tabs/filtering_tab.vue | 5 +++++ src/components/status/status.js | 6 ++++++ src/components/status/status.vue | 7 ++++++- src/components/still-image/still-image.vue | 1 + src/components/user_avatar/user_avatar.js | 13 ++++++++++++- src/components/user_avatar/user_avatar.vue | 10 +++++++++- src/i18n/en.json | 1 + src/modules/config.js | 1 + src/modules/instance.js | 1 + 10 files changed, 43 insertions(+), 3 deletions(-) diff --git a/src/boot/after_store.js b/src/boot/after_store.js index cc0c7c5e2f..c4a0a80099 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -115,6 +115,7 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => { copyInstanceOption('nsfwCensorImage') copyInstanceOption('background') copyInstanceOption('hidePostStats') + copyInstanceOption('hideBotIndication') copyInstanceOption('hideUserStats') copyInstanceOption('hideFilteredStatuses') copyInstanceOption('logo') diff --git a/src/components/settings_modal/tabs/filtering_tab.vue b/src/components/settings_modal/tabs/filtering_tab.vue index 87567befac..a7e30ce29a 100644 --- a/src/components/settings_modal/tabs/filtering_tab.vue +++ b/src/components/settings_modal/tabs/filtering_tab.vue @@ -47,6 +47,11 @@ {{ $t('settings.hide_post_stats') }} +
  • + + {{ $t('settings.hide_bot_indication') }} + +
  • _.url)) @@ -301,6 +304,9 @@ const Status = { muteBotStatuses () { return this.mergedConfig.muteBotStatuses }, + hideBotIndication () { + return this.mergedConfig.hideBotIndication + }, currentUser () { return this.$store.state.users.currentUser }, diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 3bb29db665..8f51a77828 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -77,6 +77,7 @@ @@ -124,6 +125,7 @@ @click.stop.prevent.capture.native="toggleUserExpanded" >
    - +
    diff --git a/src/components/still-image/still-image.vue b/src/components/still-image/still-image.vue index cca75fcb74..4ea2150613 100644 --- a/src/components/still-image/still-image.vue +++ b/src/components/still-image/still-image.vue @@ -19,6 +19,7 @@ @load="onLoad" @error="onError" > +
    diff --git a/src/components/user_avatar/user_avatar.js b/src/components/user_avatar/user_avatar.js index 9465300488..33d9a2580b 100644 --- a/src/components/user_avatar/user_avatar.js +++ b/src/components/user_avatar/user_avatar.js @@ -1,10 +1,21 @@ import StillImage from '../still-image/still-image.vue' +import { library } from '@fortawesome/fontawesome-svg-core' + +import { + faRobot +} from '@fortawesome/free-solid-svg-icons' + +library.add( + faRobot +) + const UserAvatar = { props: [ 'user', 'betterShadow', - 'compact' + 'compact', + 'bot' ], data () { return { diff --git a/src/components/user_avatar/user_avatar.vue b/src/components/user_avatar/user_avatar.vue index 4040e263c8..29e03bcb23 100644 --- a/src/components/user_avatar/user_avatar.vue +++ b/src/components/user_avatar/user_avatar.vue @@ -7,7 +7,9 @@ :src="imgSrc(user.profile_image_url_original)" :class="{ 'avatar-compact': compact, 'better-shadow': betterShadow }" :image-load-error="imageLoadError" - /> + > + +
    .bot-indicator { + position: absolute; + bottom: 0; + right: 0; + } + &.better-shadow { box-shadow: var(--_avatarShadowInset); filter: var(--_avatarShadowFilter); diff --git a/src/i18n/en.json b/src/i18n/en.json index a109ab3c38..61087ec267 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -352,6 +352,7 @@ "hide_media_previews": "Hide media previews", "hide_muted_posts": "Hide posts of muted users", "mute_bot_posts": "Mute bot posts", + "hide_bot_indication": "Hide bot indication in posts", "hide_all_muted_posts": "Hide muted posts", "max_thumbnails": "Maximum amount of thumbnails per post (empty = no limit)", "hide_isp": "Hide instance-specific panel", diff --git a/src/modules/config.js b/src/modules/config.js index 79f765615b..1aa2878e1d 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -80,6 +80,7 @@ export const defaultState = { mentionLinkShowYous: undefined, // instance default mentionLinkBoldenYou: undefined, // instance default hidePostStats: undefined, // instance default + hideBotIndication: undefined, // instance default hideUserStats: undefined, // instance default virtualScrolling: undefined, // instance default sensitiveByDefault: undefined // instance default diff --git a/src/modules/instance.js b/src/modules/instance.js index d0bf10e33a..41bcf3292a 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -33,6 +33,7 @@ const defaultState = { hideMutedThreads: true, hideWordFilteredPosts: false, hidePostStats: false, + hideBotIndication: false, hideSitename: false, hideUserStats: false, muteBotStatuses: false,