Skip to content

Commit 8b2efd3

Browse files
committed
FIX: Do not show Composer in single-post timeline when user is not authenticated
Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
1 parent 264afab commit 8b2efd3

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

src/mixins/currentUserMixin.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,45 @@
2020
*
2121
*/
2222

23+
/**
24+
* This file provides various computed properties related to the currently
25+
* logged-in user.
26+
*
27+
* @mixin
28+
*/
29+
2330
import serverData from './serverData'
31+
2432
export default {
2533
mixins: [
2634
serverData
2735
],
2836
computed: {
37+
/**
38+
* Returns an object describing the currently logged-in user
39+
*
40+
* @returns {Object}
41+
*
42+
*/
2943
currentUser() {
3044
return OC.getCurrentUser()
3145
},
46+
/**
47+
* Returns the ActivityPub ID of the currently logged-in user
48+
*
49+
* @returns {String}
50+
*
51+
*/
3252
socialId() {
3353
return '@' + this.cloudId
3454
},
55+
/**
56+
* Returns the ActivityPub ID of the currently logged-in user,
57+
* minus the leading '@'
58+
*
59+
* @returns {String}
60+
*
61+
*/
3562
cloudId() {
3663
return this.currentUser.uid + '@' + this.hostname
3764
}

src/views/TimelineSinglePost.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="social__wrapper">
3-
<composer />
3+
<composer v-if="currentUser.uid!==''" />
44
<timeline-entry :item="mainPost" />
55
<!-- Do not show replies when composing a reply to a remote post -->
66
<timeline-list v-if="$route.name==='single-post'" />
@@ -24,6 +24,7 @@
2424
import Composer from '../components/Composer.vue'
2525
import TimelineEntry from '../components/TimelineEntry.vue'
2626
import TimelineList from '../components/TimelineList.vue'
27+
import CurrentUserMixin from '../mixins/currentUserMixin'
2728
2829
export default {
2930
name: 'TimelineSinglePost',
@@ -33,6 +34,7 @@ export default {
3334
TimelineList
3435
},
3536
mixins: [
37+
CurrentUserMixin
3638
],
3739
data() {
3840
return {
@@ -42,7 +44,7 @@ export default {
4244
computed: {
4345
},
4446
mounted: function() {
45-
// Tell the Composer component to prepare a reply
47+
// Tell the Composer component to prepare a reply
4648
this.$nextTick(function() {
4749
if (this.$route.name === 'reply-remote') {
4850
this.$root.$emit('composer-reply', this.mainPost)

0 commit comments

Comments
 (0)