aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/side_drawer/side_drawer.js3
-rw-r--r--src/components/side_drawer/side_drawer.vue9
-rw-r--r--src/components/status/status.js14
-rw-r--r--src/components/status/status.vue2
-rw-r--r--src/components/who_to_follow/who_to_follow.js48
-rw-r--r--src/components/who_to_follow/who_to_follow.vue15
-rw-r--r--src/components/who_to_follow_panel/who_to_follow_panel.js8
-rw-r--r--src/components/who_to_follow_panel/who_to_follow_panel.vue2
8 files changed, 76 insertions, 25 deletions
diff --git a/src/components/side_drawer/side_drawer.js b/src/components/side_drawer/side_drawer.js
index 538b919d..754a57e0 100644
--- a/src/components/side_drawer/side_drawer.js
+++ b/src/components/side_drawer/side_drawer.js
@@ -23,6 +23,9 @@ const SideDrawer = {
},
unseenNotificationsCount () {
return this.unseenNotifications.length
+ },
+ suggestionsEnabled () {
+ return this.$store.state.instance.suggestionsEnabled
}
},
methods: {
diff --git a/src/components/side_drawer/side_drawer.vue b/src/components/side_drawer/side_drawer.vue
index 7c792deb..386fff6a 100644
--- a/src/components/side_drawer/side_drawer.vue
+++ b/src/components/side_drawer/side_drawer.vue
@@ -62,12 +62,17 @@
</ul>
<ul>
<li @click="toggleDrawer">
- <router-link :to="{ name: 'user-search'}">
+ <router-link :to="{ name: 'user-search' }">
{{ $t("nav.user_search") }}
</router-link>
</li>
+ <li v-if="currentUser && suggestionsEnabled" @click="toggleDrawer">
+ <router-link :to="{ name: 'who-to-follow' }">
+ {{ $t("nav.who_to_follow") }}
+ </router-link>
+ </li>
<li @click="toggleDrawer">
- <router-link :to="{ name: 'settings'}">
+ <router-link :to="{ name: 'settings' }">
{{ $t("settings.settings") }}
</router-link>
</li>
diff --git a/src/components/status/status.js b/src/components/status/status.js
index 73d53694..7d6acbac 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -117,19 +117,7 @@ const Status = {
return lengthScore > 20
},
isReply () {
- if (this.status.in_reply_to_status_id) {
- return true
- }
- // For private replies where we can't see the OP, in_reply_to_status_id will be null.
- // So instead, check that the post starts with a @mention.
- if (this.status.visibility === 'private') {
- var textBody = this.status.text
- if (this.status.summary !== null) {
- textBody = textBody.substring(this.status.summary.length, textBody.length)
- }
- return textBody.startsWith('@')
- }
- return false
+ return !!this.status.in_reply_to_status_id
},
hideReply () {
if (this.$store.state.config.replyVisibility === 'all') {
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index af756801..4a1aef8f 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -88,7 +88,7 @@
<div :class="{'tall-status': hideTallStatus}" class="status-content-wrapper">
<a class="tall-status-hider" :class="{ 'tall-status-hider_focused': isFocused }" v-if="hideTallStatus" href="#" @click.prevent="toggleShowMore">Show more</a>
<div @click.prevent="linkClicked" class="status-content media-body" v-html="status.statusnet_html" v-if="!hideSubjectStatus"></div>
- <div @click.prevent="linkClicked" class="status-content media-body" v-html="status.summary" v-else></div>
+ <div @click.prevent="linkClicked" class="status-content media-body" v-html="status.summary_html" v-else></div>
<a v-if="hideSubjectStatus" href="#" class="cw-status-hider" @click.prevent="toggleShowMore">Show more</a>
<a v-if="showingMore" href="#" class="status-unhider" @click.prevent="toggleShowMore">Show less</a>
</div>
diff --git a/src/components/who_to_follow/who_to_follow.js b/src/components/who_to_follow/who_to_follow.js
new file mode 100644
index 00000000..82098fc2
--- /dev/null
+++ b/src/components/who_to_follow/who_to_follow.js
@@ -0,0 +1,48 @@
+import apiService from '../../services/api/api.service.js'
+import UserCard from '../user_card/user_card.vue'
+
+const WhoToFollow = {
+ components: {
+ UserCard
+ },
+ data () {
+ return {
+ users: []
+ }
+ },
+ mounted () {
+ this.getWhoToFollow()
+ },
+ methods: {
+ showWhoToFollow (reply) {
+ reply.forEach((i, index) => {
+ const user = {
+ id: 0,
+ name: i.display_name,
+ screen_name: i.acct,
+ profile_image_url: i.avatar || '/images/avi.png'
+ }
+ this.users.push(user)
+
+ this.$store.state.api.backendInteractor.externalProfile(user.screen_name)
+ .then((externalUser) => {
+ if (!externalUser.error) {
+ this.$store.commit('addNewUsers', [externalUser])
+ user.id = externalUser.id
+ }
+ })
+ })
+ },
+ getWhoToFollow () {
+ const credentials = this.$store.state.users.currentUser.credentials
+ if (credentials) {
+ apiService.suggestions({credentials: credentials})
+ .then((reply) => {
+ this.showWhoToFollow(reply)
+ })
+ }
+ }
+ }
+}
+
+export default WhoToFollow
diff --git a/src/components/who_to_follow/who_to_follow.vue b/src/components/who_to_follow/who_to_follow.vue
new file mode 100644
index 00000000..df2e03c8
--- /dev/null
+++ b/src/components/who_to_follow/who_to_follow.vue
@@ -0,0 +1,15 @@
+<template>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ {{$t('who_to_follow.who_to_follow')}}
+ </div>
+ <div class="panel-body">
+ <user-card v-for="user in users" :key="user.id" :user="user" :showFollows="true"></user-card>
+ </div>
+ </div>
+</template>
+
+<script src="./who_to_follow.js"></script>
+
+<style lang="scss">
+</style>
diff --git a/src/components/who_to_follow_panel/who_to_follow_panel.js b/src/components/who_to_follow_panel/who_to_follow_panel.js
index fddc7c7d..5e204001 100644
--- a/src/components/who_to_follow_panel/who_to_follow_panel.js
+++ b/src/components/who_to_follow_panel/who_to_follow_panel.js
@@ -50,14 +50,6 @@ const WhoToFollowPanel = {
user: function () {
return this.$store.state.users.currentUser.screen_name
},
- moreUrl: function () {
- const host = window.location.hostname
- const user = this.user
- const suggestionsWeb = this.$store.state.instance.suggestionsWeb
- const url = suggestionsWeb.replace(/{{host}}/g, encodeURIComponent(host))
- .replace(/{{user}}/g, encodeURIComponent(user))
- return url
- },
suggestionsEnabled () {
return this.$store.state.instance.suggestionsEnabled
}
diff --git a/src/components/who_to_follow_panel/who_to_follow_panel.vue b/src/components/who_to_follow_panel/who_to_follow_panel.vue
index 272c41d3..25e3a9f6 100644
--- a/src/components/who_to_follow_panel/who_to_follow_panel.vue
+++ b/src/components/who_to_follow_panel/who_to_follow_panel.vue
@@ -13,7 +13,7 @@
{{user.name}}
</router-link><br />
</span>
- <img v-bind:src="$store.state.instance.logo"> <a v-bind:href="moreUrl" target="_blank">{{$t('who_to_follow.more')}}</a>
+ <img v-bind:src="$store.state.instance.logo"> <router-link :to="{ name: 'who-to-follow' }">{{$t('who_to_follow.more')}}</router-link>
</div>
</div>
</div>