From cd9a7dd48802fff8942ae607a23677cfb43a7b14 Mon Sep 17 00:00:00 2001
From: dave <starpumadev@gmail.com>
Date: Tue, 12 Mar 2019 17:16:57 -0400
Subject: #436: integrate mastoAPI notifications

---
 src/components/notifications/notifications.vue | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src/components/notifications/notifications.vue')

diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue
index 6f162b62..6438361d 100644
--- a/src/components/notifications/notifications.vue
+++ b/src/components/notifications/notifications.vue
@@ -9,7 +9,8 @@
         <div @click.prevent class="loadmore-error alert error" v-if="error">
           {{$t('timeline.error_fetching')}}
         </div>
-        <button v-if="unseenCount" @click.prevent="markAsSeen" class="read-button">{{$t('notifications.read')}}</button>
+        <!-- <button v-if="unseenCount" @click.prevent="markAsSeen" class="read-button">{{$t('notifications.read')}}</button> -->
+        <button v-if="notifications.length" @click.prevent="clear" class="read-button">{{$t('notifications.clear')}}</button>
       </div>
       <div class="panel-body">
         <div v-for="notification in visibleNotifications" :key="notification.action.id" class="notification" :class='{"unseen": !notification.seen}'>
-- 
cgit v1.2.3-70-g09d2


From e5e1d4c643d6b69217fb9a62b60f3f9c94ef4714 Mon Sep 17 00:00:00 2001
From: dave <starpumadev@gmail.com>
Date: Thu, 14 Mar 2019 07:55:39 -0400
Subject: #436: fix notification order, follow type link issue, duplicate key

---
 src/components/notification/notification.vue                | 7 ++++++-
 src/components/notifications/notifications.vue              | 2 +-
 src/modules/statuses.js                                     | 8 ++++----
 src/services/entity_normalizer/entity_normalizer.service.js | 2 +-
 src/services/notification_utils/notification_utils.js       | 6 +++---
 5 files changed, 15 insertions(+), 10 deletions(-)

(limited to 'src/components/notifications/notifications.vue')

diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue
index 87b0fde2..6e8e9844 100644
--- a/src/components/notification/notification.vue
+++ b/src/components/notification/notification.vue
@@ -30,7 +30,12 @@
             <small>{{$t('notifications.followed_you')}}</small>
           </span>
         </div>
-        <div class="timeago">
+        <div class="timeago" v-if="notification.type === 'follow'">
+          <span class="faint">
+            <timeago :since="notification.action.created_at" :auto-update="240"></timeago>
+          </span>
+        </div>
+        <div class="timeago" v-else>
           <router-link v-if="notification.status" :to="{ name: 'conversation', params: { id: notification.status.id } }" class="faint-link">
             <timeago :since="notification.action.created_at" :auto-update="240"></timeago>
           </router-link>
diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue
index 6438361d..5a5f8ed8 100644
--- a/src/components/notifications/notifications.vue
+++ b/src/components/notifications/notifications.vue
@@ -13,7 +13,7 @@
         <button v-if="notifications.length" @click.prevent="clear" class="read-button">{{$t('notifications.clear')}}</button>
       </div>
       <div class="panel-body">
