diff --git a/src/routes/_actions/streaming.js b/src/routes/_actions/streaming.js
index 72b9f26c..3bd6f297 100644
--- a/src/routes/_actions/streaming.js
+++ b/src/routes/_actions/streaming.js
@@ -16,6 +16,14 @@ function processMessage (instanceName, timelineName, message) {
case 'notification':
addStatusOrNotification(instanceName, 'notifications', JSON.parse(payload))
break
+ case 'conversation':
+ // This is a hack in order to mostly fit the conversation model into
+ // a timeline of statuses. To have a clean implementation we would need to
+ // reproduce what is done for statuses for the conversation.
+ //
+ // It will add new DMs as new conversations intead of updating existing threads
+ addStatusOrNotification(instanceName, timelineName, JSON.parse(payload).last_status)
+ break
}
stop('processMessage')
}
@@ -24,7 +32,12 @@ export function createStream (streamingApi, instanceName, accessToken,
timelineName, onOpenStream) {
return new TimelineStream(streamingApi, accessToken, timelineName, {
onMessage (msg) {
- if (msg.event !== 'update' && msg.event !== 'delete' && msg.event !== 'notification') {
+ if (
+ msg.event !== 'update' &&
+ msg.event !== 'delete' &&
+ msg.event !== 'notification' &&
+ msg.event !== 'conversation'
+ ) {
console.error("don't know how to handle event", msg)
return
}
diff --git a/src/routes/_api/TimelineStream.js b/src/routes/_api/TimelineStream.js
index 4c6e73df..1baef004 100644
--- a/src/routes/_api/TimelineStream.js
+++ b/src/routes/_api/TimelineStream.js
@@ -12,6 +12,8 @@ function getStreamName (timeline) {
return 'user'
case 'notifications':
return 'user:notification'
+ case 'conversations':
+ return 'direct'
}
if (timeline.startsWith('tag/')) {
return 'hashtag'
diff --git a/src/routes/_api/timelines.js b/src/routes/_api/timelines.js
index 7fc1c727..25e9f5c0 100644
--- a/src/routes/_api/timelines.js
+++ b/src/routes/_api/timelines.js
@@ -12,6 +12,8 @@ function getTimelineUrlPath (timeline) {
return 'notifications'
case 'favorites':
return 'favourites'
+ case 'conversations':
+ return 'conversations'
}
if (timeline.startsWith('tag/')) {
return 'timelines/tag'
@@ -61,5 +63,8 @@ export function getTimeline (instanceName, accessToken, timeline, maxId, since,
url += '?' + paramsString(params)
- return get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT })
+ const timelineRequest = get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT })
+
+ if (timeline !== 'conversations') return timelineRequest
+ return timelineRequest.then(items => items.map(item => item.last_status))
}
diff --git a/src/routes/_components/NavShortcuts.html b/src/routes/_components/NavShortcuts.html
index a2aed5b9..edbeb590 100644
--- a/src/routes/_components/NavShortcuts.html
+++ b/src/routes/_components/NavShortcuts.html
@@ -4,6 +4,7 @@
Your conversations will appear here when logged in.
+