From a56d2dfeb1c5ddd93c1c23036c0e0f2ca16d273c Mon Sep 17 00:00:00 2001
From: taehoon
Date: Wed, 13 Feb 2019 07:15:08 -0500
Subject: Add blocks tab with test data to user settings page
---
src/i18n/en.json | 1 +
1 file changed, 1 insertion(+)
(limited to 'src/i18n')
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 78e8fced..ddde1de2 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -110,6 +110,7 @@
"avatarRadius": "Avatars",
"background": "Background",
"bio": "Bio",
+ "blocks_tab": "Blocks",
"btnRadius": "Buttons",
"cBlue": "Blue (Reply, follow)",
"cGreen": "Green (Retweet)",
--
cgit v1.2.3-70-g09d2
From 0220d3d304cbcb82b8531ff373dce1b35e93fb4f Mon Sep 17 00:00:00 2001
From: taehoon
Date: Wed, 13 Feb 2019 14:55:02 -0500
Subject: Finally, added BlockCard
---
src/components/block_card/block_card.js | 21 +++++++++++++++++++++
src/components/block_card/block_card.vue | 16 ++++++++++++++++
src/components/user_settings/user_settings.js | 6 +++---
src/i18n/en.json | 4 +++-
4 files changed, 43 insertions(+), 4 deletions(-)
create mode 100644 src/components/block_card/block_card.js
create mode 100644 src/components/block_card/block_card.vue
(limited to 'src/i18n')
diff --git a/src/components/block_card/block_card.js b/src/components/block_card/block_card.js
new file mode 100644
index 00000000..8788fb62
--- /dev/null
+++ b/src/components/block_card/block_card.js
@@ -0,0 +1,21 @@
+import BasicUserCard from '../basic_user_card/basic_user_card.vue'
+
+const BlockCard = {
+ props: ['user'],
+ data () {
+ return {
+ progress: false,
+ updated: false
+ }
+ },
+ components: {
+ BasicUserCard
+ },
+ methods: {
+ unblockUser () {
+ this.progress = true
+ }
+ }
+}
+
+export default BlockCard
diff --git a/src/components/block_card/block_card.vue b/src/components/block_card/block_card.vue
new file mode 100644
index 00000000..06fc67fc
--- /dev/null
+++ b/src/components/block_card/block_card.vue
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index a46afda6..3bcecdf4 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -5,13 +5,13 @@ import TabSwitcher from '../tab_switcher/tab_switcher.js'
import ImageCropper from '../image_cropper/image_cropper.vue'
import StyleSwitcher from '../style_switcher/style_switcher.vue'
import fileSizeFormatService from '../../services/file_size_format/file_size_format.js'
-import BasicUserCard from '../basic_user_card/basic_user_card.vue'
+import BlockCard from '../block_card/block_card.vue'
import withLoadMore from '../../hocs/with_load_more/with_load_more'
import withList from '../../hocs/with_list/with_list'
-const UserList = withList(BasicUserCard, entry => ({ user: entry }))
+const BlockList = withList(BlockCard, entry => ({ user: entry }))
const BlockListWithLoadMore = withLoadMore(
- UserList,
+ BlockList,
(props, $store) => $store.dispatch('fetchBlocks'),
(props, $store) => get($store.state.users.currentUser, 'blocks', [])
)
diff --git a/src/i18n/en.json b/src/i18n/en.json
index ddde1de2..9027803d 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -366,7 +366,9 @@
"muted": "Muted",
"per_day": "per day",
"remote_follow": "Remote follow",
- "statuses": "Statuses"
+ "statuses": "Statuses",
+ "unblock": "Unblock",
+ "unblock_progress": "Unblocking..."
},
"user_profile": {
"timeline_title": "User Timeline"
--
cgit v1.2.3-70-g09d2
From 52913d8f873dd6994988d6a928cca007a0effeaf Mon Sep 17 00:00:00 2001
From: taehoon
Date: Wed, 13 Feb 2019 15:31:20 -0500
Subject: Complete functionality of BlockCard
---
src/components/block_card/block_card.js | 22 +++++++++++++++++++---
src/components/block_card/block_card.vue | 10 +++++++++-
src/components/user_settings/user_settings.js | 2 +-
src/i18n/en.json | 3 ++-
src/modules/users.js | 8 ++++++++
5 files changed, 39 insertions(+), 6 deletions(-)
(limited to 'src/i18n')
diff --git a/src/components/block_card/block_card.js b/src/components/block_card/block_card.js
index 8788fb62..11fa27b4 100644
--- a/src/components/block_card/block_card.js
+++ b/src/components/block_card/block_card.js
@@ -1,11 +1,18 @@
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
const BlockCard = {
- props: ['user'],
+ props: ['userId'],
data () {
return {
- progress: false,
- updated: false
+ progress: false
+ }
+ },
+ computed: {
+ user () {
+ return this.$store.getters.userById(this.userId)
+ },
+ blocked () {
+ return this.user.statusnet_blocking
}
},
components: {
@@ -14,6 +21,15 @@ const BlockCard = {
methods: {
unblockUser () {
this.progress = true
+ this.$store.dispatch('unblockUser', this.user.id).then(() => {
+ this.progress = false
+ })
+ },
+ blockUser () {
+ this.progress = true
+ this.$store.dispatch('blockUser', this.user.id).then(() => {
+ this.progress = false
+ })
}
}
}
diff --git a/src/components/block_card/block_card.vue b/src/components/block_card/block_card.vue
index 06fc67fc..ed7fe30b 100644
--- a/src/components/block_card/block_card.vue
+++ b/src/components/block_card/block_card.vue
@@ -1,7 +1,7 @@
-
+
+
+ {{ $t('user_card.block_progress') }}
+
+
+ {{ $t('user_card.block') }}
+
+
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index 3bcecdf4..621dcd4b 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -9,7 +9,7 @@ import BlockCard from '../block_card/block_card.vue'
import withLoadMore from '../../hocs/with_load_more/with_load_more'
import withList from '../../hocs/with_list/with_list'
-const BlockList = withList(BlockCard, entry => ({ user: entry }))
+const BlockList = withList(BlockCard, entry => ({ userId: entry.id }))
const BlockListWithLoadMore = withLoadMore(
BlockList,
(props, $store) => $store.dispatch('fetchBlocks'),
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 9027803d..eeb95f9c 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -368,7 +368,8 @@
"remote_follow": "Remote follow",
"statuses": "Statuses",
"unblock": "Unblock",
- "unblock_progress": "Unblocking..."
+ "unblock_progress": "Unblocking...",
+ "block_progress": "Blocking..."
},
"user_profile": {
"timeline_title": "User Timeline"
diff --git a/src/modules/users.js b/src/modules/users.js
index 6ea4e0c9..ce8af68c 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -154,6 +154,14 @@ const users = {
return blocks
})
},
+ blockUser (store, id) {
+ return store.rootState.api.backendInteractor.blockUser(id)
+ .then((user) => store.commit('addNewUsers', [user]))
+ },
+ unblockUser (store, id) {
+ return store.rootState.api.backendInteractor.unblockUser(id)
+ .then((user) => store.commit('addNewUsers', [user]))
+ },
addFriends ({ rootState, commit }, fetchBy) {
return new Promise((resolve, reject) => {
const user = rootState.users.usersObject[fetchBy]
--
cgit v1.2.3-70-g09d2
From e91a94ff9c4b9559f53a4b001f8972ceca843771 Mon Sep 17 00:00:00 2001
From: taehoon
Date: Wed, 13 Feb 2019 22:04:28 -0500
Subject: Add mutes tab
---
src/components/mute_card/mute_card.js | 37 ++++++++++++++++++++++
src/components/mute_card/mute_card.vue | 24 ++++++++++++++
src/components/user_settings/user_settings.js | 13 ++++++--
src/components/user_settings/user_settings.vue | 4 +++
src/i18n/en.json | 1 +
src/modules/users.js | 25 ++++++++++++---
.../entity_normalizer/entity_normalizer.service.js | 1 +
7 files changed, 99 insertions(+), 6 deletions(-)
create mode 100644 src/components/mute_card/mute_card.js
create mode 100644 src/components/mute_card/mute_card.vue
(limited to 'src/i18n')
diff --git a/src/components/mute_card/mute_card.js b/src/components/mute_card/mute_card.js
new file mode 100644
index 00000000..5dd0a9e5
--- /dev/null
+++ b/src/components/mute_card/mute_card.js
@@ -0,0 +1,37 @@
+import BasicUserCard from '../basic_user_card/basic_user_card.vue'
+
+const MuteCard = {
+ props: ['userId'],
+ data () {
+ return {
+ progress: false
+ }
+ },
+ computed: {
+ user () {
+ return this.$store.getters.userById(this.userId)
+ },
+ muted () {
+ return this.user.muted
+ }
+ },
+ components: {
+ BasicUserCard
+ },
+ methods: {
+ unmuteUser () {
+ this.progress = true
+ this.$store.dispatch('unmuteUser', this.user.id).then(() => {
+ this.progress = false
+ })
+ },
+ muteUser () {
+ this.progress = true
+ this.$store.dispatch('muteUser', this.user.id).then(() => {
+ this.progress = false
+ })
+ }
+ }
+}
+
+export default MuteCard
diff --git a/src/components/mute_card/mute_card.vue b/src/components/mute_card/mute_card.vue
new file mode 100644
index 00000000..e1bfe20b
--- /dev/null
+++ b/src/components/mute_card/mute_card.vue
@@ -0,0 +1,24 @@
+
+
+
+
+
+ {{ $t('user_card.unmute_progress') }}
+
+
+ {{ $t('user_card.unmute') }}
+
+
+
+
+ {{ $t('user_card.mute_progress') }}
+
+
+ {{ $t('user_card.mute') }}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index 8eade382..8114d5e2 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -6,7 +6,7 @@ import ImageCropper from '../image_cropper/image_cropper.vue'
import StyleSwitcher from '../style_switcher/style_switcher.vue'
import fileSizeFormatService from '../../services/file_size_format/file_size_format.js'
import BlockCard from '../block_card/block_card.vue'
-import withLoadMore from '../../hocs/with_load_more/with_load_more'
+import MuteCard from '../mute_card/mute_card.vue'
import withSubscription from '../../hocs/with_subscription/with_subscription'
import withList from '../../hocs/with_list/with_list'
@@ -18,6 +18,14 @@ const BlockListWithSubscription = withSubscription(
'entries'
)
+const MuteList = withList(MuteCard, userId => ({ userId }))
+const MuteListWithSubscription = withSubscription(
+ MuteList,
+ (props, $store) => $store.dispatch('fetchMutes'),
+ (props, $store) => get($store.state.users.currentUser, 'muteIds', []),
+ 'entries'
+)
+
const UserSettings = {
data () {
return {
@@ -55,7 +63,8 @@ const UserSettings = {
StyleSwitcher,
TabSwitcher,
ImageCropper,
- 'block-list': BlockListWithSubscription
+ 'block-list': BlockListWithSubscription,
+ 'mute-list': MuteListWithSubscription
},
computed: {
user () {
diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
index 5bae583c..27f3e7cb 100644
--- a/src/components/user_settings/user_settings.vue
+++ b/src/components/user_settings/user_settings.vue
@@ -166,6 +166,10 @@
+
+
+
+
diff --git a/src/i18n/en.json b/src/i18n/en.json
index eeb95f9c..b41b6db9 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -165,6 +165,7 @@
"lock_account_description": "Restrict your account to approved followers only",
"loop_video": "Loop videos",
"loop_video_silent_only": "Loop only videos without sound (i.e. Mastodon's \"gifs\")",
+ "mutes_tab": "Mutes",
"play_videos_in_modal": "Play videos directly in the media viewer",
"use_contain_fit": "Don't crop the attachment in thumbnails",
"name": "Name",
diff --git a/src/modules/users.js b/src/modules/users.js
index 1f03b47e..71201a77 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -89,6 +89,10 @@ export const mutations = {
const user = state.currentUser
user.blockIds = union(user.blockIds, blockIds)
},
+ saveMutes (state, ids) {
+ const user = state.currentUser
+ user.muteIds = union(user.muteIds, ids)
+ },
setUserForStatus (state, status) {
status.user = state.usersObject[status.user.id]
},
@@ -157,6 +161,22 @@ const users = {
return store.rootState.api.backendInteractor.unblockUser(id)
.then((user) => store.commit('addNewUsers', [user]))
},
+ fetchMutes (store) {
+ return store.rootState.api.backendInteractor.fetchMutes()
+ .then((mutedUsers) => {
+ each(mutedUsers, (user) => { user.muted = true })
+ store.commit('addNewUsers', mutedUsers)
+ store.commit('saveMutes', map(mutedUsers, 'id'))
+ })
+ },
+ muteUser (store, id) {
+ return store.state.api.backendInteractor.setUserMute({ id, muted: true })
+ .then((user) => store.commit('addNewUsers', [user]))
+ },
+ unmuteUser (store, id) {
+ return store.state.api.backendInteractor.setUserMute({ id, muted: false })
+ .then((user) => store.commit('addNewUsers', [user]))
+ },
addFriends ({ rootState, commit }, fetchBy) {
return new Promise((resolve, reject) => {
const user = rootState.users.usersObject[fetchBy]
@@ -300,10 +320,7 @@ const users = {
store.dispatch('startFetching', { timeline: 'friends' })
// Get user mutes and follower info
- store.rootState.api.backendInteractor.fetchMutes().then((mutedUsers) => {
- each(mutedUsers, (user) => { user.muted = true })
- store.commit('addNewUsers', mutedUsers)
- })
+ store.dispatch('fetchMutes')
// Fetch our friends
store.rootState.api.backendInteractor.fetchFriends({ id: user.id })
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index 0e1be61e..49c83811 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -121,6 +121,7 @@ export const parseUser = (data) => {
output.follow_request_count = data.pleroma.follow_request_count
}
output.blockIds = []
+ output.muteIds = []
return output
}
--
cgit v1.2.3-70-g09d2
From 395d21290462525209ee4446746f14f996adf6b2 Mon Sep 17 00:00:00 2001
From: taehoon
Date: Thu, 14 Feb 2019 03:19:07 -0500
Subject: Add new strings to i18n
---
src/components/user_settings/user_settings.vue | 4 ++--
src/i18n/en.json | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
(limited to 'src/i18n')
diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
index 520a8cbe..e18ca4ee 100644
--- a/src/components/user_settings/user_settings.vue
+++ b/src/components/user_settings/user_settings.vue
@@ -165,13 +165,13 @@
- No blocks
+ {{$t('settings.no_blocks')}}
- No mutes
+ {{$t('settings.no_mutes')}}
diff --git a/src/i18n/en.json b/src/i18n/en.json
index b41b6db9..93819c2c 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -177,6 +177,8 @@
"notification_visibility_mentions": "Mentions",
"notification_visibility_repeats": "Repeats",
"no_rich_text_description": "Strip rich text formatting from all posts",
+ "no_blocks": "No blocks",
+ "no_mutes": "No mutes",
"hide_follows_description": "Don't show who I'm following",
"hide_followers_description": "Don't show who's following me",
"show_admin_badge": "Show Admin badge in my profile",
--
cgit v1.2.3-70-g09d2
From 85d43d17f5834cde8f5f778528ec3e8ffa041efa Mon Sep 17 00:00:00 2001
From: taehoon
Date: Thu, 14 Feb 2019 11:13:29 -0500
Subject: Add missing translation strings
---
src/i18n/en.json | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
(limited to 'src/i18n')
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 93819c2c..55ea7b24 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -372,7 +372,10 @@
"statuses": "Statuses",
"unblock": "Unblock",
"unblock_progress": "Unblocking...",
- "block_progress": "Blocking..."
+ "block_progress": "Blocking...",
+ "unmute": "Unmute",
+ "unmute_progress": "Unmuting...",
+ "mute_progress": "Muting..."
},
"user_profile": {
"timeline_title": "User Timeline"
--
cgit v1.2.3-70-g09d2