aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/services')
-rw-r--r--src/services/api/api.service.js2
-rw-r--r--src/services/entity_normalizer/entity_normalizer.service.js4
-rw-r--r--src/services/mention_matcher/mention_matcher.js9
-rw-r--r--src/services/notifications_fetcher/notifications_fetcher.service.js1
-rw-r--r--src/services/timeline_fetcher/timeline_fetcher.service.js5
5 files changed, 18 insertions, 3 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 5b0d8650..31b48cb6 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -130,7 +130,7 @@ const updateBanner = ({credentials, params}) => {
// description
const updateProfile = ({credentials, params}) => {
// Always include these fields, because they might be empty or false
- const fields = ['description', 'locked', 'no_rich_text', 'hide_network']
+ const fields = ['description', 'locked', 'no_rich_text', 'hide_followings', 'hide_followers']
let url = PROFILE_UPDATE_URL
const form = new FormData()
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index e69547b6..fa955ad6 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -100,7 +100,8 @@ export const parseUser = (data) => {
output.rights = data.rights
output.no_rich_text = data.no_rich_text
output.default_scope = data.default_scope
- output.hide_network = data.hide_network
+ output.hide_followings = data.hide_followings
+ output.hide_followers = data.hide_followers
output.background_image = data.background_image
// on mastoapi this info is contained in a "relationship"
output.following = data.following
@@ -215,6 +216,7 @@ export const parseStatus = (data) => {
output.id = String(data.id)
output.visibility = data.visibility
+ output.card = data.card
output.created_at = new Date(data.created_at)
// Converting to string, the right way.
diff --git a/src/services/mention_matcher/mention_matcher.js b/src/services/mention_matcher/mention_matcher.js
new file mode 100644
index 00000000..2c1ed970
--- /dev/null
+++ b/src/services/mention_matcher/mention_matcher.js
@@ -0,0 +1,9 @@
+
+export const mentionMatchesUrl = (attention, url) => {
+ if (url === attention.statusnet_profile_url) {
+ return true
+ }
+ const [namepart, instancepart] = attention.screen_name.split('@')
+ const matchstring = new RegExp('://' + instancepart + '/.*' + namepart + '$', 'g')
+ return !!url.match(matchstring)
+}
diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js
index 1480cded..b69ec643 100644
--- a/src/services/notifications_fetcher/notifications_fetcher.service.js
+++ b/src/services/notifications_fetcher/notifications_fetcher.service.js
@@ -24,6 +24,7 @@ const fetchAndUpdate = ({store, credentials, older = false}) => {
return apiService.fetchTimeline(args)
.then((notifications) => {
update({store, notifications, older})
+ return notifications
}, () => store.dispatch('setNotificationsError', { value: true }))
.catch(() => store.dispatch('setNotificationsError', { value: true }))
}
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
index 727f6c60..64f8f468 100644
--- a/src/services/timeline_fetcher/timeline_fetcher.service.js
+++ b/src/services/timeline_fetcher/timeline_fetcher.service.js
@@ -29,12 +29,15 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false
args['userId'] = userId
args['tag'] = tag
+ const numStatusesBeforeFetch = timelineData.statuses.length
+
return apiService.fetchTimeline(args)
.then((statuses) => {
- if (!older && statuses.length >= 20 && !timelineData.loading && timelineData.statuses.length) {
+ if (!older && statuses.length >= 20 && !timelineData.loading && numStatusesBeforeFetch > 0) {
store.dispatch('queueFlush', { timeline: timeline, id: timelineData.maxId })
}
update({store, statuses, timeline, showImmediately, userId})
+ return statuses
}, () => store.dispatch('setError', { value: true }))
}