From 188b6f56ed2f983d8f0fba4dc8f7327ebbee321d Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Mon, 30 Sep 2019 20:34:51 +0300 Subject: added acccount_actions component --- src/components/account_actions/account_actions.vue | 133 +++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 src/components/account_actions/account_actions.vue (limited to 'src/components/account_actions/account_actions.vue') diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue new file mode 100644 index 00000000..ce508b0a --- /dev/null +++ b/src/components/account_actions/account_actions.vue @@ -0,0 +1,133 @@ + + + + + -- cgit v1.2.3-70-g09d2 From 9c305c5f93b2ffee0a98ff8cc6770df052d4b71e Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Tue, 8 Oct 2019 10:21:40 +0300 Subject: Revert "added acccount_actions component" This reverts commit 188b6f56ed2f983d8f0fba4dc8f7327ebbee321d. --- src/components/account_actions/account_actions.js | 59 --------- src/components/account_actions/account_actions.vue | 133 -------------------- src/components/follow_button/follow_button.js | 58 --------- src/components/follow_button/follow_button.vue | 13 -- src/components/user_card/user_card.js | 48 +++++++- src/components/user_card/user_card.vue | 135 ++++++++++++++++++++- 6 files changed, 178 insertions(+), 268 deletions(-) delete mode 100644 src/components/account_actions/account_actions.js delete mode 100644 src/components/account_actions/account_actions.vue delete mode 100644 src/components/follow_button/follow_button.js delete mode 100644 src/components/follow_button/follow_button.vue (limited to 'src/components/account_actions/account_actions.vue') diff --git a/src/components/account_actions/account_actions.js b/src/components/account_actions/account_actions.js deleted file mode 100644 index 1092a96a..00000000 --- a/src/components/account_actions/account_actions.js +++ /dev/null @@ -1,59 +0,0 @@ -import FollowButton from '../follow_button/follow_button.vue' -import ProgressButton from '../progress_button/progress_button.vue' - -const AccountActions = { - props: [ - 'user' - ], - data () { - return { - showDropDown: false - } - }, - components: { - FollowButton, - ProgressButton - }, - computed: { - tagsSet () { - return new Set(this.user.tags) - }, - hasTagPolicy () { - return this.$store.state.instance.tagPolicyAvailable - } - }, - methods: { - subscribeUser () { - return this.$store.dispatch('subscribeUser', this.user.id) - }, - unsubscribeUser () { - return this.$store.dispatch('unsubscribeUser', this.user.id) - }, - showRepeats () { - this.$store.dispatch('showReblogs', this.user.id) - }, - hideRepeats () { - this.$store.dispatch('hideReblogs', this.user.id) - }, - muteUser () { - this.$store.dispatch('muteUser', this.user.id) - }, - unmuteUser () { - this.$store.dispatch('unmuteUser', this.user.id) - }, - blockUser () { - this.$store.dispatch('blockUser', this.user.id) - }, - unblockUser () { - this.$store.dispatch('unblockUser', this.user.id) - }, - reportUser () { - this.$store.dispatch('openUserReportingModal', this.user.id) - }, - mentionUser () { - this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user }) - } - } -} - -export default AccountActions diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue deleted file mode 100644 index ce508b0a..00000000 --- a/src/components/account_actions/account_actions.vue +++ /dev/null @@ -1,133 +0,0 @@ - - - - - diff --git a/src/components/follow_button/follow_button.js b/src/components/follow_button/follow_button.js deleted file mode 100644 index 9d2834ab..00000000 --- a/src/components/follow_button/follow_button.js +++ /dev/null @@ -1,58 +0,0 @@ -import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate' -export default { - props: ['user'], - data () { - return { - inProgress: false - } - }, - computed: { - isPressed () { - return this.inProgress || this.user.following - }, - title () { - if (this.inProgress || this.user.following) { - return 'user_card.follow_unfollow' - } else if (this.user.requested) { - return 'user_card.follow_again' - } else { - return '' - } - }, - label () { - if (this.inProgress) { - return 'user_card.follow_progress' - } else if (this.user.following) { - return 'user_card.following' - } else if (this.user.requested) { - return 'user_card.follow_sent' - } else { - return 'user_card.follow' - } - } - }, - methods: { - doClick () { - if (this.user.following) { - this.unfollowUser() - } else { - this.followUser() - } - }, - followUser () { - const store = this.$store - this.inProgress = true - requestFollow(this.user, store).then(() => { - this.inProgress = false - }) - }, - unfollowUser () { - const store = this.$store - this.inProgress = true - requestUnfollow(this.user, store).then(() => { - this.inProgress = false - store.commit('removeStatus', { timeline: 'friends', userId: this.user.id }) - }) - } - } -} diff --git a/src/components/follow_button/follow_button.vue b/src/components/follow_button/follow_button.vue deleted file mode 100644 index 61aa75a0..00000000 --- a/src/components/follow_button/follow_button.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index c09e5654..015a5762 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -2,8 +2,8 @@ import UserAvatar from '../user_avatar/user_avatar.vue' import RemoteFollow from '../remote_follow/remote_follow.vue' import ProgressButton from '../progress_button/progress_button.vue' import ModerationTools from '../moderation_tools/moderation_tools.vue' -import AccountActions from '../account_actions/account_actions.vue' import { hex2rgb } from '../../services/color_convert/color_convert.js' +import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' export default { @@ -98,10 +98,48 @@ export default { UserAvatar, RemoteFollow, ModerationTools, - AccountActions, ProgressButton }, methods: { + showRepeats () { + this.$store.dispatch('showReblogs', this.user.id) + }, + hideRepeats () { + this.$store.dispatch('hideReblogs', this.user.id) + }, + followUser () { + const store = this.$store + this.followRequestInProgress = true + requestFollow(this.user, store).then(() => { + this.followRequestInProgress = false + }) + }, + unfollowUser () { + const store = this.$store + this.followRequestInProgress = true + requestUnfollow(this.user, store).then(() => { + this.followRequestInProgress = false + store.commit('removeStatus', { timeline: 'friends', userId: this.user.id }) + }) + }, + blockUser () { + this.$store.dispatch('blockUser', this.user.id) + }, + unblockUser () { + this.$store.dispatch('unblockUser', this.user.id) + }, + muteUser () { + this.$store.dispatch('muteUser', this.user.id) + }, + unmuteUser () { + this.$store.dispatch('unmuteUser', this.user.id) + }, + subscribeUser () { + return this.$store.dispatch('subscribeUser', this.user.id) + }, + unsubscribeUser () { + return this.$store.dispatch('unsubscribeUser', this.user.id) + }, setProfileView (v) { if (this.switcher) { const store = this.$store @@ -122,6 +160,9 @@ export default { this.$store.state.instance.restrictedNicknames ) }, + reportUser () { + this.$store.dispatch('openUserReportingModal', this.user.id) + }, zoomAvatar () { const attachment = { url: this.user.profile_image_url_original, @@ -129,6 +170,9 @@ export default { } this.$store.dispatch('setMedia', [attachment]) this.$store.dispatch('setCurrent', attachment) + }, + mentionUser () { + this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user }) } } } diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index abaef85f..f465467c 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -131,12 +131,135 @@ -
- +
+ +
+
+ +
+
+ + + + + + + + + +
+ +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ * { + flex: 1 0 0; + margin: 0 .75em .6em 0; + white-space: nowrap; + } + button { margin: 0; -- cgit v1.2.3-70-g09d2 From a26d55013779d7b41e4a4aa0dc2477a6926116ae Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Tue, 8 Oct 2019 10:21:48 +0300 Subject: updated user_card --- src/components/account_actions/account_actions.js | 45 +++++++ src/components/account_actions/account_actions.vue | 88 ++++++++++++++ src/components/follow_button/follow_button.js | 57 +++++++++ src/components/follow_button/follow_button.vue | 13 ++ src/components/user_card/user_card.js | 40 +----- src/components/user_card/user_card.vue | 134 ++++----------------- src/services/api/api.service.js | 13 +- 7 files changed, 240 insertions(+), 150 deletions(-) create mode 100644 src/components/account_actions/account_actions.js create mode 100644 src/components/account_actions/account_actions.vue create mode 100644 src/components/follow_button/follow_button.js create mode 100644 src/components/follow_button/follow_button.vue (limited to 'src/components/account_actions/account_actions.vue') diff --git a/src/components/account_actions/account_actions.js b/src/components/account_actions/account_actions.js new file mode 100644 index 00000000..453e1f46 --- /dev/null +++ b/src/components/account_actions/account_actions.js @@ -0,0 +1,45 @@ +import ProgressButton from '../progress_button/progress_button.vue' + +const AccountActions = { + props: [ + 'user' + ], + data () { + return { + showDropDown: false + } + }, + components: { + ProgressButton + }, + computed: { + tagsSet () { + return new Set(this.user.tags) + }, + hasTagPolicy () { + return this.$store.state.instance.tagPolicyAvailable + } + }, + methods: { + showRepeats () { + this.$store.dispatch('showReblogs', this.user.id) + }, + hideRepeats () { + this.$store.dispatch('hideReblogs', this.user.id) + }, + blockUser () { + this.$store.dispatch('blockUser', this.user.id) + }, + unblockUser () { + this.$store.dispatch('unblockUser', this.user.id) + }, + reportUser () { + this.$store.dispatch('openUserReportingModal', this.user.id) + }, + mentionUser () { + this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user }) + } + } +} + +export default AccountActions diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue new file mode 100644 index 00000000..5786a502 --- /dev/null +++ b/src/components/account_actions/account_actions.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/src/components/follow_button/follow_button.js b/src/components/follow_button/follow_button.js new file mode 100644 index 00000000..708d15a2 --- /dev/null +++ b/src/components/follow_button/follow_button.js @@ -0,0 +1,57 @@ +import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate' +export default { + props: ['user'], + data () { + return { + inProgress: false + } + }, + computed: { + isPressed () { + return this.inProgress || this.user.following + }, + title () { + if (this.inProgress || this.user.following) { + return this.$t('user_card.follow_unfollow') + } else if (this.user.requested) { + return this.$t('user_card.follow_again') + } else { + return this.$t('user_card.follow') + } + }, + label () { + if (this.inProgress) { + return this.$t('user_card.follow_progress') + } else if (this.user.following) { + return this.$t('user_card.following') + } else if (this.user.requested) { + return this.$t('user_card.follow_sent') + } else { + return this.$t('user_card.follow') + } + } + }, + methods: { + onClick () { + if (this.user.following) { + this.unfollow() + } else { + this.follow() + } + }, + follow () { + this.inProgress = true + requestFollow(this.user, this.$store).then(() => { + this.inProgress = false + }) + }, + unfollow () { + const store = this.$store + this.inProgress = true + requestUnfollow(this.user, store).then(() => { + this.inProgress = false + store.commit('removeStatus', { timeline: 'friends', userId: this.user.id }) + }) + } + } +} diff --git a/src/components/follow_button/follow_button.vue b/src/components/follow_button/follow_button.vue new file mode 100644 index 00000000..f0cbb94b --- /dev/null +++ b/src/components/follow_button/follow_button.vue @@ -0,0 +1,13 @@ + + + diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index 015a5762..0107cfa6 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -1,9 +1,10 @@ import UserAvatar from '../user_avatar/user_avatar.vue' import RemoteFollow from '../remote_follow/remote_follow.vue' import ProgressButton from '../progress_button/progress_button.vue' +import FollowButton from '../follow_button/follow_button.vue' import ModerationTools from '../moderation_tools/moderation_tools.vue' +import AccountActions from '../account_actions/account_actions.vue' import { hex2rgb } from '../../services/color_convert/color_convert.js' -import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' export default { @@ -98,36 +99,11 @@ export default { UserAvatar, RemoteFollow, ModerationTools, - ProgressButton + AccountActions, + ProgressButton, + FollowButton }, methods: { - showRepeats () { - this.$store.dispatch('showReblogs', this.user.id) - }, - hideRepeats () { - this.$store.dispatch('hideReblogs', this.user.id) - }, - followUser () { - const store = this.$store - this.followRequestInProgress = true - requestFollow(this.user, store).then(() => { - this.followRequestInProgress = false - }) - }, - unfollowUser () { - const store = this.$store - this.followRequestInProgress = true - requestUnfollow(this.user, store).then(() => { - this.followRequestInProgress = false - store.commit('removeStatus', { timeline: 'friends', userId: this.user.id }) - }) - }, - blockUser () { - this.$store.dispatch('blockUser', this.user.id) - }, - unblockUser () { - this.$store.dispatch('unblockUser', this.user.id) - }, muteUser () { this.$store.dispatch('muteUser', this.user.id) }, @@ -160,9 +136,6 @@ export default { this.$store.state.instance.restrictedNicknames ) }, - reportUser () { - this.$store.dispatch('openUserReportingModal', this.user.id) - }, zoomAvatar () { const attachment = { url: this.user.profile_image_url_original, @@ -170,9 +143,6 @@ export default { } this.$store.dispatch('setMedia', [attachment]) this.$store.dispatch('setCurrent', attachment) - }, - mentionUser () { - this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user }) } } } diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index f465467c..119079b2 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -59,6 +59,10 @@ :title="$t('tool_tip.user_settings')" /> + -
- -
-
- -
-
- - - - - - - - - -
- -
- +
+ +
-
- -
- - -
- -
- -
- * { - flex: 1 0 0; margin: 0 .75em .6em 0; white-space: nowrap; } diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 80e94a50..61cd4f16 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -219,13 +219,16 @@ const authHeaders = (accessToken) => { } } -const followUser = ({ id, reblogs, credentials }) => { +const followUser = ({ id, credentials, ...options }) => { let url = MASTODON_FOLLOW_URL(id) - const form = new FormData() - if (reblogs !== undefined) { form.append('reblogs', reblogs) } + const form = {} + if (options.reblogs !== undefined) { form['reblogs'] = options.reblogs } return fetch(url, { - body: form, - headers: authHeaders(credentials), + body: JSON.stringify(form), + headers: { + ...authHeaders(credentials), + 'Content-Type': 'application/json' + }, method: 'POST' }).then((data) => data.json()) } -- cgit v1.2.3-70-g09d2 From 7fede8572d9b67060ed5b12b5f6df257233da8bd Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Tue, 8 Oct 2019 16:55:36 +0300 Subject: change icon --- src/components/account_actions/account_actions.vue | 2 +- src/components/follow_button/follow_button.js | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'src/components/account_actions/account_actions.vue') diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue index 5786a502..e62ec359 100644 --- a/src/components/account_actions/account_actions.vue +++ b/src/components/account_actions/account_actions.vue @@ -64,7 +64,7 @@
- +
diff --git a/src/components/follow_button/follow_button.js b/src/components/follow_button/follow_button.js index 708d15a2..4123c9fd 100644 --- a/src/components/follow_button/follow_button.js +++ b/src/components/follow_button/follow_button.js @@ -33,11 +33,7 @@ export default { }, methods: { onClick () { - if (this.user.following) { - this.unfollow() - } else { - this.follow() - } + this.user.following ? this.unfollow() : this.follow() }, follow () { this.inProgress = true -- cgit v1.2.3-70-g09d2 From a65b32823923e43b6900357e3f0804d7c3e89b85 Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Wed, 9 Oct 2019 08:30:48 +0300 Subject: remove unused code --- src/components/account_actions/account_actions.js | 8 -------- src/components/account_actions/account_actions.vue | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) (limited to 'src/components/account_actions/account_actions.vue') diff --git a/src/components/account_actions/account_actions.js b/src/components/account_actions/account_actions.js index 453e1f46..a3ecd025 100644 --- a/src/components/account_actions/account_actions.js +++ b/src/components/account_actions/account_actions.js @@ -12,14 +12,6 @@ const AccountActions = { components: { ProgressButton }, - computed: { - tagsSet () { - return new Set(this.user.tags) - }, - hasTagPolicy () { - return this.$store.state.instance.tagPolicyAvailable - } - }, methods: { showRepeats () { this.$store.dispatch('showReblogs', this.user.id) diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue index e62ec359..c7641b8a 100644 --- a/src/components/account_actions/account_actions.vue +++ b/src/components/account_actions/account_actions.vue @@ -64,7 +64,7 @@
- +
-- cgit v1.2.3-70-g09d2 From e3f6001b3ee197caa4723e0b877b73eddf823bda Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Wed, 9 Oct 2019 09:04:18 +0300 Subject: update css --- src/components/account_actions/account_actions.vue | 10 +++++++++- src/components/user_card/user_card.vue | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/components/account_actions/account_actions.vue') diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue index c7641b8a..f99707cc 100644 --- a/src/components/account_actions/account_actions.vue +++ b/src/components/account_actions/account_actions.vue @@ -46,7 +46,7 @@ class="btn btn-default btn-block dropdown-item" @click="unblockUser" > - {{ $t('user_card.blocked') }} + {{ $t('user_card.unblock') }}
- +
+ +