Merge branch 'fix-mentions-new-bugs' into shigusegubu

* fix-mentions-new-bugs:
  fix amps in links
  make chat messages behave same as posts for animated gifs
  support width/height img attributes
  lint
  better phrasing?
  options to disable (You)s and highlighting of yourself
  fix poast mentions tripping
  fix alignment issues
This commit is contained in:
Henry Jameson 2022-02-03 23:00:07 +02:00
commit 40cdbf3e6f
14 changed files with 57 additions and 12 deletions

View file

@ -1,6 +1,7 @@
@import '../../_variables.scss'; @import '../../_variables.scss';
.chat-message-wrapper { .chat-message-wrapper {
&.hovered-message-chain { &.hovered-message-chain {
.animated.Avatar { .animated.Avatar {
canvas { canvas {
@ -40,6 +41,12 @@
.chat-message { .chat-message {
display: flex; display: flex;
padding-bottom: 0.5em; padding-bottom: 0.5em;
.status-body:hover {
--_still-image-img-visibility: visible;
--_still-image-canvas-visibility: hidden;
--_still-image-label-visibility: hidden;
}
} }
.avatar-wrapper { .avatar-wrapper {

View file

@ -87,7 +87,7 @@ const MentionLink = {
classnames () { classnames () {
return [ return [
{ {
'-you': this.isYou, '-you': this.isYou && this.shouldBoldenYou,
'-highlighted': this.highlight '-highlighted': this.highlight
}, },
this.highlightType this.highlightType
@ -115,6 +115,12 @@ const MentionLink = {
shouldShowAvatar () { shouldShowAvatar () {
return this.mergedConfig.mentionLinkShowAvatar return this.mergedConfig.mentionLinkShowAvatar
}, },
shouldShowYous () {
return this.mergedConfig.mentionLinkShowYous
},
shouldBoldenYou () {
return this.mergedConfig.mentionLinkBoldenYou
},
shouldFadeDomain () { shouldFadeDomain () {
return this.mergedConfig.mentionLinkFadeDomain return this.mergedConfig.mentionLinkFadeDomain
}, },

View file

@ -3,7 +3,7 @@
.MentionLink { .MentionLink {
position: relative; position: relative;
white-space: normal; white-space: normal;
display: inline-block; display: inline-flex;
color: var(--link); color: var(--link);
& .new, & .new,

View file

@ -45,8 +45,8 @@
v-html="'@' + serverName" v-html="'@' + serverName"
/></span> /></span>
<span <span
v-if="isYou" v-if="isYou && shouldShowYous"
class="you" :class="{ '-you': shouldBoldenYou }"
>{{ $t('status.you') }}</span> >{{ $t('status.you') }}</span>
<!-- eslint-enable vue/no-v-html --> <!-- eslint-enable vue/no-v-html -->
</a> </a>

View file

@ -33,7 +33,7 @@
@import '../../_variables.scss'; @import '../../_variables.scss';
.popover-trigger-button { .popover-trigger-button {
display: block; display: inline-block;
} }
.popover { .popover {

View file

@ -60,7 +60,7 @@ export default Vue.component('RichContent', {
// NEVER EVER TOUCH DATA INSIDE RENDER // NEVER EVER TOUCH DATA INSIDE RENDER
render (h) { render (h) {
// Pre-process HTML // Pre-process HTML
const { newHtml: html } = preProcessPerLine(this.html, this.greentext) const { newHtml: html } = preProcessPerLine(unescape(this.html), this.greentext)
let currentMentions = null // Current chain of mentions, we group all mentions together let currentMentions = null // Current chain of mentions, we group all mentions together
// This is used to recover spacing removed when parsing mentions // This is used to recover spacing removed when parsing mentions
let lastSpacing = '' let lastSpacing = ''
@ -120,7 +120,8 @@ export default Vue.component('RichContent', {
// don't include spaces when processing mentions - we'll include them // don't include spaces when processing mentions - we'll include them
// in MentionsLine // in MentionsLine
lastSpacing = item lastSpacing = item
return currentMentions !== null ? item.trim() : item // Don't remove last space in a container (fixes poast mentions)
return (index !== array.length - 1) && (currentMentions !== null) ? item.trim() : item
} }
currentMentions = null currentMentions = null

View file

@ -152,6 +152,11 @@
{{ $t('settings.greentext') }} {{ $t('settings.greentext') }}
</BooleanSetting> </BooleanSetting>
</li> </li>
<li>
<BooleanSetting path="mentionLinkShowYous">
{{ $t('settings.show_yous') }}
</BooleanSetting>
</li>
<li> <li>
<ChoiceSetting <ChoiceSetting
id="mentionLinkDisplay" id="mentionLinkDisplay"
@ -186,6 +191,11 @@
{{ $t('settings.mention_link_fade_domain') }} {{ $t('settings.mention_link_fade_domain') }}
</BooleanSetting> </BooleanSetting>
</li> </li>
<li>
<BooleanSetting path="mentionLinkBoldenYou">
{{ $t('settings.mention_link_bolden_you') }}
</BooleanSetting>
</li>
</ul> </ul>
</ul> </ul>
</div> </div>

View file

@ -164,18 +164,24 @@ $status-margin: 0.75em;
position: relative; position: relative;
align-content: baseline; align-content: baseline;
font-size: 12px; font-size: 12px;
line-height: 160%; margin-top: 0.2em;
line-height: 130%;
max-width: 100%; max-width: 100%;
align-items: stretch; align-items: stretch;
} }
& .reply-to-popover, & .reply-to-popover,
& .reply-to-no-popover { & .reply-to-no-popover,
& .mentions {
min-width: 0; min-width: 0;
margin-right: 0.4em; margin-right: 0.4em;
flex-shrink: 0; flex-shrink: 0;
} }
.reply-glued-label {
margin-right: 0.5em;
}
.reply-to-popover { .reply-to-popover {
.reply-to:hover::before { .reply-to:hover::before {
content: ''; content: '';
@ -209,7 +215,6 @@ $status-margin: 0.75em;
& .reply-to { & .reply-to {
white-space: nowrap; white-space: nowrap;
position: relative; position: relative;
padding-right: 0.25em;
} }
& .mentions-text, & .mentions-text,

View file

@ -227,7 +227,7 @@
> >
<span <span
v-if="isReply" v-if="isReply"
class="glued-label" class="glued-label reply-glued-label"
> >
<StatusPopover <StatusPopover
v-if="!isPreview" v-if="!isPreview"

View file

@ -5,7 +5,9 @@ const StillImage = {
'mimetype', 'mimetype',
'imageLoadError', 'imageLoadError',
'imageLoadHandler', 'imageLoadHandler',
'alt' 'alt',
'height',
'width'
], ],
data () { data () {
return { return {
@ -15,6 +17,13 @@ const StillImage = {
computed: { computed: {
animated () { animated () {
return this.stopGifs && (this.mimetype === 'image/gif' || this.src.endsWith('.gif')) return this.stopGifs && (this.mimetype === 'image/gif' || this.src.endsWith('.gif'))
},
style () {
const appendPx = (str) => /\d$/.test(str) ? str + 'px' : str
return {
height: this.height ? appendPx(this.height) : null,
width: this.width ? appendPx(this.width) : null
}
} }
}, },
methods: { methods: {

View file

@ -2,6 +2,7 @@
<div <div
class="still-image" class="still-image"
:class="{ animated: animated }" :class="{ animated: animated }"
:style="style"
> >
<canvas <canvas
v-if="animated" v-if="animated"

View file

@ -495,8 +495,10 @@
"mention_link_show_tooltip": "Show full user names as tooltip for remote users", "mention_link_show_tooltip": "Show full user names as tooltip for remote users",
"mention_link_show_avatar": "Show user avatar beside the link", "mention_link_show_avatar": "Show user avatar beside the link",
"mention_link_fade_domain": "Fade domains (e.g. @example.org in @foo@example.org)", "mention_link_fade_domain": "Fade domains (e.g. @example.org in @foo@example.org)",
"mention_link_bolden_you": "Highlight mention of you when you are mentioned",
"fun": "Fun", "fun": "Fun",
"greentext": "Meme arrows", "greentext": "Meme arrows",
"show_yous": "Show (You)s",
"notifications": "Notifications", "notifications": "Notifications",
"notification_setting_filters": "Filters", "notification_setting_filters": "Filters",
"notification_setting_block_from_strangers": "Block notifications from users who you do not follow", "notification_setting_block_from_strangers": "Block notifications from users who you do not follow",

View file

@ -76,6 +76,8 @@ export const defaultState = {
mentionLinkShowTooltip: undefined, // instance default mentionLinkShowTooltip: undefined, // instance default
mentionLinkShowAvatar: undefined, // instance default mentionLinkShowAvatar: undefined, // instance default
mentionLinkFadeDomain: undefined, // instance default mentionLinkFadeDomain: undefined, // instance default
mentionLinkShowYous: undefined, // instance default
mentionLinkBoldenYou: undefined, // instance default
hidePostStats: undefined, // instance default hidePostStats: undefined, // instance default
hideUserStats: undefined, // instance default hideUserStats: undefined, // instance default
virtualScrolling: undefined, // instance default virtualScrolling: undefined, // instance default

View file

@ -25,6 +25,8 @@ const defaultState = {
mentionLinkShowTooltip: true, mentionLinkShowTooltip: true,
mentionLinkShowAvatar: false, mentionLinkShowAvatar: false,
mentionLinkFadeDomain: true, mentionLinkFadeDomain: true,
mentionLinkShowYous: false,
mentionLinkBoldenYou: true,
hideFilteredStatuses: false, hideFilteredStatuses: false,
// bad name: actually hides posts of muted USERS // bad name: actually hides posts of muted USERS
hideMutedPosts: false, hideMutedPosts: false,