From 7fa5eb07ddeb6d8c2b572e869d82a27bdd7a7fbf Mon Sep 17 00:00:00 2001 From: xenofem Date: Mon, 24 Feb 2020 18:10:15 -0500 Subject: Refactor status showing/hiding code for better handling of edge cases and easier comprehension --- src/components/status/status.js | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'src/components/status/status.js') diff --git a/src/components/status/status.js b/src/components/status/status.js index fc5956ec..61d66301 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -188,23 +188,22 @@ const Status = { } return this.status.attentions.length > 0 }, + + // When a status has a subject and is also tall, we should only have one show more/less button. If the default is to collapse statuses with subjects, we just treat it like a status with a subject; otherwise, we just treat it like a tall status. + mightHideBecauseSubject () { + return this.status.summary && (!this.tallStatus || this.localCollapseSubjectDefault) + }, + mightHideBecauseTall () { + return this.tallStatus && (!this.status.summary || !this.localCollapseSubjectDefault) + }, hideSubjectStatus () { - if (this.tallStatus && !this.localCollapseSubjectDefault) { - return false - } - return !this.expandingSubject && this.status.summary + return this.mightHideBecauseSubject && !this.expandingSubject }, hideTallStatus () { - if (this.status.summary && this.localCollapseSubjectDefault) { - return false - } - if (this.showingTall) { - return false - } - return this.tallStatus + return this.mightHideBecauseTall && !this.showingTall }, showingMore () { - return (this.tallStatus && this.showingTall) || (this.status.summary && this.expandingSubject) + return (this.mightHideBecauseTall && this.showingTall) || (this.mightHideBecauseSubject && this.expandingSubject) }, nsfwClickthrough () { if (!this.status.nsfw) { @@ -408,14 +407,10 @@ const Status = { this.userExpanded = !this.userExpanded }, toggleShowMore () { - if (this.showingTall) { - this.showingTall = false - } else if (this.expandingSubject && this.status.summary) { - this.expandingSubject = false - } else if (this.hideTallStatus) { - this.showingTall = true - } else if (this.hideSubjectStatus && this.status.summary) { - this.expandingSubject = true + if (this.mightHideBecauseTall) { + this.showingTall = !this.showingTall + } else if (this.mightHideBecauseSubject) { + this.expandingSubject = !this.expandingSubject } }, generateUserProfileLink (id, name) { -- cgit v1.2.3-70-g09d2 From 6bb75a3a6d8452a3e1b88085fe87cf27386f222c Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Tue, 21 Apr 2020 23:27:51 +0300 Subject: make relationships separate from users --- src/boot/after_store.js | 3 ++ src/components/account_actions/account_actions.js | 2 +- src/components/account_actions/account_actions.vue | 8 ++--- src/components/basic_user_card/basic_user_card.vue | 2 +- src/components/block_card/block_card.js | 5 ++- src/components/follow_button/follow_button.js | 14 ++++---- src/components/follow_card/follow_card.js | 3 ++ src/components/follow_card/follow_card.vue | 5 +-- src/components/mute_card/mute_card.js | 9 ++++-- src/components/notification/notification.js | 2 +- src/components/notification/notification.vue | 2 +- src/components/side_drawer/side_drawer.vue | 2 +- src/components/status/status.js | 15 +++++++-- src/components/status/status.vue | 2 +- src/components/user_card/user_card.js | 8 ++++- src/components/user_card/user_card.vue | 15 +++++---- src/components/user_panel/user_panel.vue | 2 +- src/components/user_profile/user_profile.vue | 2 +- src/components/user_settings/user_settings.js | 8 ++--- src/modules/users.js | 37 ++++++++-------------- src/services/api/api.service.js | 4 ++- .../entity_normalizer/entity_normalizer.service.js | 25 +++++++++------ .../follow_manipulate/follow_manipulate.js | 15 +++++---- .../notifications_fetcher.service.js | 1 - .../timeline_fetcher/timeline_fetcher.service.js | 2 ++ 25 files changed, 112 insertions(+), 81 deletions(-) (limited to 'src/components/status/status.js') diff --git a/src/boot/after_store.js b/src/boot/after_store.js index d70e1058..1522d4f0 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -304,6 +304,9 @@ const afterStoreSetup = async ({ store, i18n }) => { getNodeInfo({ store }) ]) + // Start fetching things that don't need to block the UI + store.dispatch('fetchMutes') + const router = new VueRouter({ mode: 'history', routes: routes(store), diff --git a/src/components/account_actions/account_actions.js b/src/components/account_actions/account_actions.js index 5d7ecf7e..0826c275 100644 --- a/src/components/account_actions/account_actions.js +++ b/src/components/account_actions/account_actions.js @@ -3,7 +3,7 @@ import Popover from '../popover/popover.vue' const AccountActions = { props: [ - 'user' + 'user', 'relationship' ], data () { return { } diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue index 483783cf..744b77d5 100644 --- a/src/components/account_actions/account_actions.vue +++ b/src/components/account_actions/account_actions.vue @@ -9,16 +9,16 @@ class="account-tools-popover" >