-        <div v-for="notification in visibleNotifications" :key="notification.action.id" class="notification" :class='{"unseen": !notification.seen}'>
+        <div v-for="notification in visibleNotifications" :key="notification.action.id + notification.id" class="notification" :class='{"unseen": !notification.seen}'>
           <div class="notification-overlay"></div>
           <notification :notification="notification"></notification>
         </div>
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
index fde783a5..4cc3907d 100644
--- a/src/modules/statuses.js
+++ b/src/modules/statuses.js
@@ -269,11 +269,11 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
 }
 
 const addNewNotifications = (state, { dispatch, notifications, older, visibleNotificationTypes }) => {
-  const allStatuses = state.allStatuses
-  const allStatusesObject = state.allStatusesObject
+  // const allStatuses = state.allStatuses
+  // const allStatusesObject = state.allStatusesObject
   each(notifications, (notification) => {
-    notification.action = mergeOrAdd(allStatuses, allStatusesObject, notification.action).item
-    notification.status = notification.status && mergeOrAdd(allStatuses, allStatusesObject, notification.status).item
+    // notification.action = mergeOrAdd(allStatuses, allStatusesObject, notification.action).item
+    // notification.status = notification.status && mergeOrAdd(allStatuses, allStatusesObject, notification.status).item
 
     // Only add a new notification if we don't have one for the same action
     if (!state.notifications.idStore.hasOwnProperty(notification.id)) {
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index 5444a1e3..4ca7f56b 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -275,7 +275,7 @@ export const parseNotification = (data) => {
     output.status = output.type === 'follow'
       ? parseFollow(data)
       : parseStatus(data.status)
-    if (data.type === 'reblog') {
+    if (data.type === 'reblog' || data.type === 'favourite') {
       output.status.user = parseUser(data.account)
       output.status.created_at = new Date(data.created_at)
     }
diff --git a/src/services/notification_utils/notification_utils.js b/src/services/notification_utils/notification_utils.js
index cd8f3f9e..8afd114e 100644
--- a/src/services/notification_utils/notification_utils.js
+++ b/src/services/notification_utils/notification_utils.js
@@ -10,8 +10,8 @@ export const visibleTypes = store => ([
 ].filter(_ => _))
 
 const sortById = (a, b) => {
-  const seqA = Number(a.action.id)
-  const seqB = Number(b.action.id)
+  const seqA = Number(a.id)
+  const seqB = Number(b.id)
   const isSeqA = !Number.isNaN(seqA)
   const isSeqB = !Number.isNaN(seqB)
   if (isSeqA && isSeqB) {
@@ -21,7 +21,7 @@ const sortById = (a, b) => {
   } else if (!isSeqA && isSeqB) {
     return -1
   } else {
-    return a.action.id > b.action.id ? -1 : 1
+    return a.id > b.id ? -1 : 1
   }
 }
 
-- 
cgit v1.2.3-70-g09d2


From f19284357e94968cdc9d4034c5e33ef9d6f6d9d7 Mon Sep 17 00:00:00 2001
From: shpuld <shp@cock.li>
Date: Thu, 14 Mar 2019 17:46:04 +0200
Subject: make nav bar slide, move mobile post status to mobile nav

---
 src/App.scss                                   | 72 --------------------
 src/App.vue                                    |  7 --
 src/components/mobile_nav/mobile_nav.js        | 14 +++-
 src/components/mobile_nav/mobile_nav.vue       | 91 +++++++++++++++++++++++++-
 src/components/notifications/notifications.js  |  3 +
 src/components/notifications/notifications.vue |  2 +-
 6 files changed, 105 insertions(+), 84 deletions(-)

(limited to 'src/components/notifications/notifications.vue')

diff --git a/src/App.scss b/src/App.scss
index 8f727cf8..539c9787 100644
--- a/src/App.scss
+++ b/src/App.scss
@@ -484,24 +484,6 @@ nav {
   }
 }
 
-.menu-button {
-  display: none;
-  position: relative;
-}
-
-.alert-dot {
-  border-radius: 100%;
-  height: 8px;
-  width: 8px;
-  position: absolute;
-  left: calc(50% - 4px);
-  top: calc(50% - 4px);
-  margin-left: 6px;
-  margin-top: -6px;
-  background-color: $fallback--cRed;
-  background-color: var(--badgeNotification, $fallback--cRed);
-}
-
 .fade-enter-active, .fade-leave-active {
   transition: opacity .2s
 }
@@ -530,20 +512,6 @@ nav {
   display: none;
 }
 
-.panel-switcher {
-  display: none;
-  width: 100%;
-  height: 46px;
-
-  button {
-    display: block;
-    flex: 1;
-    max-height: 32px;
-    margin: 0.5em;
-    padding: 0.5em;
-  }
-}
-
 @media all and (min-width: 800px) {
   body {
     overflow-y: scroll;
@@ -671,46 +639,6 @@ nav {
   border-radius: var(--inputRadius, $fallback--inputRadius);
 }
 
-.mobile-notifications {
-  position: fixed;
-  width: 100vw;
-  height: 100vh;
-  top: calc(50px - 28px - 1.2em);
-  left: 0;
-  z-index: 999;
-  overflow-x: hidden;
-  overflow-y: scroll;
-  transition-property: transform;
-  transition-duration: 0.25s;
-  transform: translate(0);
-
-  background-color: $fallback--bg;
-  background-color: var(--bg, $fallback--bg);
-
-  .notifications {
-    margin: 0;
-    padding: 0;
-    border-radius: 0;
-    box-shadow: none;
-    .panel {
-      border-radius: 0;
-      margin: 0;
-      box-shadow: none;
-    }
-    .panel:after {
-      border-radius: 0;
-    }
-    .panel .panel-heading {
-      border-radius: 0;
-      box-shadow: none;
-    }
-  }
-
-  &.closed {
-    transform: translate(100%);
-  }
-}
-
 @keyframes modal-background-fadein {
   from {
     background-color: rgba(0, 0, 0, 0);
diff --git a/src/App.vue b/src/App.vue
index 54155831..3b8623ad 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -46,13 +46,6 @@
       <media-modal></media-modal>
     </div>
     <chat-panel :floating="true" v-if="currentUser && chat" class="floating-chat mobile-hidden"></chat-panel>
-    <div v-if="isMobileLayout">
-      <side-drawer ref="sideDrawer" :logout="logout"></side-drawer>
-      <div class="mobile-notifications" :class="{ 'closed': !notificationsOpen }">
-        <notifications/>
-      </div>
-    </div>
-    <MobilePostStatusModal />
   </div>
 </template>
 
diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js
index a79aa636..88fab656 100644
--- a/src/components/mobile_nav/mobile_nav.js
+++ b/src/components/mobile_nav/mobile_nav.js
@@ -1,11 +1,13 @@
 import SideDrawer from '../side_drawer/side_drawer.vue'
 import Notifications from '../notifications/notifications.vue'
+import MobilePostStatusModal from '../mobile_post_status_modal/mobile_post_status_modal.vue'
 import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils'
 
 const MobileNav = {
   components: {
     SideDrawer,
-    Notifications
+    Notifications,
+    MobilePostStatusModal
   },
   data: () => ({
     notificationsOpen: false
@@ -25,9 +27,19 @@ const MobileNav = {
     },
     toggleMobileNotifications () {
       this.notificationsOpen = !this.notificationsOpen
+      if (!this.notificationsOpen) {
+        this.markNotificationsAsSeen()
+      }
     },
     scrollToTop () {
       window.scrollTo(0, 0)
+    },
+    logout () {
+      this.$router.replace('/main/public')
+      this.$store.dispatch('logout')
+    },
+    markNotificationsAsSeen () {
+      this.$refs.notifications.markAsSeen()
     }
   }
 }
diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue
index 8f682c39..af2d6d5a 100644
--- a/src/components/mobile_nav/mobile_nav.vue
+++ b/src/components/mobile_nav/mobile_nav.vue
@@ -1,6 +1,6 @@
 <template>
-  <nav class='nav-bar container' @click="scrollToTop()" id="nav">
-    <div class='inner-nav'>
+  <nav class='nav-bar container asd' id="nav">
+    <div class='inner-nav mobile-inner-nav' @click="scrollToTop()" :class="{ 'shifted': notificationsOpen }">
       <div class='item'>
         <a href="#" class="menu-button" @click.stop.prevent="toggleMobileSidebar()">
           <i class="button-icon icon-menu"></i>
@@ -13,17 +13,102 @@
           <div class="alert-dot" v-if="unseenNotificationsCount"></div>
         </a>
       </div>
+      <div class="mobile-notifications-header">
+        <span>Notifications</span>
+        <i class="icon-cancel" @click.stop.prevent="toggleMobileNotifications()"/>
+      </div>
     </div>
     <SideDrawer ref="sideDrawer" :logout="logout"/>
     <div class="mobile-notifications" :class="{ 'closed': !notificationsOpen }">
-      <Notifications/>
+      <Notifications ref="notifications" noHeading="true"/>
     </div>
+    <MobilePostStatusModal />
   </nav>
 </template>
 
 <script src="./mobile_nav.js"></script>
 
 <style lang="scss">
+@import '../../_variables.scss';
+
+.mobile-inner-nav {
+  transition: transform 0.25s;
+  &.shifted {
+    transform: translateX(-100%);
+  }
+}
+
+.mobile-notifications-header {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  width: calc(100% - 1.6em);
+  height: 100%;
+  margin: 0 0.8em 0 0.8em;
+  position: absolute;
+  font-size: 1.3em;
+  color: $fallback--text;
+  color: var(--text, $fallback--text);
+  top: 0;
+  left: 100%;
+}
+
+.menu-button {
+  position: relative;
+}
+
+.alert-dot {
+  border-radius: 100%;
+  height: 8px;
+  width: 8px;
+  position: absolute;
+  left: calc(50% - 4px);
+  top: calc(50% - 4px);
+  margin-left: 6px;
+  margin-top: -6px;
+  background-color: $fallback--cRed;
+  background-color: var(--badgeNotification, $fallback--cRed);
+}
+
+.mobile-notifications {
+  position: fixed;
+  width: 100vw;
+  height: calc(100vh - 50px);
+  top: 50px;
+  left: 0;
+  overflow-x: hidden;
+  overflow-y: scroll;
+  transition-property: transform;
+  transition-duration: 0.25s;
+  transform: translate(0);
+
+  color: $fallback--text;
+  color: var(--text, $fallback--text);
+  background-color: $fallback--bg;
+  background-color: var(--bg, $fallback--bg);
+
+  .notifications {
+    margin: 0;
+    padding: 0;
+    border-radius: 0;
+    box-shadow: none;
+    .panel {
+      border-radius: 0;
+      margin: 0;
+      box-shadow: none;
+    }
+    .panel:after {
+      border-radius: 0;
+    }
+    .panel .panel-heading {
+      border-radius: 0;
+      box-shadow: none;
+    }
+  }
 
+  &.closed {
+    transform: translate(100%);
+  }
+}
 
 </style>
diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js
index 9fc5e38a..d3db4b29 100644
--- a/src/components/notifications/notifications.js
+++ b/src/components/notifications/notifications.js
@@ -7,6 +7,9 @@ import {
 } from '../../services/notification_utils/notification_utils.js'
 
 const Notifications = {
+  props: [
+    'noHeading'
+  ],
   created () {
     const store = this.$store
     const credentials = store.state.users.currentUser.credentials
diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue
index 6f162b62..634a03ac 100644
--- a/src/components/notifications/notifications.vue
+++ b/src/components/notifications/notifications.vue
@@ -1,7 +1,7 @@
 <template>
   <div class="notifications">
     <div class="panel panel-default">
-      <div class="panel-heading">
+      <div v-if="!noHeading" class="panel-heading">
         <div class="title">
           {{$t('notifications.notifications')}}
           <span class="badge badge-notification unseen-count" v-if="unseenCount">{{unseenCount}}</span>
-- 
cgit v1.2.3-70-g09d2


From 52326e65515317be4815aaef320965313f84d64b Mon Sep 17 00:00:00 2001
From: dave <starpumadev@gmail.com>
Date: Thu, 14 Mar 2019 11:57:24 -0400
Subject: #436: remove clear & dismiss UI updates

---
 src/components/notification/notification.js    |  3 ---
 src/components/notification/notification.vue   |  5 ----
 src/components/notifications/notifications.js  |  3 ---
 src/components/notifications/notifications.vue |  3 +--
 src/components/status/status.js                |  6 +----
 src/components/status/status.vue               |  3 ---
 src/i18n/en.json                               |  2 --
 src/modules/statuses.js                        | 36 +-------------------------
 src/services/api/api.service.js                | 25 +-----------------
 9 files changed, 4 insertions(+), 82 deletions(-)

(limited to 'src/components/notifications/notifications.vue')

diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js
index c86f22bb..fe5b7018 100644
--- a/src/components/notification/notification.js
+++ b/src/components/notification/notification.js
@@ -21,9 +21,6 @@ const Notification = {
     },
     userProfileLink (user) {
       return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
-    },
-    dismiss () {
-      this.$store.dispatch('dismissNotifications', { id: this.notification.id })
     }
   },
   computed: {
diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue
index 6e8e9844..fa931fb6 100644
--- a/src/components/notification/notification.vue
+++ b/src/components/notification/notification.vue
@@ -3,8 +3,6 @@
     v-if="notification.type === 'mention'" 
     :compact="true" 
     :statusoid="notification.status"
-    isNotification="true"
-    @dismissNotification="dismiss"
   >
   </status>
   <div class="non-mention" :class="[userClass, { highlighted: userStyle }]" :style="[ userStyle ]"v-else>
@@ -40,9 +38,6 @@
             <timeago :since="notification.action.created_at" :auto-update="240"></timeago>
           </router-link>
         </div>
-        <span class="button-icon" @click.prevent="dismiss">
-          <i class="button-icon icon-cancel delete-status"></i>
-        </span>
       </span>
       <div class="follow-text" v-if="notification.type === 'follow'">
         <router-link :to="userProfileLink(notification.action.user)">
diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js
index 68004d54..e1c53c58 100644
--- a/src/components/notifications/notifications.js
+++ b/src/components/notifications/notifications.js
@@ -55,9 +55,6 @@ const Notifications = {
     markAsSeen () {
       this.$store.dispatch('markNotificationsAsSeen')
     },
-    clear () {
-      this.$store.dispatch('clearNotifications')
-    },
     fetchOlderNotifications () {
       const store = this.$store
       const credentials = store.state.users.currentUser.credentials
diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue
index 5a5f8ed8..05f51f6c 100644
--- a/src/components/notifications/notifications.vue
+++ b/src/components/notifications/notifications.vue
@@ -9,8 +9,7 @@
         <div @click.prevent class="loadmore-error alert error" v-if="error">
           {{$t('timeline.error_fetching')}}
         </div>
-        <!-- <button v-if="unseenCount" @click.prevent="markAsSeen" class="read-button">{{$t('notifications.read')}}</button> -->
-        <button v-if="notifications.length" @click.prevent="clear" class="read-button">{{$t('notifications.clear')}}</button>
+        <button v-if="unseenCount" @click.prevent="markAsSeen" class="read-button">{{$t('notifications.read')}}</button>
       </div>
       <div class="panel-body">
         <div v-for="notification in visibleNotifications" :key="notification.action.id + notification.id" class="notification" :class='{"unseen": !notification.seen}'>
diff --git a/src/components/status/status.js b/src/components/status/status.js
index 4cd26be3..9e18fe15 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -25,8 +25,7 @@ const Status = {
     'replies',
     'isPreview',
     'noHeading',
-    'inlineExpanded',
-    'isNotification'
+    'inlineExpanded'
   ],
   data () {
     return {
@@ -366,9 +365,6 @@ const Status = {
     setMedia () {
       const attachments = this.attachmentSize === 'hide' ? this.status.attachments : this.galleryAttachments
       return () => this.$store.dispatch('setMedia', attachments)
-    },
-    dismissNotification () {
-      this.$emit('dismissNotification')
     }
   },
   watch: {
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index 28a44346..1f6d0325 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -52,9 +52,6 @@
                 <a :href="status.external_url" target="_blank" v-if="!status.is_local && !isPreview" class="source_url" title="Source">
                   <i class="button-icon icon-link-ext-alt"></i>
                 </a>
-                <span class="button-icon" v-if="isNotification" @click.prevent="dismissNotification">
-                  <i class="button-icon icon-cancel delete-status"></i>
-                </span>
                 <template v-if="expandable && !isPreview">
                   <a href="#" @click.prevent="toggleExpanded" title="Expand">
                     <i class="button-icon icon-plus-squared"></i>
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 38abfaf5..01fe2fba 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -62,8 +62,6 @@
     "load_older": "Load older notifications",
     "notifications": "Notifications",
     "read": "Read!",
-    "clear": "Clear!",
-    "dismiss": "Dismiss!",
     "repeated_you": "repeated your status",
     "no_more_notifications": "No more notifications"
   },
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
index 4cc3907d..1eb1a3e3 100644
--- a/src/modules/statuses.js
+++ b/src/modules/statuses.js
@@ -1,4 +1,4 @@
-import { remove, slice, each, find, findIndex, maxBy, minBy, merge, first, last, isArray } from 'lodash'
+import { remove, slice, each, find, maxBy, minBy, merge, first, last, isArray } from 'lodash'
 import apiService from '../services/api/api.service.js'
 // import parse from '../services/status_parser/status_parser.js'
 
@@ -390,27 +390,6 @@ export const mutations = {
       notification.seen = true
     })
   },
-  clearNotifications (state) {
-    state.notifications.data = []
-    state.notifications.idStore = {}
-    state.notifications.maxId = 0
-    state.notifications.minId = 0
-  },
-  dismissNotifications (state, { id }) {
-    const { data } = state.notifications
-    const idx = findIndex(data, { id })
-
-    if (idx !== -1) {
-      const notification = data[idx]
-      data.splice(idx, 1)
-      delete state.notifications.idStore[id]
-      if (state.notifications.maxId === notification.id) {
-        state.notifications.maxId = data.length ? maxBy(data, 'id').id : 0
-      } else if (state.notifications.minId === notification.id) {
-        state.notifications.minId = data.length ? minBy(data, 'id').id : 0
-      }
-    }
-  },
   queueFlush (state, { timeline, id }) {
     state.timelines[timeline].flushMarker = id
   }
@@ -495,19 +474,6 @@ const statuses = {
         id: rootState.statuses.notifications.maxId,
         credentials: rootState.users.currentUser.credentials
       })
-    },
-    clearNotifications ({ rootState, commit }) {
-      commit('clearNotifications')
-      apiService.clearNotifications({
-        credentials: rootState.users.currentUser.credentials
-      })
-    },
-    dismissNotifications ({ rootState, commit }, { id }) {
-      commit('dismissNotifications', { id })
-      apiService.dismissNotifications({
-        id,
-        credentials: rootState.users.currentUser.credentials
-      })
     }
   },
   mutations
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 9d3139ce..03553d75 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -43,8 +43,6 @@ const SUGGESTIONS_URL = '/api/v1/suggestions'
 
 const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites'
 const MASTODON_USER_NOTIFICATIONS_URL = '/api/v1/notifications'
-const MASTODON_USER_NOTIFICATIONS_CLEAR_URL = '/api/v1/notifications/clear'
-const MASTODON_USER_NOTIFICATIONS_DISMISS_URL = '/api/v1/notifications/dismiss'
 
 import { each, map } from 'lodash'
 import { parseStatus, parseUser, parseNotification } from '../entity_normalizer/entity_normalizer.service.js'
@@ -577,25 +575,6 @@ const markNotificationsAsSeen = ({id, credentials}) => {
   }).then((data) => data.json())
 }
 
-const clearNotifications = ({ credentials }) => {
-  return fetch(MASTODON_USER_NOTIFICATIONS_CLEAR_URL, {
-    headers: authHeaders(credentials),
-    method: 'POST'
-  }).then((data) => data.json())
-}
-
-const dismissNotifications = ({ id, credentials }) => {
-  const body = new FormData()
-
-  body.append('id', id)
-
-  return fetch(MASTODON_USER_NOTIFICATIONS_DISMISS_URL, {
-    body,
-    headers: authHeaders(credentials),
-    method: 'POST'
-  }).then((data) => data.json())
-}
-
 const apiService = {
   verifyCredentials,
   fetchTimeline,
@@ -636,9 +615,7 @@ const apiService = {
   approveUser,
   denyUser,
   suggestions,
-  markNotificationsAsSeen,
-  clearNotifications,
-  dismissNotifications
+  markNotificationsAsSeen
 }
 
 export default apiService
-- 
cgit v1.2.3-70-g09d2


From 8ade93bb4db60e04e5e63d533401ee79de403e19 Mon Sep 17 00:00:00 2001
From: dave <starpumadev@gmail.com>
Date: Thu, 14 Mar 2019 22:36:11 -0400
Subject: #436: update test

---
 src/components/notifications/notifications.vue     |   2 +-
 test/fixtures/mastoapi.json                        | 125 ++++++++++++++++-----
 .../entity_normalizer/entity_normalizer.spec.js    |   5 +-
 3 files changed, 105 insertions(+), 27 deletions(-)

(limited to 'src/components/notifications/notifications.vue')

diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue
index 05f51f6c..37104b90 100644
--- a/src/components/notifications/notifications.vue
+++ b/src/components/notifications/notifications.vue
@@ -12,7 +12,7 @@
         <button v-if="unseenCount" @click.prevent="markAsSeen" class="read-button">{{$t('notifications.read')}}</button>
       </div>
       <div class="panel-body">
-        <div v-for="notification in visibleNotifications" :key="notification.action.id + notification.id" class="notification" :class='{"unseen": !notification.seen}'>
+        <div v-for="notification in visibleNotifications" :key="notification.id" class="notification" :class='{"unseen": !notification.seen}'>
           <div class="notification-overlay"></div>
           <notification :notification="notification"></notification>
         </div>
diff --git a/test/fixtures/mastoapi.json b/test/fixtures/mastoapi.json
index 858d7a0d..887fb83e 100644
--- a/test/fixtures/mastoapi.json
+++ b/test/fixtures/mastoapi.json
@@ -58,7 +58,10 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/16033fbb-97c0-4f0e-b834-7abb92fb8639",
     "url": "https://shigusegubu.club/objects/16033fbb-97c0-4f0e-b834-7abb92fb8639",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -127,7 +130,10 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/6634d32b-96a8-4852-a3db-ac8730715779",
     "url": "https://shigusegubu.club/objects/6634d32b-96a8-4852-a3db-ac8730715779",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -250,7 +256,10 @@
         "tags": [],
         "uri": "https://pleroma.soykaf.com/objects/bf7e43d4-5048-4176-8519-58e3e1014f8b",
         "url": "https://pleroma.soykaf.com/objects/bf7e43d4-5048-4176-8519-58e3e1014f8b",
-        "visibility": "public"
+        "visibility": "public",
+        "pleroma": {
+            "local": true
+        }
     },
     "reblogged": false,
     "reblogs_count": 0,
@@ -260,7 +269,10 @@
     "tags": [],
     "uri": "https://pleroma.soykaf.com/objects/bf7e43d4-5048-4176-8519-58e3e1014f8b",
     "url": "https://pleroma.soykaf.com/objects/bf7e43d4-5048-4176-8519-58e3e1014f8b",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -329,7 +341,10 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/0f963ca1-a263-41ca-a43c-b5d26d0a08e9",
     "url": "https://shigusegubu.club/objects/0f963ca1-a263-41ca-a43c-b5d26d0a08e9",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -390,7 +405,10 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/3f809bd8-656f-4a29-81d4-80eed6916eb0",
     "url": "https://shigusegubu.club/objects/3f809bd8-656f-4a29-81d4-80eed6916eb0",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -516,7 +534,10 @@
         }],
         "uri": "tag:social.super-niche.club,2019-01-17:noticeId=2353002:objectType=note",
         "url": "https://social.super-niche.club/notice/2353002",
-        "visibility": "public"
+        "visibility": "public",
+        "pleroma": {
+            "local": true
+        }
     },
     "reblogged": false,
     "reblogs_count": 0,
@@ -529,7 +550,10 @@
     }],
     "uri": "tag:social.super-niche.club,2019-01-17:noticeId=2353002:objectType=note",
     "url": "tag:social.super-niche.club,2019-01-17:noticeId=2353002:objectType=note",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -657,7 +681,10 @@
         "tags": [],
         "uri": "https://miniwa.moe/objects/448e2944-0ecd-457f-92c3-cb454f2b0fab",
         "url": "https://miniwa.moe/objects/448e2944-0ecd-457f-92c3-cb454f2b0fab",
-        "visibility": "public"
+        "visibility": "public",
+        "pleroma": {
+            "local": true
+        }
     },
     "reblogged": false,
     "reblogs_count": 0,
@@ -667,7 +694,10 @@
     "tags": [],
     "uri": "https://miniwa.moe/objects/448e2944-0ecd-457f-92c3-cb454f2b0fab",
     "url": "https://miniwa.moe/objects/448e2944-0ecd-457f-92c3-cb454f2b0fab",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -733,7 +763,10 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/38b1bc44-15d8-40dd-b1aa-937e0ff4a86d",
     "url": "https://shigusegubu.club/objects/38b1bc44-15d8-40dd-b1aa-937e0ff4a86d",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -794,7 +827,10 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/fbff5da4-a517-42a9-bca9-17cae8cf2542",
     "url": "https://shigusegubu.club/objects/fbff5da4-a517-42a9-bca9-17cae8cf2542",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -850,7 +886,10 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/4007d659-27c6-4577-be10-fd134f5e4e7e",
     "url": "https://shigusegubu.club/objects/4007d659-27c6-4577-be10-fd134f5e4e7e",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -906,7 +945,10 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/59912d51-1cc6-4dc7-828c-f167e6c8b391",
     "url": "https://shigusegubu.club/objects/59912d51-1cc6-4dc7-828c-f167e6c8b391",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -962,7 +1004,10 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/62690bce-3f49-4047-9c8e-8941f2f79e10",
     "url": "https://shigusegubu.club/objects/62690bce-3f49-4047-9c8e-8941f2f79e10",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -1023,7 +1068,10 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/818f3dd0-2ff8-4def-a170-e4d4c405f387",
     "url": "https://shigusegubu.club/objects/818f3dd0-2ff8-4def-a170-e4d4c405f387",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -1084,7 +1132,10 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/0783a193-c097-488d-8944-47df9372cd6e",
     "url": "https://shigusegubu.club/objects/0783a193-c097-488d-8944-47df9372cd6e",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -1145,7 +1196,10 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/145d5252-7b8e-467d-9f36-1db0818f452f",
     "url": "https://shigusegubu.club/objects/145d5252-7b8e-467d-9f36-1db0818f452f",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -1252,7 +1306,10 @@
         "tags": [],
         "uri": "https://pleroma.site/objects/3076c055-0e34-4cf9-86ca-2d148b9b694a",
         "url": "https://pleroma.site/objects/3076c055-0e34-4cf9-86ca-2d148b9b694a",
-        "visibility": "public"
+        "visibility": "public",
+        "pleroma": {
+            "local": true
+        }
     },
     "reblogged": false,
     "reblogs_count": 0,
@@ -1262,7 +1319,10 @@
     "tags": [],
     "uri": "https://pleroma.site/objects/3076c055-0e34-4cf9-86ca-2d148b9b694a",
     "url": "https://pleroma.site/objects/3076c055-0e34-4cf9-86ca-2d148b9b694a",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -1323,7 +1383,10 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/d4eb7c46-02f9-4b1f-83af-926cefa21f33",
     "url": "https://shigusegubu.club/objects/d4eb7c46-02f9-4b1f-83af-926cefa21f33",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -1446,7 +1509,10 @@
         "tags": [],
         "uri": "https://pleroma.soykaf.com/objects/338b6bd2-3c2d-40fe-93a3-28b688782733",
         "url": "https://pleroma.soykaf.com/objects/338b6bd2-3c2d-40fe-93a3-28b688782733",
-        "visibility": "public"
+        "visibility": "public",
+        "pleroma": {
+            "local": true
+        }
     },
     "reblogged": false,
     "reblogs_count": 0,
@@ -1456,7 +1522,10 @@
     "tags": [],
     "uri": "https://pleroma.soykaf.com/objects/338b6bd2-3c2d-40fe-93a3-28b688782733",
     "url": "https://pleroma.soykaf.com/objects/338b6bd2-3c2d-40fe-93a3-28b688782733",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -1517,7 +1586,10 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/f472f4ed-8b0b-492f-9d53-d69eda79629d",
     "url": "https://shigusegubu.club/objects/f472f4ed-8b0b-492f-9d53-d69eda79629d",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }, {
     "account": {
         "acct": "hj",
@@ -1578,5 +1650,8 @@
     "tags": [],
     "uri": "https://shigusegubu.club/objects/d6fb4fd2-1f6a-4446-a1a6-5edd34050096",
     "url": "https://shigusegubu.club/objects/d6fb4fd2-1f6a-4446-a1a6-5edd34050096",
-    "visibility": "public"
+    "visibility": "public",
+    "pleroma": {
+        "local": true
+    }
 }]
diff --git a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
index 6245361c..04bfb953 100644
--- a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
+++ b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
@@ -129,7 +129,10 @@ const makeMockStatusMasto = (overrides = {}) => {
     tags: [],
     uri: 'https://shigusegubu.club/objects/16033fbb-97c0-4f0e-b834-7abb92fb8639',
     url: 'https://shigusegubu.club/objects/16033fbb-97c0-4f0e-b834-7abb92fb8639',
-    visibility: 'public'
+    visibility: 'public',
+    pleroma: {
+      local: true
+    }
   }, overrides)
 }
 
