From 49b0f0a04a74039a1b82fbde731828e599123e93 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sat, 9 Mar 2019 18:33:49 +0200 Subject: Fetching convos via MastoAPI. Had to change conversation component a bit for better support, since MastoAPI doesn't have coversation ids --- src/components/conversation/conversation.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 48b8aaaa..fd4303ca 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -25,7 +25,8 @@ const sortAndFilterConversation = (conversation) => { const conversation = { data () { return { - highlight: null + highlight: null, + relevantIds: [] } }, props: [ @@ -48,9 +49,11 @@ const conversation = { return [] } - const conversationId = this.status.statusnet_conversation_id - const statuses = this.$store.state.statuses.allStatuses - const conversation = filter(statuses, { statusnet_conversation_id: conversationId }) + const statusesObject = this.$store.state.statuses.allStatusesObject + const conversation = this.relevantIds.reduce((acc, id) => { + acc.push(statusesObject[id]) + return acc + }, []) return sortAndFilterConversation(conversation) }, replies () { @@ -83,15 +86,13 @@ const conversation = { methods: { fetchConversation () { if (this.status) { - const conversationId = this.status.statusnet_conversation_id + const conversationId = this.status.id this.$store.state.api.backendInteractor.fetchConversation({id: conversationId}) - .then((statuses) => this.$store.dispatch('addNewStatuses', { statuses })) + .then((statuses) => { + this.$store.dispatch('addNewStatuses', { statuses }) + statuses.forEach(status => this.relevantIds.push(status.id)) + }) .then(() => this.setHighlight(this.statusId)) - } else { - const id = this.$route.params.id - this.$store.state.api.backendInteractor.fetchStatus({id}) - .then((status) => this.$store.dispatch('addNewStatuses', { statuses: [status] })) - .then(() => this.fetchConversation()) } }, getReplies (id) { -- cgit v1.2.3-70-g09d2 From 4f455eefe5af2914d7dece40e027ed35ec8a21b3 Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 11 Mar 2019 10:52:28 -0400 Subject: #433: do not remove the reply dialog --- src/components/conversation/conversation.js | 6 +++++- src/components/conversation/conversation.vue | 15 ++++++++++----- src/components/status/status.js | 6 +++--- .../status_or_conversation/status_or_conversation.js | 6 +++++- .../status_or_conversation.vue | 20 ++++++++++++++++++-- 5 files changed, 41 insertions(+), 12 deletions(-) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 48b8aaaa..95e484cd 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -30,7 +30,8 @@ const conversation = { }, props: [ 'statusoid', - 'collapsable' + 'collapsable', + 'replying' ], computed: { status () { @@ -102,6 +103,9 @@ const conversation = { }, setHighlight (id) { this.highlight = id + }, + toggleReplying () { + this.$emit('toggleReplying') } } } diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue index 5528fef6..42d009c9 100644 --- a/src/components/conversation/conversation.vue +++ b/src/components/conversation/conversation.vue @@ -10,14 +10,19 @@
- + class="status-fadein" + />
diff --git a/src/components/status/status.js b/src/components/status/status.js index 9e18fe15..20ca86a6 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -25,11 +25,11 @@ const Status = { 'replies', 'isPreview', 'noHeading', - 'inlineExpanded' + 'inlineExpanded', + 'replying' ], data () { return { - replying: false, expanded: false, unmuted: false, userExpanded: false, @@ -307,7 +307,7 @@ const Status = { } }, toggleReplying () { - this.replying = !this.replying + this.$emit('toggleReplying') }, gotoOriginal (id) { // only handled by conversation, not status_or_conversation diff --git a/src/components/status_or_conversation/status_or_conversation.js b/src/components/status_or_conversation/status_or_conversation.js index 441552ca..749f7665 100644 --- a/src/components/status_or_conversation/status_or_conversation.js +++ b/src/components/status_or_conversation/status_or_conversation.js @@ -5,7 +5,8 @@ const statusOrConversation = { props: ['statusoid'], data () { return { - expanded: false + expanded: false, + replying: false } }, components: { @@ -15,6 +16,9 @@ const statusOrConversation = { methods: { toggleExpanded () { this.expanded = !this.expanded + }, + toggleReplying () { + this.replying = !this.replying } } } diff --git a/src/components/status_or_conversation/status_or_conversation.vue b/src/components/status_or_conversation/status_or_conversation.vue index 9647d5eb..43a60c3a 100644 --- a/src/components/status_or_conversation/status_or_conversation.vue +++ b/src/components/status_or_conversation/status_or_conversation.vue @@ -1,7 +1,23 @@ -- cgit v1.2.3-70-g09d2 From 63d7c7bd80cf8028cdefee99c1cb75614385f96b Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 11 Mar 2019 16:24:37 -0400 Subject: #433: persistency of status form --- src/components/conversation/conversation.js | 36 +++++++++++++++------- src/components/conversation/conversation.vue | 31 ++++++++++++++----- src/components/status/status.js | 7 ++--- .../status_or_conversation.js | 26 ---------------- .../status_or_conversation.vue | 30 ------------------ src/components/timeline/timeline.js | 4 +-- src/components/timeline/timeline.vue | 8 ++++- 7 files changed, 60 insertions(+), 82 deletions(-) delete mode 100644 src/components/status_or_conversation/status_or_conversation.js delete mode 100644 src/components/status_or_conversation/status_or_conversation.vue (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 95e484cd..4cae0bdb 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -1,4 +1,4 @@ -import { reduce, filter } from 'lodash' +import { reduce, filter, findIndex } from 'lodash' import Status from '../status/status.vue' const sortById = (a, b) => { @@ -25,13 +25,13 @@ const sortAndFilterConversation = (conversation) => { const conversation = { data () { return { - highlight: null + highlight: null, + expanded: false } }, props: [ 'statusoid', - 'collapsable', - 'replying' + 'collapsable' ], computed: { status () { @@ -49,9 +49,18 @@ const conversation = { return [] } + if (!this.expanded) { + return [this.status] + } + const conversationId = this.status.statusnet_conversation_id const statuses = this.$store.state.statuses.allStatuses const conversation = filter(statuses, { statusnet_conversation_id: conversationId }) + + const statusIndex = findIndex(conversation, { id: this.statusId }) + if (statusIndex !== -1) { + conversation[statusIndex] = this.status + } return sortAndFilterConversation(conversation) }, replies () { @@ -75,11 +84,13 @@ const conversation = { components: { Status }, - created () { - this.fetchConversation() - }, watch: { - '$route': 'fetchConversation' + '$route': 'fetchConversation', + expanded (value) { + if (value) { + this.fetchConversation() + } + } }, methods: { fetchConversation () { @@ -99,13 +110,16 @@ const conversation = { return this.replies[id] || [] }, focused (id) { - return id === this.statusId + return this.expanded && id === this.statusId }, setHighlight (id) { this.highlight = id }, - toggleReplying () { - this.$emit('toggleReplying') + getHighlight () { + return this.expanded ? this.highlight : null + }, + toggleExpanded () { + this.expanded = !this.expanded } } } diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue index 42d009c9..b208d540 100644 --- a/src/components/conversation/conversation.vue +++ b/src/components/conversation/conversation.vue @@ -1,9 +1,9 @@ + + diff --git a/src/components/status/status.js b/src/components/status/status.js index 20ca86a6..8e489704 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -25,11 +25,11 @@ const Status = { 'replies', 'isPreview', 'noHeading', - 'inlineExpanded', - 'replying' + 'inlineExpanded' ], data () { return { + replying: false, expanded: false, unmuted: false, userExpanded: false, @@ -307,10 +307,9 @@ const Status = { } }, toggleReplying () { - this.$emit('toggleReplying') + this.replying = !this.replying }, gotoOriginal (id) { - // only handled by conversation, not status_or_conversation if (this.inConversation) { this.$emit('goto', id) } diff --git a/src/components/status_or_conversation/status_or_conversation.js b/src/components/status_or_conversation/status_or_conversation.js deleted file mode 100644 index 749f7665..00000000 --- a/src/components/status_or_conversation/status_or_conversation.js +++ /dev/null @@ -1,26 +0,0 @@ -import Status from '../status/status.vue' -import Conversation from '../conversation/conversation.vue' - -const statusOrConversation = { - props: ['statusoid'], - data () { - return { - expanded: false, - replying: false - } - }, - components: { - Status, - Conversation - }, - methods: { - toggleExpanded () { - this.expanded = !this.expanded - }, - toggleReplying () { - this.replying = !this.replying - } - } -} - -export default statusOrConversation diff --git a/src/components/status_or_conversation/status_or_conversation.vue b/src/components/status_or_conversation/status_or_conversation.vue deleted file mode 100644 index 43a60c3a..00000000 --- a/src/components/status_or_conversation/status_or_conversation.vue +++ /dev/null @@ -1,30 +0,0 @@ - - - - - diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index c45f8947..1da7d5cc 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -1,6 +1,6 @@ import Status from '../status/status.vue' import timelineFetcher from '../../services/timeline_fetcher/timeline_fetcher.service.js' -import StatusOrConversation from '../status_or_conversation/status_or_conversation.vue' +import Conversation from '../conversation/conversation.vue' import { throttle } from 'lodash' const Timeline = { @@ -43,7 +43,7 @@ const Timeline = { }, components: { Status, - StatusOrConversation + Conversation }, created () { const store = this.$store diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue index 8f28d65c..e0a34bd1 100644 --- a/src/components/timeline/timeline.vue +++ b/src/components/timeline/timeline.vue @@ -16,7 +16,13 @@
- +
-- cgit v1.2.3-70-g09d2 From ee94a6732aff8a4ab64ca885e07d53f58bfb4cb4 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 21 Mar 2019 22:49:26 +0200 Subject: why did i do that --- src/components/conversation/conversation.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index fd4303ca..32bab144 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -93,6 +93,11 @@ const conversation = { statuses.forEach(status => this.relevantIds.push(status.id)) }) .then(() => this.setHighlight(this.statusId)) + } else { + const id = this.$route.params.id + this.$store.state.api.backendInteractor.fetchStatus({id}) + .then((status) => this.$store.dispatch('addNewStatuses', { statuses: [status] })) + .then(() => this.fetchConversation()) } }, getReplies (id) { -- cgit v1.2.3-70-g09d2 From d6c62fa50f1992c109c60d03aa44f5ed3ee94284 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 21 Mar 2019 23:27:14 +0200 Subject: minor UI improvements - keep current behavior of showing originating post initially --- src/components/conversation-page/conversation-page.js | 5 ++--- src/components/conversation/conversation.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation-page/conversation-page.js b/src/components/conversation-page/conversation-page.js index 8f1ac3d9..1da70ce9 100644 --- a/src/components/conversation-page/conversation-page.js +++ b/src/components/conversation-page/conversation-page.js @@ -1,5 +1,4 @@ import Conversation from '../conversation/conversation.vue' -import { find } from 'lodash' const conversationPage = { components: { @@ -8,8 +7,8 @@ const conversationPage = { computed: { statusoid () { const id = this.$route.params.id - const statuses = this.$store.state.statuses.allStatuses - const status = find(statuses, {id}) + const statuses = this.$store.state.statuses.allStatusesObject + const status = statuses[id] return status } diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 32bab144..e543102a 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -37,6 +37,15 @@ const conversation = { status () { return this.statusoid }, + idsToShow () { + if (this.relevantIds.length > 0) { + return this.relevantIds + } else if (this.statusId) { + return [this.statusId] + } else { + return [] + } + }, statusId () { if (this.statusoid.retweeted_status) { return this.statusoid.retweeted_status.id @@ -50,7 +59,7 @@ const conversation = { } const statusesObject = this.$store.state.statuses.allStatusesObject - const conversation = this.relevantIds.reduce((acc, id) => { + const conversation = this.idsToShow.reduce((acc, id) => { acc.push(statusesObject[id]) return acc }, []) -- cgit v1.2.3-70-g09d2 From 67719e9a23da1420e8edbd41265cf6f46995b4b8 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 21 Mar 2019 23:45:18 +0200 Subject: less hackery, more direct usage of mastoapi --- src/components/conversation/conversation.js | 11 +++++++--- src/services/api/api.service.js | 32 +++++++++++------------------ 2 files changed, 20 insertions(+), 23 deletions(-) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index e543102a..ff18a9c8 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -1,4 +1,5 @@ import { reduce, filter } from 'lodash' +import { set } from 'vue' import Status from '../status/status.vue' const sortById = (a, b) => { @@ -97,9 +98,13 @@ const conversation = { if (this.status) { const conversationId = this.status.id this.$store.state.api.backendInteractor.fetchConversation({id: conversationId}) - .then((statuses) => { - this.$store.dispatch('addNewStatuses', { statuses }) - statuses.forEach(status => this.relevantIds.push(status.id)) + .then(({ancestors, descendants}) => { + this.$store.dispatch('addNewStatuses', { statuses: ancestors }) + this.$store.dispatch('addNewStatuses', { statuses: descendants }) + set(this, 'relevantIds', [].concat( + ancestors.map(_ => _.id), + this.statusId, + descendants.map(_ => _.id))) }) .then(() => this.setHighlight(this.statusId)) } else { diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 1510d146..9f628b13 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -313,27 +313,19 @@ const fetchFollowRequests = ({credentials}) => { } const fetchConversation = ({id, credentials}) => { - let url = MASTODON_STATUS_URL(id) let urlContext = MASTODON_STATUS_CONTEXT_URL(id) - return Promise.all([ - fetch(url, { headers: authHeaders(credentials) }) - .then((data) => { - if (data.ok) { - return data - } - throw new Error('Error fetching timeline', data) - }) - .then((data) => data.json()), - fetch(urlContext, { headers: authHeaders(credentials) }) - .then((data) => { - if (data.ok) { - return data - } - throw new Error('Error fetching timeline', data) - }) - .then((data) => data.json())]) - .then(([status, context]) => [...context.ancestors, status, ...context.descendants]) - .then((data) => data.map(parseStatus)) + return fetch(urlContext, { headers: authHeaders(credentials) }) + .then((data) => { + if (data.ok) { + return data + } + throw new Error('Error fetching timeline', data) + }) + .then((data) => data.json()) + .then(({ancestors, descendants}) => ({ + ancestors: ancestors.map(parseStatus), + descendants: descendants.map(parseStatus) + })) } const fetchStatus = ({id, credentials}) => { -- cgit v1.2.3-70-g09d2 From 6a9159b25598d578018643673568bbcd06ea1e12 Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 25 Mar 2019 10:50:09 -0400 Subject: #433 - fix broken conversation page --- src/components/conversation-page/conversation-page.vue | 6 +++++- src/components/conversation/conversation.js | 8 ++++++-- src/components/conversation/conversation.vue | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation-page/conversation-page.vue b/src/components/conversation-page/conversation-page.vue index b03eea28..9e322cf5 100644 --- a/src/components/conversation-page/conversation-page.vue +++ b/src/components/conversation-page/conversation-page.vue @@ -1,5 +1,9 @@ diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 4cae0bdb..5a9568a9 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -31,7 +31,8 @@ const conversation = { }, props: [ 'statusoid', - 'collapsable' + 'collapsable', + 'isPage' ], computed: { status () { @@ -49,7 +50,7 @@ const conversation = { return [] } - if (!this.expanded) { + if (!this.expanded && !this.isPage) { return [this.status] } @@ -79,6 +80,9 @@ const conversation = { i++ return result }, {}) + }, + isExpanded () { + return this.expanded || this.isPage } }, components: { diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue index b208d540..3778cc15 100644 --- a/src/components/conversation/conversation.vue +++ b/src/components/conversation/conversation.vue @@ -1,6 +1,6 @@ diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 49fa8612..2be74c1f 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -51,20 +51,20 @@ const conversation = { }, computed: { status () { - return this.statusoid + return this.$store.state.statuses.allStatusesObject[this.statusoid] }, statusId () { - if (this.statusoid.retweeted_status) { - return this.statusoid.retweeted_status.id + if (this.status.retweeted_status) { + return this.status.retweeted_status.id } else { - return this.statusoid.id + return this.status.id } }, conversationId () { - if (this.statusoid.retweeted_status) { - return this.statusoid.retweeted_status.statusnet_conversation_id + if (this.status.retweeted_status) { + return this.status.retweeted_status.statusnet_conversation_id } else { - return this.statusoid.statusnet_conversation_id + return this.status.statusnet_conversation_id } }, conversation () { @@ -127,8 +127,7 @@ const conversation = { }) .then(() => this.setHighlight(this.statusId)) } else { - const id = this.$route.params.id - this.$store.state.api.backendInteractor.fetchStatus({ id }) + this.$store.state.api.backendInteractor.fetchStatus({ id: this.statusoid }) .then((status) => this.$store.dispatch('addNewStatuses', { statuses: [status] })) .then(() => this.fetchConversation()) } -- cgit v1.2.3-70-g09d2 From c1f3b0dc75f657d046b84d358a1679a75261db63 Mon Sep 17 00:00:00 2001 From: taehoon Date: Fri, 30 Aug 2019 12:11:59 -0400 Subject: refactoring --- src/components/conversation/conversation.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 2be74c1f..398b7638 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -57,7 +57,7 @@ const conversation = { if (this.status.retweeted_status) { return this.status.retweeted_status.id } else { - return this.status.id + return this.statusoid } }, conversationId () { @@ -120,23 +120,25 @@ const conversation = { methods: { fetchConversation () { if (this.status) { - this.$store.state.api.backendInteractor.fetchConversation({ id: this.status.id }) + this.$store.state.api.backendInteractor.fetchConversation({ id: this.statusoid }) .then(({ ancestors, descendants }) => { this.$store.dispatch('addNewStatuses', { statuses: ancestors }) this.$store.dispatch('addNewStatuses', { statuses: descendants }) + this.setHighlight(this.statusId) }) - .then(() => this.setHighlight(this.statusId)) } else { this.$store.state.api.backendInteractor.fetchStatus({ id: this.statusoid }) - .then((status) => this.$store.dispatch('addNewStatuses', { statuses: [status] })) - .then(() => this.fetchConversation()) + .then((status) => { + this.$store.dispatch('addNewStatuses', { statuses: [status] }) + this.fetchConversation() + }) } }, getReplies (id) { return this.replies[id] || [] }, focused (id) { - return (this.isExpanded) && id === this.status.id + return (this.isExpanded) && id === this.statusoid }, setHighlight (id) { if (!id) return -- cgit v1.2.3-70-g09d2 From 482cd52f77fa514ace73a7e17f169c0518f000b1 Mon Sep 17 00:00:00 2001 From: taehoon Date: Fri, 30 Aug 2019 12:58:48 -0400 Subject: stop fetching whole conversation when change highlighted status --- src/components/conversation/conversation.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 398b7638..dc58cd58 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -1,4 +1,4 @@ -import { reduce, filter, findIndex, clone } from 'lodash' +import { reduce, filter, findIndex, clone, get } from 'lodash' import Status from '../status/status.vue' const sortById = (a, b) => { @@ -61,11 +61,7 @@ const conversation = { } }, conversationId () { - if (this.status.retweeted_status) { - return this.status.retweeted_status.statusnet_conversation_id - } else { - return this.status.statusnet_conversation_id - } + return this.getConversationId(this.statusoid) }, conversation () { if (!this.status) { @@ -110,7 +106,15 @@ const conversation = { Status }, watch: { - status: 'fetchConversation', + statusoid (newVal, oldVal) { + const newConversationId = this.getConversationId(newVal) + const oldConversationId = this.getConversationId(oldVal) + if (newConversationId && oldConversationId && newConversationId === oldConversationId) { + this.setHighlight(this.statusId) + } else { + this.fetchConversation() + } + }, expanded (value) { if (value) { this.fetchConversation() @@ -150,6 +154,10 @@ const conversation = { }, toggleExpanded () { this.expanded = !this.expanded + }, + getConversationId (statusId) { + const status = this.$store.state.statuses.allStatusesObject[statusId] + return get(status, 'retweeted_status.statusnet_conversation_id', get(status, 'statusnet_conversation_id')) } } } -- cgit v1.2.3-70-g09d2 From 9727009147d541bc8ab7083791a531b39f29c614 Mon Sep 17 00:00:00 2001 From: taehoon Date: Tue, 3 Sep 2019 13:19:14 -0400 Subject: update prop name --- .../conversation-page/conversation-page.vue | 2 +- src/components/conversation/conversation.js | 24 +++++++++++----------- src/components/timeline/timeline.vue | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation-page/conversation-page.vue b/src/components/conversation-page/conversation-page.vue index 3db63343..8cc0a55f 100644 --- a/src/components/conversation-page/conversation-page.vue +++ b/src/components/conversation-page/conversation-page.vue @@ -2,7 +2,7 @@ diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index dc58cd58..10dd8eb0 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -39,7 +39,7 @@ const conversation = { } }, props: [ - 'statusoid', + 'statusId', 'collapsable', 'isPage', 'pinnedStatusIdsObject' @@ -51,17 +51,17 @@ const conversation = { }, computed: { status () { - return this.$store.state.statuses.allStatusesObject[this.statusoid] + return this.$store.state.statuses.allStatusesObject[this.statusId] }, - statusId () { + originalStatusId () { if (this.status.retweeted_status) { return this.status.retweeted_status.id } else { - return this.statusoid + return this.statusId } }, conversationId () { - return this.getConversationId(this.statusoid) + return this.getConversationId(this.statusId) }, conversation () { if (!this.status) { @@ -73,7 +73,7 @@ const conversation = { } const conversation = clone(this.$store.state.statuses.conversationsObject[this.conversationId]) - const statusIndex = findIndex(conversation, { id: this.statusId }) + const statusIndex = findIndex(conversation, { id: this.originalStatusId }) if (statusIndex !== -1) { conversation[statusIndex] = this.status } @@ -106,11 +106,11 @@ const conversation = { Status }, watch: { - statusoid (newVal, oldVal) { + statusId (newVal, oldVal) { const newConversationId = this.getConversationId(newVal) const oldConversationId = this.getConversationId(oldVal) if (newConversationId && oldConversationId && newConversationId === oldConversationId) { - this.setHighlight(this.statusId) + this.setHighlight(this.originalStatusId) } else { this.fetchConversation() } @@ -124,14 +124,14 @@ const conversation = { methods: { fetchConversation () { if (this.status) { - this.$store.state.api.backendInteractor.fetchConversation({ id: this.statusoid }) + this.$store.state.api.backendInteractor.fetchConversation({ id: this.statusId }) .then(({ ancestors, descendants }) => { this.$store.dispatch('addNewStatuses', { statuses: ancestors }) this.$store.dispatch('addNewStatuses', { statuses: descendants }) - this.setHighlight(this.statusId) + this.setHighlight(this.originalStatusId) }) } else { - this.$store.state.api.backendInteractor.fetchStatus({ id: this.statusoid }) + this.$store.state.api.backendInteractor.fetchStatus({ id: this.statusId }) .then((status) => { this.$store.dispatch('addNewStatuses', { statuses: [status] }) this.fetchConversation() @@ -142,7 +142,7 @@ const conversation = { return this.replies[id] || [] }, focused (id) { - return (this.isExpanded) && id === this.statusoid + return (this.isExpanded) && id === this.statusId }, setHighlight (id) { if (!id) return diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue index 14ce21af..ba66e6da 100644 --- a/src/components/timeline/timeline.vue +++ b/src/components/timeline/timeline.vue @@ -33,7 +33,7 @@ v-if="timeline.statusesObject[statusId]" :key="statusId + '-pinned'" class="status-fadein" - :statusoid="statusId" + :status-id="statusId" :collapsable="true" :pinned-status-ids-object="pinnedStatusIdsObject" /> @@ -43,7 +43,7 @@ v-if="!excludedStatusIdsObject[status.id]" :key="status.id" class="status-fadein" - :statusoid="status.id" + :status-id="status.id" :collapsable="true" /> -- cgit v1.2.3-70-g09d2 From 09deb69bc78fb5cfd3d9ff2455a5632ed71dd14b Mon Sep 17 00:00:00 2001 From: taehoon Date: Fri, 13 Sep 2019 15:34:17 -0400 Subject: do not collapse muted user's posts on muted user's profile page --- src/components/conversation/conversation.js | 3 ++- src/components/conversation/conversation.vue | 1 + src/components/status/status.js | 5 +++-- src/components/timeline/timeline.js | 3 ++- src/components/timeline/timeline.vue | 2 ++ src/components/user_profile/user_profile.vue | 1 + 6 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 10dd8eb0..44dc49bc 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -42,7 +42,8 @@ const conversation = { 'statusId', 'collapsable', 'isPage', - 'pinnedStatusIdsObject' + 'pinnedStatusIdsObject', + 'forceUnmute' ], created () { if (this.isPage) { diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue index f184c071..ba138189 100644 --- a/src/components/conversation/conversation.vue +++ b/src/components/conversation/conversation.vue @@ -26,6 +26,7 @@ :in-conversation="isExpanded" :highlight="getHighlight()" :replies="getReplies(status.id)" + :force-unmute="forceUnmute" class="status-fadein panel-body" @goto="setHighlight" @toggleExpanded="toggleExpanded" diff --git a/src/components/status/status.js b/src/components/status/status.js index 502d9583..474a0480 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -29,7 +29,8 @@ const Status = { 'isPreview', 'noHeading', 'inlineExpanded', - 'showPinned' + 'showPinned', + 'forceUnmute' ], data () { return { @@ -117,7 +118,7 @@ const Status = { return hits }, - muted () { return !this.unmuted && (this.status.user.muted || this.muteWordHits.length > 0) }, + muted () { return !this.forceUnmute && !this.unmuted && (this.status.user.muted || this.muteWordHits.length > 0) }, hideFilteredStatuses () { return typeof this.$store.state.config.hideFilteredStatuses === 'undefined' ? this.$store.state.instance.hideFilteredStatuses diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 8df48f7f..3d5f9de8 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -25,7 +25,8 @@ const Timeline = { 'tag', 'embedded', 'count', - 'pinnedStatusIds' + 'pinnedStatusIds', + 'forceUnmute' ], data () { return { diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue index ba66e6da..b89f505a 100644 --- a/src/components/timeline/timeline.vue +++ b/src/components/timeline/timeline.vue @@ -36,6 +36,7 @@ :status-id="statusId" :collapsable="true" :pinned-status-ids-object="pinnedStatusIdsObject" + :force-unmute="forceUnmute" />
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index 42516916..c380d2dc 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -26,6 +26,7 @@ timeline-name="user" :user-id="userId" :pinned-status-ids="user.pinnedStatusIds" + :force-unmute="true" />
Date: Fri, 13 Sep 2019 16:55:17 -0400 Subject: do not change word based muting logic --- src/components/conversation/conversation.js | 2 +- src/components/conversation/conversation.vue | 2 +- src/components/status/status.js | 4 ++-- src/components/timeline/timeline.js | 2 +- src/components/timeline/timeline.vue | 4 ++-- src/components/user_profile/user_profile.vue | 5 +++-- 6 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 44dc49bc..72ee9c39 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -43,7 +43,7 @@ const conversation = { 'collapsable', 'isPage', 'pinnedStatusIdsObject', - 'forceUnmute' + 'inProfile' ], created () { if (this.isPage) { diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue index ba138189..0f1de55f 100644 --- a/src/components/conversation/conversation.vue +++ b/src/components/conversation/conversation.vue @@ -26,7 +26,7 @@ :in-conversation="isExpanded" :highlight="getHighlight()" :replies="getReplies(status.id)" - :force-unmute="forceUnmute" + :in-profile="inProfile" class="status-fadein panel-body" @goto="setHighlight" @toggleExpanded="toggleExpanded" diff --git a/src/components/status/status.js b/src/components/status/status.js index 474a0480..e8966f47 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -30,7 +30,7 @@ const Status = { 'noHeading', 'inlineExpanded', 'showPinned', - 'forceUnmute' + 'inProfile' ], data () { return { @@ -118,7 +118,7 @@ const Status = { return hits }, - muted () { return !this.forceUnmute && !this.unmuted && (this.status.user.muted || this.muteWordHits.length > 0) }, + muted () { return !this.unmuted && ((!this.inProfile && this.status.user.muted) || this.muteWordHits.length > 0) }, hideFilteredStatuses () { return typeof this.$store.state.config.hideFilteredStatuses === 'undefined' ? this.$store.state.instance.hideFilteredStatuses diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 3d5f9de8..0594576c 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -26,7 +26,7 @@ const Timeline = { 'embedded', 'count', 'pinnedStatusIds', - 'forceUnmute' + 'inProfile' ], data () { return { diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue index b89f505a..f1d3903a 100644 --- a/src/components/timeline/timeline.vue +++ b/src/components/timeline/timeline.vue @@ -36,7 +36,7 @@ :status-id="statusId" :collapsable="true" :pinned-status-ids-object="pinnedStatusIdsObject" - :force-unmute="forceUnmute" + :in-profile="inProfile" />
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index f463eea5..14082e83 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -26,7 +26,7 @@ timeline-name="user" :user-id="userId" :pinned-status-ids="user.pinnedStatusIds" - :force-unmute="true" + :in-profile="true" />
-- cgit v1.2.3-70-g09d2 From 40e774e05abfce6da3c558c09ce1750c132a580f Mon Sep 17 00:00:00 2001 From: taehoon Date: Mon, 25 Nov 2019 12:25:01 -0500 Subject: restore muted users collapsing logic on other user’s profiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/conversation/conversation.js | 3 ++- src/components/conversation/conversation.vue | 1 + src/components/status/status.js | 5 +++-- src/components/timeline/timeline.vue | 2 ++ 4 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 72ee9c39..08283fff 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -43,7 +43,8 @@ const conversation = { 'collapsable', 'isPage', 'pinnedStatusIdsObject', - 'inProfile' + 'inProfile', + 'profileUserId' ], created () { if (this.isPage) { diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue index 0f1de55f..2e48240a 100644 --- a/src/components/conversation/conversation.vue +++ b/src/components/conversation/conversation.vue @@ -27,6 +27,7 @@ :highlight="getHighlight()" :replies="getReplies(status.id)" :in-profile="inProfile" + :profile-user-id="profileUserId" class="status-fadein panel-body" @goto="setHighlight" @toggleExpanded="toggleExpanded" diff --git a/src/components/status/status.js b/src/components/status/status.js index 714ea6d2..c49e729c 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -33,7 +33,8 @@ const Status = { 'noHeading', 'inlineExpanded', 'showPinned', - 'inProfile' + 'inProfile', + 'profileUserId' ], data () { return { @@ -115,7 +116,7 @@ const Status = { return hits }, - muted () { return !this.unmuted && ((!this.inProfile && this.status.user.muted) || (!this.inConversation && this.status.thread_muted) || this.muteWordHits.length > 0) }, + muted () { return !this.unmuted && ((!(this.inProfile && this.status.user.id === this.profileUserId) && this.status.user.muted) || (!this.inConversation && this.status.thread_muted) || this.muteWordHits.length > 0) }, hideFilteredStatuses () { return this.mergedConfig.hideFilteredStatuses }, diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue index f1d3903a..93f6f570 100644 --- a/src/components/timeline/timeline.vue +++ b/src/components/timeline/timeline.vue @@ -37,6 +37,7 @@ :collapsable="true" :pinned-status-ids-object="pinnedStatusIdsObject" :in-profile="inProfile" + :profile-user-id="userId" /> -- cgit v1.2.3-70-g09d2