Skip to content

Commit f5b6666

Browse files
committed
Make BlockButton a part of FollowButtons
1 parent 06baed1 commit f5b6666

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

components/Global/Elements/Follow/FollowButtons.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,21 @@
3030
</hc-button>
3131
</div>
3232
<div v-if="service === 'users'" class="column is-mobile field has-text-centered">
33-
<slot></slot>
33+
<hc-block-button :foreignEntity="entity" :confirmation="confirmUnfollow"/>
3434
</div>
3535
</div>
3636
</div>
3737
</template>
3838

3939
<script>
4040
import { mapGetters } from 'vuex'
41+
import BlockButton from '~/components/Global/Elements/BlockButton/BlockButton'
4142
4243
export default {
4344
name: 'hc-follow-buttons',
45+
components: {
46+
'hc-block-button': BlockButton,
47+
},
4448
props: {
4549
showButtons: {
4650
type: Boolean,
@@ -76,6 +80,20 @@
7680
})
7781
},
7882
methods: {
83+
confirmUnfollow(next){
84+
const message = this.$t('component.blacklist.confirmUnfollowMessage', {
85+
name: this.entity.name || this.$t('component.contribution.creatorUnknown')
86+
})
87+
this.$dialog.confirm({
88+
title: this.$t('component.blacklist.confirmUnfollowTitle'),
89+
message,
90+
confirmText: this.$t('button.yes'),
91+
cancelText: this.$t('button.cancel'),
92+
type: 'is-danger',
93+
hasIcon: true,
94+
onConfirm: () => { next() }
95+
})
96+
},
7997
async toggleFollow () {
8098
if (this.follow._id) {
8199
await this.$store.dispatch('connections/unfollow', {

pages/profile/_slug.vue

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
<hc-follow-buttons v-if="user"
4242
:showButtons="!isOwner"
4343
:entity="user">
44-
<hc-block-button v-if="user && !isOwner" :foreignEntity="user" :confirmation="confirmUnfollow"/>
4544
</hc-follow-buttons>
4645

4746
<div v-if="false" class="hc-shortcuts level under-construction">
@@ -143,7 +142,6 @@
143142
import {mapGetters} from 'vuex'
144143
import FollowerItem from '~/components/Profile/FollowerItem/FollowerItem.vue'
145144
import FollowButtons from '~/components/Global/Elements/Follow/FollowButtons.vue'
146-
import BlockButton from '~/components/Global/Elements/BlockButton/BlockButton'
147145
import Map from '~/components/Map/Map.vue'
148146
import Timeline from '~/components/layout/Timeline'
149147
import Badges from '~/components/Profile/Badges/Badges'
@@ -154,7 +152,6 @@
154152
components: {
155153
'hc-follower-item': FollowerItem,
156154
'hc-follow-buttons': FollowButtons,
157-
'hc-block-button': BlockButton,
158155
'hc-profile-badges': Badges,
159156
'hc-map': Map,
160157
'hc-timeline': Timeline
@@ -266,20 +263,6 @@
266263
}
267264
},
268265
methods: {
269-
confirmUnfollow(next){
270-
const message = this.$t('component.blacklist.confirmUnfollowMessage', {
271-
name: this.user.name || this.$t('component.contribution.creatorUnknown')
272-
})
273-
this.$dialog.confirm({
274-
title: this.$t('component.blacklist.confirmUnfollowTitle'),
275-
message,
276-
confirmText: this.$t('button.yes'),
277-
cancelText: this.$t('button.cancel'),
278-
type: 'is-danger',
279-
hasIcon: true,
280-
onConfirm: () => { next() }
281-
})
282-
},
283266
async onCoverUploadCompleted (value) {
284267
this.form.coverImg = value
285268
const user = await this.$store.dispatch('auth/patch', {

0 commit comments

Comments
 (0)