From a0eaac2216e7f279e10c6b688b9fa81f7a4fad2d Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 22 Jun 2021 21:09:29 +0300 Subject: [PATCH 01/12] fix tests --- .../specs/components/rich_content.spec.js | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/test/unit/specs/components/rich_content.spec.js b/test/unit/specs/components/rich_content.spec.js index fbf8973d..9ac9bedb 100644 --- a/test/unit/specs/components/rich_content.spec.js +++ b/test/unit/specs/components/rich_content.spec.js @@ -2,8 +2,12 @@ import { mount, shallowMount, createLocalVue } from '@vue/test-utils' import RichContent from 'src/components/rich_content/rich_content.jsx' const localVue = createLocalVue() +const attentions = [] -const makeMention = (who) => `@${who}` +const makeMention = (who) => { + attentions.push({ statusnet_profile_url: `https://fake.tld/@${who}` }) + return `@${who}` +} const stubMention = (who) => `` const lastMentions = (...data) => `${data.join('')}` const p = (...data) => `

${data.join('')}

` @@ -16,6 +20,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -39,6 +44,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -62,6 +68,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -89,6 +96,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true, @@ -120,6 +128,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -157,6 +166,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true, @@ -186,6 +196,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -215,6 +226,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -257,6 +269,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -292,6 +305,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -334,6 +348,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -362,6 +377,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: true, @@ -386,6 +402,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: true, @@ -406,6 +423,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: false, @@ -427,6 +445,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: false, @@ -444,6 +463,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: false, @@ -472,6 +492,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, handleLinks: true, greentext: true, emoji: [], @@ -507,6 +528,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -537,6 +559,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -580,6 +603,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -616,6 +640,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -652,6 +677,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -699,6 +725,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true, @@ -711,6 +738,7 @@ describe('RichContent', () => { }) it('rich contents of a mention in beginning are handled properly', () => { + attentions.push({ statusnet_profile_url: 'lol' }) const html = [ p( '', @@ -752,6 +780,7 @@ describe('RichContent', () => { MentionLink: true }, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true, @@ -796,6 +825,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true, From 2cfff1b8b9c642e9284483d6658312d9a3763417 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 12 Aug 2021 02:49:37 +0300 Subject: [PATCH 02/12] remove new options for style and separate line, now groups all chained mentions on a mentionsline regardless of placement. fixes spacing --- src/components/mention_link/mention_link.js | 6 +- src/components/mention_link/mention_link.scss | 41 -- src/components/mention_link/mention_link.vue | 3 +- src/components/mentions_line/mentions_line.js | 15 +- .../mentions_line/mentions_line.scss | 15 +- .../mentions_line/mentions_line.vue | 6 +- src/components/rich_content/rich_content.jsx | 128 ++---- .../settings_modal/tabs/general_tab.vue | 10 - src/components/status/status.js | 5 +- src/components/status/status.vue | 1 - src/components/status_body/status_body.js | 3 +- src/components/status_body/status_body.vue | 1 - .../status_content/status_content.js | 3 +- .../status_content/status_content.vue | 1 - src/modules/config.js | 2 - .../specs/components/rich_content.spec.js | 399 +----------------- 16 files changed, 55 insertions(+), 584 deletions(-) diff --git a/src/components/mention_link/mention_link.js b/src/components/mention_link/mention_link.js index eec116db..a60a8040 100644 --- a/src/components/mention_link/mention_link.js +++ b/src/components/mention_link/mention_link.js @@ -65,9 +65,6 @@ const MentionLink = { highlightClass () { if (this.highlight) return highlightClass(this.user) }, - oldStyle () { - return !this.mergedConfig.mentionsNewStyle - }, style () { if (this.highlight) { const { @@ -83,8 +80,7 @@ const MentionLink = { return [ { '-you': this.isYou, - '-highlighted': this.highlight, - '-oldStyle': this.oldStyle + '-highlighted': this.highlight }, this.highlightType ] diff --git a/src/components/mention_link/mention_link.scss b/src/components/mention_link/mention_link.scss index 5f5da98f..ec2689f8 100644 --- a/src/components/mention_link/mention_link.scss +++ b/src/components/mention_link/mention_link.scss @@ -10,10 +10,6 @@ border-radius: 2px; } - .original { - margin-right: 0.25em; - } - .full { position: absolute; display: inline-block; @@ -41,8 +37,6 @@ } .new { - margin-right: 0.25em; - &.-you { & .shortName, & .full { @@ -61,41 +55,6 @@ margin: 0; } - &:not(.-oldStyle) { - .short { - padding-left: 0.25em; - padding-right: 0; - padding-top: 0; - padding-bottom: 0; - line-height: 1.5; - font-size: inherit; - - .at { - color: var(--faint); - opacity: 0.8; - padding-right: 0.25em; - vertical-align: -20%; - } - } - - .you { - padding-right: 0.25em; - } - - .userName { - display: inline-block; - color: var(--link); - line-height: inherit; - margin-left: 0; - padding-left: 0.125em; - padding-right: 0.25em; - padding-top: 0; - padding-bottom: 0; - border-top-right-radius: var(--btnRadius); - border-bottom-right-radius: var(--btnRadius); - } - } - &.-striped { & .userName, & .full { diff --git a/src/components/mention_link/mention_link.vue b/src/components/mention_link/mention_link.vue index 514b7475..625eb727 100644 --- a/src/components/mention_link/mention_link.vue +++ b/src/components/mention_link/mention_link.vue @@ -18,8 +18,7 @@ :class="classnames" >