-- 
cgit v1.2.3-70-g09d2


From 543604fd2d107d3c6b7123e5713ac923eb76f23c Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Tue, 14 May 2019 22:38:16 +0300
Subject: removed unused masto api, added initial version of interactions
 timeline

---
 src/boot/routes.js                                 |  4 ++--
 src/components/interactions/interactions.js        | 25 ++++++++++++++++++++++
 src/components/interactions/interactions.vue       | 25 ++++++++++++++++++++++
 src/components/mentions/mentions.vue               |  2 +-
 src/components/nav_panel/nav_panel.vue             |  2 +-
 src/components/notifications/notifications.js      |  8 +++++--
 src/components/notifications/notifications.vue     |  4 ++--
 src/components/tab_switcher/tab_switcher.js        | 13 ++++++++---
 src/services/api/api.service.js                    | 11 ----------
 .../backend_interactor_service.js                  |  5 -----
 .../notification_utils/notification_utils.js       |  6 ++++--
 11 files changed, 76 insertions(+), 29 deletions(-)
 create mode 100644 src/components/interactions/interactions.js
 create mode 100644 src/components/interactions/interactions.vue

(limited to 'src/components/notifications/notifications.vue')

diff --git a/src/boot/routes.js b/src/boot/routes.js
index 7e54a98b..508c76df 100644
--- a/src/boot/routes.js
+++ b/src/boot/routes.js
@@ -3,7 +3,7 @@ import PublicAndExternalTimeline from 'components/public_and_external_timeline/p
 import FriendsTimeline from 'components/friends_timeline/friends_timeline.vue'
 import TagTimeline from 'components/tag_timeline/tag_timeline.vue'
 import ConversationPage from 'components/conversation-page/conversation-page.vue'
