From 63650aec29effef1e5c78d953d078ae4a12cb09f Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 12 Aug 2018 14:14:34 +0300 Subject: Added support for qvitter api fetching of notifications --- src/components/notification/notification.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/notification/notification.vue') diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index eed598a8..1c07bae9 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -11,7 +11,7 @@
{{ notification.action.user.name }} - + {{$t('notifications.favorited_you')}} -- cgit v1.2.3-70-g09d2 From ef515056b5cee27c2b62f3287349c58b67c286e4 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 13 Aug 2018 13:17:10 +0300 Subject: missing files and a plug for bad favs --- src/components/notification/notification.vue | 7 ++-- .../notifications_fetcher.service.js | 41 ++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 src/services/notifications_fetcher/notifications_fetcher.service.js (limited to 'src/components/notification/notification.vue') diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index 1c07bae9..5d50e72a 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -24,12 +24,15 @@ {{$t('notifications.followed_you')}}
- +
@{{notification.action.user.screen_name}}
- + +
+ Favorite for missing post +
diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js new file mode 100644 index 00000000..5aedc4fb --- /dev/null +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -0,0 +1,41 @@ +import apiService from '../api/api.service.js' + +const update = ({store, notifications, older}) => { + store.dispatch('setNotificationsError', { value: false }) + + store.dispatch('addNewNotifications', { notifications, older }) +} + +const fetchAndUpdate = ({store, credentials, older = false}) => { + const args = { credentials } + const rootState = store.rootState || store.state + const timelineData = rootState.statuses.notifications + + if (older) { + if (timelineData.minId !== Number.POSITIVE_INFINITY) { + args['until'] = timelineData.minId + } + } else { + args['since'] = timelineData.maxId + } + + args['timeline'] = 'notifications' + + return apiService.fetchTimeline(args) + .then((notifications) => { + update({store, notifications, older}) + }, () => store.dispatch('setNotificationsError', { value: true })) +} + +const startFetching = ({credentials, store}) => { + fetchAndUpdate({ credentials, store }) + const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store }) + return setInterval(boundFetchAndUpdate, 10000) +} + +const notificationsFetcher = { + fetchAndUpdate, + startFetching +} + +export default notificationsFetcher -- cgit v1.2.3-70-g09d2 From 693eb4b717e8e1e0ecd4c7c5e4e0fa9cbdd8541a Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 16 Aug 2018 13:41:45 +0300 Subject: cleanup, updated broken favorites look + localization strings --- src/components/notification/notification.vue | 10 ++++++---- src/components/notifications/notifications.scss | 10 ++++++++++ src/i18n/messages.js | 6 ++++-- src/modules/api.js | 1 - 4 files changed, 20 insertions(+), 7 deletions(-) (limited to 'src/components/notification/notification.vue') diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index 5d50e72a..2485b9ff 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -29,10 +29,12 @@ - -
- Favorite for missing post -
+ diff --git a/src/components/notifications/notifications.scss b/src/components/notifications/notifications.scss index 008530b4..09741060 100644 --- a/src/components/notifications/notifications.scss +++ b/src/components/notifications/notifications.scss @@ -58,6 +58,16 @@ border-bottom-color: inherit; padding-left: 4px; + .broken-favorite { + border-radius: $fallback--tooltipRadius; + border-radius: var(--tooltipRadius, $fallback--tooltipRadius); + color: $fallback--faint; + color: var(--faint, $fallback--faint); + background-color: $fallback--cAlertRed; + background-color: var(--cAlertRed, $fallback--cAlertRed); + padding: 2px .5em + } + .avatar-compact { width: 32px; height: 32px; diff --git a/src/i18n/messages.js b/src/i18n/messages.js index e9d6e176..cd605c05 100644 --- a/src/i18n/messages.js +++ b/src/i18n/messages.js @@ -339,7 +339,8 @@ const en = { read: 'Read!', followed_you: 'followed you', favorited_you: 'favorited your status', - repeated_you: 'repeated your status' + repeated_you: 'repeated your status', + broken_favorite: 'Unknown status, searching for it...' }, login: { login: 'Log in', @@ -1628,7 +1629,8 @@ const ru = { read: 'Прочесть', followed_you: 'начал(а) читать вас', favorited_you: 'нравится ваш статус', - repeated_you: 'повторил(а) ваш статус' + repeated_you: 'повторил(а) ваш статус', + broken_favorite: 'Неизвестный статус, ищем...' }, login: { login: 'Войти', diff --git a/src/modules/api.js b/src/modules/api.js index 20586f5c..2f07a91e 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -47,7 +47,6 @@ const api = { } }, fetchOldPost (store, { postId }) { - console.log(store) store.state.backendInteractor.fetchOldPost({ store, postId }) }, stopFetching (store, timeline) { -- cgit v1.2.3-70-g09d2