From 6c2941dba04ca3454251c8ad04cafc40ff4900e8 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sat, 26 Nov 2016 21:09:41 +0100 Subject: [PATCH] Basic mention support. I still have to think about how to integrate them in the state system... --- src/components/mentions/mentions.js | 28 +++++++++++++++++++ src/components/mentions/mentions.vue | 12 ++++++++ src/components/nav_panel/nav_panel.js | 2 +- src/components/nav_panel/nav_panel.vue | 7 ++++- src/main.js | 4 ++- src/modules/statuses.js | 2 +- src/services/api/api.service.js | 8 ++++++ .../backend_interactor_service.js | 5 ++++ 8 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 src/components/mentions/mentions.js create mode 100644 src/components/mentions/mentions.vue diff --git a/src/components/mentions/mentions.js b/src/components/mentions/mentions.js new file mode 100644 index 0000000000..3563101bb2 --- /dev/null +++ b/src/components/mentions/mentions.js @@ -0,0 +1,28 @@ +import Status from '../status/status.vue' +// Temporary +import { prepareStatus, updateTimestampsInStatuses } from '../../modules/statuses.js' +import { map } from 'lodash' + +const Mentions = { + data () { + return { + mentions: [] + } + }, + computed: { + username () { + return this.$route.params.username + } + }, + components: { + Status + }, + created () { + this.$store.state.api.backendInteractor.fetchMentions({username: this.username}) + .then((mentions) => { + this.mentions = updateTimestampsInStatuses(map(mentions, prepareStatus)) + }) + } +} + +export default Mentions diff --git a/src/components/mentions/mentions.vue b/src/components/mentions/mentions.vue new file mode 100644 index 0000000000..a760719c40 --- /dev/null +++ b/src/components/mentions/mentions.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/components/nav_panel/nav_panel.js b/src/components/nav_panel/nav_panel.js index c2373a26c0..baeaaede29 100644 --- a/src/components/nav_panel/nav_panel.js +++ b/src/components/nav_panel/nav_panel.js @@ -1,6 +1,6 @@ const NavPanel = { computed: { - loggedIn () { + currentUser () { return this.$store.state.users.currentUser } } diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue index f463ef95c1..b709d9140b 100644 --- a/src/components/nav_panel/nav_panel.vue +++ b/src/components/nav_panel/nav_panel.vue @@ -2,11 +2,16 @@