-import Mentions from 'components/mentions/mentions.vue'
+import Interactions from 'components/interactions/interactions.vue'
 import DMs from 'components/dm_timeline/dm_timeline.vue'
 import UserProfile from 'components/user_profile/user_profile.vue'
 import Settings from 'components/settings/settings.vue'
@@ -34,7 +34,7 @@ export default (store) => {
     { name: 'tag-timeline', path: '/tag/:tag', component: TagTimeline },
     { name: 'conversation', path: '/notice/:id', component: ConversationPage, meta: { dontScroll: true } },
     { name: 'external-user-profile', path: '/users/:id', component: UserProfile },
-    { name: 'mentions', path: '/users/:username/mentions', component: Mentions },
+    { name: 'mentions', path: '/users/:username/interactions', component: Interactions },
     { name: 'dms', path: '/users/:username/dms', component: DMs },
     { name: 'settings', path: '/settings', component: Settings },
     { name: 'registration', path: '/registration', component: Registration },
diff --git a/src/components/interactions/interactions.js b/src/components/interactions/interactions.js
new file mode 100644
index 00000000..4c56a931
--- /dev/null
+++ b/src/components/interactions/interactions.js
@@ -0,0 +1,25 @@
+import Notifications from '../notifications/notifications.vue'
+
+const tabModeDict = {
+  mentions: ['mention'],
+  'likes+repeats': ['repeat', 'like'],
+  follows: ['follow']
+}
+
+const Interactions = {
+  data () {
+    return {
+      filterMode: tabModeDict['mentions']
+    }
+  },
+  methods: {
+    onModeSwitch(index, dataset) {
+      this.filterMode = tabModeDict[dataset.filter]
+    }
+  },
+  components: {
+    Notifications
+  }
+}
+
+export default Interactions
diff --git a/src/components/interactions/interactions.vue b/src/components/interactions/interactions.vue
new file mode 100644
index 00000000..751e5d40
--- /dev/null
+++ b/src/components/interactions/interactions.vue
@@ -0,0 +1,25 @@
+<template>
+  <div class="panel panel-default">
+    <div class="panel-heading">
+      <div class="title">
+        Interactions
+      </div>
+    </div>
+    <tab-switcher
+      ref="tabSwitcher"
+      :onSwitch="onModeSwitch"
+      >
+      <span data-tab-dummy data-filter="mentions" :label="$t('MENTIONS')"/>
+      <span data-tab-dummy data-filter="likes+repeats" :label="$t('LIKES AND REPEATS')"/>
+      <span data-tab-dummy data-filter="follows" :label="$t('FOLLOWS')"/>
+    </tab-switcher>
+    <Notifications
+      ref="notifications"
+      :noHeading="true"
+      :minimalMode="true"
+      :filterMode="filterMode"
+      />
+  </div>
+</template>
+
+<script src="./interactions.js"></script>
diff --git a/src/components/mentions/mentions.vue b/src/components/mentions/mentions.vue
index bba06da6..6b4e96e0 100644
--- a/src/components/mentions/mentions.vue
+++ b/src/components/mentions/mentions.vue
@@ -1,5 +1,5 @@
 <template>
-  <Timeline :title="$t('nav.mentions')" v-bind:timeline="timeline" v-bind:timeline-name="'mentions'"/>
+  <Timeline :title="$t('nav.interactions')" v-bind:timeline="timeline" v-bind:timeline-name="'mentions'"/>
 </template>
 
 <script src="./mentions.js"></script>
diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue
index 7a7212fb..05097c45 100644
--- a/src/components/nav_panel/nav_panel.vue
+++ b/src/components/nav_panel/nav_panel.vue
@@ -9,7 +9,7 @@
         </li>
         <li v-if='currentUser'>
           <router-link :to="{ name: 'mentions', params: { username: currentUser.screen_name } }">
-            {{ $t("nav.mentions") }}
+            {{ $t("nav.interactions") }}
           </router-link>
         </li>
         <li v-if='currentUser'>
diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js
index 5b13b98e..acc31986 100644
--- a/src/components/notifications/notifications.js
+++ b/src/components/notifications/notifications.js
@@ -8,7 +8,7 @@ import {
 
 const Notifications = {
   props: [
-    'noHeading'
+    'noHeading', 'minimalMode', 'filterMode'
   ],
   data () {
     return {
@@ -16,6 +16,9 @@ const Notifications = {
     }
   },
   computed: {
+    mainClass () {
+      return this.minimalMode ? '' : 'panel panel-default'
+    },
     notifications () {
       return notificationsFromStore(this.$store)
     },
@@ -26,7 +29,8 @@ const Notifications = {
       return unseenNotificationsFromStore(this.$store)
     },
     visibleNotifications () {
-      return visibleNotificationsFromStore(this.$store)
+      console.log(this.filterMode)
+      return visibleNotificationsFromStore(this.$store, this.filterMode)
     },
     unseenCount () {
       return this.unseenNotifications.length
diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue
index 88775be1..3c3ae191 100644
--- a/src/components/notifications/notifications.vue
+++ b/src/components/notifications/notifications.vue
@@ -1,6 +1,6 @@
 <template>
   <div class="notifications">
-    <div class="panel panel-default">
+    <div :class="mainClass">
       <div v-if="!noHeading" class="panel-heading">
         <div class="title">
           {{$t('notifications.notifications')}}
@@ -12,7 +12,7 @@
         <button v-if="unseenCount" @click.prevent="markAsSeen" class="read-button">{{$t('notifications.read')}}</button>
       </div>
       <div class="panel-body">
-        <div v-for="notification in visibleNotifications" :key="notification.id" class="notification" :class='{"unseen": !notification.seen}'>
+        <div v-for="notification in visibleNotifications" :key="notification.id" class="notification" :class='{"unseen": !minimalMode && !notification.seen}'>
           <div class="notification-overlay"></div>
           <notification :notification="notification"></notification>
         </div>
diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js
index 423df258..c949b458 100644
--- a/src/components/tab_switcher/tab_switcher.js
+++ b/src/components/tab_switcher/tab_switcher.js
@@ -4,15 +4,18 @@ import './tab_switcher.scss'
 
 export default Vue.component('tab-switcher', {
   name: 'TabSwitcher',
-  props: ['renderOnlyFocused'],
+  props: ['renderOnlyFocused', 'onSwitch'],
   data () {
     return {
       active: this.$slots.default.findIndex(_ => _.tag)
     }
   },
   methods: {
-    activateTab (index) {
+    activateTab (index, dataset) {
       return () => {
+        if (typeof this.onSwitch === 'function') {
+          this.onSwitch.call(null, index, this.$slots.default[index].elm.dataset)
+        }
         this.active = index
       }
     }
@@ -37,7 +40,11 @@ export default Vue.component('tab-switcher', {
 
             return (
               <div class={ classesWrapper.join(' ')}>
-                <button disabled={slot.data.attrs.disabled} onClick={this.activateTab(index)} class={ classesTab.join(' ') }>{slot.data.attrs.label}</button>
+                <button
+                  disabled={slot.data.attrs.disabled}
+                  onClick={this.activateTab(index)}
+                  class={classesTab.join(' ')}>
+                {slot.data.attrs.label}</button>
               </div>
             )
           })
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index b7a602b8..75a001a4 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -1,7 +1,5 @@
 /* eslint-env browser */
 const LOGIN_URL = '/api/account/verify_credentials.json'
-const ALL_FOLLOWING_URL = '/api/qvitter/allfollowing'
-const MENTIONS_URL = '/api/statuses/mentions.json'
 const REGISTRATION_URL = '/api/account/register.json'
 const BG_UPDATE_URL = '/api/qvitter/update_background_image.json'
 const EXTERNAL_PROFILE_URL = '/api/externalprofile/show.json'
@@ -308,13 +306,6 @@ const fetchFollowers = ({id, maxId, sinceId, limit = 20, credentials}) => {
     .then((data) => data.map(parseUser))
 }
 
-const fetchAllFollowing = ({username, credentials}) => {
-  const url = `${ALL_FOLLOWING_URL}/${username}.json`
-  return fetch(url, { headers: authHeaders(credentials) })
-    .then((data) => data.json())
-    .then((data) => data.map(parseUser))
-}
-
 const fetchFollowRequests = ({credentials}) => {
   const url = FOLLOW_REQUESTS_URL
   return fetch(url, { headers: authHeaders(credentials) })
@@ -434,7 +425,6 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use
   const timelineUrls = {
     public: MASTODON_PUBLIC_TIMELINE,
     friends: MASTODON_USER_HOME_TIMELINE_URL,
-    mentions: MENTIONS_URL,
     dms: MASTODON_DIRECT_MESSAGES_TIMELINE_URL,
     notifications: MASTODON_USER_NOTIFICATIONS_URL,
     'publicAndExternal': MASTODON_PUBLIC_TIMELINE,
@@ -726,7 +716,6 @@ const apiService = {
   postStatus,
   deleteStatus,
   uploadMedia,
-  fetchAllFollowing,
   fetchMutes,
   muteUser,
   unmuteUser,
diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js
index c2b93de4..5d7ae62e 100644
--- a/src/services/backend_interactor_service/backend_interactor_service.js
+++ b/src/services/backend_interactor_service/backend_interactor_service.js
@@ -23,10 +23,6 @@ const backendInteractorService = (credentials) => {
     return apiService.fetchFollowers({id, maxId, sinceId, limit, credentials})
   }
 
-  const fetchAllFollowing = ({username}) => {
-    return apiService.fetchAllFollowing({username, credentials})
-  }
-
   const fetchUser = ({id}) => {
     return apiService.fetchUser({id, credentials})
   }
@@ -134,7 +130,6 @@ const backendInteractorService = (credentials) => {
     unblockUser,
     fetchUser,
     fetchUserRelationship,
-    fetchAllFollowing,
     verifyCredentials: apiService.verifyCredentials,
     startFetchingTimeline,
     startFetchingNotifications,
diff --git a/src/services/notification_utils/notification_utils.js b/src/services/notification_utils/notification_utils.js
index 8afd114e..f9cbbade 100644
--- a/src/services/notification_utils/notification_utils.js
+++ b/src/services/notification_utils/notification_utils.js
@@ -25,11 +25,13 @@ const sortById = (a, b) => {
   }
 }
 
-export const visibleNotificationsFromStore = store => {
+export const visibleNotificationsFromStore = (store, types) => {
   // map is just to clone the array since sort mutates it and it causes some issues
   let sortedNotifications = notificationsFromStore(store).map(_ => _).sort(sortById)
   sortedNotifications = sortBy(sortedNotifications, 'seen')
-  return sortedNotifications.filter((notification) => visibleTypes(store).includes(notification.type))
+  return sortedNotifications.filter(
+    (notification) => (types || visibleTypes(store)).includes(notification.type)
+  )
 }
 
 export const unseenNotificationsFromStore = store =>
-- 
cgit v1.2.3-70-g09d2


From 7976d118ca60143b25d111c24a45eff1d083fd9b Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Wed, 15 May 2019 20:44:35 +0300
Subject: Cleanup, little documentation, localization

---
 src/boot/routes.js                              |  2 +-
 src/components/interactions/interactions.vue    |  6 +++---
 src/components/nav_panel/nav_panel.vue          |  2 +-
 src/components/notifications/notifications.js   | 12 +++++++++---
 src/components/notifications/notifications.scss |  6 ++++--
 src/components/notifications/notifications.vue  |  6 ++++--
 src/components/side_drawer/side_drawer.vue      |  5 +++++
 src/i18n/en.json                                |  6 ++++++
 src/i18n/ru.json                                |  6 ++++++
 9 files changed, 39 insertions(+), 12 deletions(-)

(limited to 'src/components/notifications/notifications.vue')

diff --git a/src/boot/routes.js b/src/boot/routes.js
index 508c76df..1a179099 100644
--- a/src/boot/routes.js
+++ b/src/boot/routes.js
@@ -34,7 +34,7 @@ export default (store) => {
     { name: 'tag-timeline', path: '/tag/:tag', component: TagTimeline },
     { name: 'conversation', path: '/notice/:id', component: ConversationPage, meta: { dontScroll: true } },
     { name: 'external-user-profile', path: '/users/:id', component: UserProfile },
-    { name: 'mentions', path: '/users/:username/interactions', component: Interactions },
+    { name: 'interactions', path: '/users/:username/interactions', component: Interactions },
     { name: 'dms', path: '/users/:username/dms', component: DMs },
     { name: 'settings', path: '/settings', component: Settings },
     { name: 'registration', path: '/registration', component: Registration },
diff --git a/src/components/interactions/interactions.vue b/src/components/interactions/interactions.vue
index 751e5d40..5a204ca7 100644
--- a/src/components/interactions/interactions.vue
+++ b/src/components/interactions/interactions.vue
@@ -9,9 +9,9 @@
       ref="tabSwitcher"
       :onSwitch="onModeSwitch"
       >
-      <span data-tab-dummy data-filter="mentions" :label="$t('MENTIONS')"/>
-      <span data-tab-dummy data-filter="likes+repeats" :label="$t('LIKES AND REPEATS')"/>
-      <span data-tab-dummy data-filter="follows" :label="$t('FOLLOWS')"/>
+      <span data-tab-dummy data-filter="mentions" :label="$t('nav.mentions')"/>
+      <span data-tab-dummy data-filter="likes+repeats" :label="$t('interactions.favs_repeats')"/>
+      <span data-tab-dummy data-filter="follows" :label="$t('interactions.follows')"/>
     </tab-switcher>
     <Notifications
       ref="notifications"
diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue
index 05097c45..e6e0f074 100644
--- a/src/components/nav_panel/nav_panel.vue
+++ b/src/components/nav_panel/nav_panel.vue
@@ -8,7 +8,7 @@
           </router-link>
         </li>
         <li v-if='currentUser'>
-          <router-link :to="{ name: 'mentions', params: { username: currentUser.screen_name } }">
+          <router-link :to="{ name: 'interactions', params: { username: currentUser.screen_name } }">
             {{ $t("nav.interactions") }}
           </router-link>
         </li>
diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js
index acc31986..3a6e3b94 100644
--- a/src/components/notifications/notifications.js
+++ b/src/components/notifications/notifications.js
@@ -7,9 +7,15 @@ import {
 } from '../../services/notification_utils/notification_utils.js'
 
 const Notifications = {
-  props: [
-    'noHeading', 'minimalMode', 'filterMode'
-  ],
+  props: {
+    // Disables display of panel header
+    noHeading: Boolean,
+    // Disables panel styles, unread mark, potentially other notification-related actions
+    // meant for "Interactions" timeline
+    minimalMode: Boolean,
+    // Custom filter mode, an array of strings, possible values 'mention', 'repeat', 'like', 'follow', used to override global filter for use in "Interactions" timeline
+    filterMode: Array
+ },
   data () {
     return {
       bottomedOut: false
diff --git a/src/components/notifications/notifications.scss b/src/components/notifications/notifications.scss
index c0b458cc..622d12f4 100644
--- a/src/components/notifications/notifications.scss
+++ b/src/components/notifications/notifications.scss
@@ -1,8 +1,10 @@
 @import '../../_variables.scss';
 
 .notifications {
-  // a bit of a hack to allow scrolling below notifications
-  padding-bottom: 15em;
+  &:not(.minimal) {
+    // a bit of a hack to allow scrolling below notifications
+    padding-bottom: 15em;
+  }
 
   .loadmore-error {
     color: $fallback--text;
diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue
index 3c3ae191..c71499b2 100644
--- a/src/components/notifications/notifications.vue
+++ b/src/components/notifications/notifications.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="notifications">
+  <div :class="{ minimal: minimalMode }" class="notifications">
     <div :class="mainClass">
       <div v-if="!noHeading" class="panel-heading">
         <div class="title">
@@ -22,7 +22,9 @@
           {{$t('notifications.no_more_notifications')}}
         </div>
         <a v-else-if="!loading" href="#" v-on:click.prevent="fetchOlderNotifications()">
-          <div class="new-status-notification text-center panel-footer">{{$t('notifications.load_older')}}</div>
+          <div class="new-status-notification text-center panel-footer">
+            {{ minimalMode ? $t('interactions.load_older') : $t('notifications.load_older')}}
+          </div>
         </a>
         <div v-else class="new-status-notification text-center panel-footer">
           <i class="icon-spin3 animate-spin"/>
diff --git a/src/components/side_drawer/side_drawer.vue b/src/components/side_drawer/side_drawer.vue
index 9abb8cef..6428b1b0 100644
--- a/src/components/side_drawer/side_drawer.vue
+++ b/src/components/side_drawer/side_drawer.vue
@@ -26,6 +26,11 @@
             {{ $t("nav.dms") }}
           </router-link>
         </li>
+        <li v-if="currentUser" @click="toggleDrawer">
+          <router-link :to="{ name: 'interactions', params: { username: currentUser.screen_name } }">
+            {{ $t("nav.interactions") }}
+          </router-link>
+        </li>
       </ul>
       <ul>
         <li v-if="currentUser" @click="toggleDrawer">
diff --git a/src/i18n/en.json b/src/i18n/en.json
index b4f0deb2..92d63be8 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -60,6 +60,7 @@
     "chat": "Local Chat",
     "friend_requests": "Follow Requests",
     "mentions": "Mentions",
+    "interactions": "Interactions",
     "dms": "Direct Messages",
     "public_tl": "Public Timeline",
     "timeline": "Timeline",
@@ -78,6 +79,11 @@
     "repeated_you": "repeated your status",
     "no_more_notifications": "No more notifications"
   },
+  "interactions": {
+    "favs_repeats": "Repeats and Favorites",
+    "follows": "New follows",
+    "load_older": "Load older interactions"
+  },
   "post_status": {
     "new_status": "Post new status",
     "account_not_locked_warning": "Your account is not {0}. Anyone can follow you to view your follower-only posts.",
diff --git a/src/i18n/ru.json b/src/i18n/ru.json
index b3ab322d..7a22194a 100644
--- a/src/i18n/ru.json
+++ b/src/i18n/ru.json
@@ -23,6 +23,7 @@
     "back": "Назад",
     "chat": "Локальный чат",
     "mentions": "Упоминания",
+    "interactions": "Взаимодействия",
     "public_tl": "Публичная лента",
     "timeline": "Лента",
     "twkn": "Федеративная лента"
@@ -36,6 +37,11 @@
     "read": "Прочесть",
     "repeated_you": "повторил(а) ваш статус"
   },
+  "interactions": {
+    "favs_repeats": "Повторы и фавориты",
+    "follows": "Новые подписки",
+    "load_older": "Загрузить старые взаимодействия"
+  },
   "post_status": {
     "account_not_locked_warning": "Ваш аккаунт не {0}. Кто угодно может зафоловить вас чтобы прочитать посты только для подписчиков",
     "account_not_locked_warning_link": "залочен",
-- 
cgit v1.2.3-70-g09d2

