From 1d25fa641eb1c1cfb2cfdc4955ace753d07b832b Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Thu, 8 Feb 2018 09:15:25 -0800 Subject: [PATCH] add lists support --- bin/svgs.js | 1 + routes/_api/lists.js | 8 ++++ routes/_api/timelines.js | 6 ++- routes/_components/Nav.html | 11 +++++ routes/_components/timeline/Timeline.html | 2 + routes/_database/databaseCore.js | 8 ++++ routes/_store/instanceComputations.js | 20 ++++++++ routes/_store/{obsevers.js => observers.js} | 2 + routes/_store/store.js | 5 +- routes/community/_actions/community.js | 19 ++++++++ .../community/_components/PageListItem.html | 1 + routes/community/index.html | 11 +++++ routes/favorites.html | 4 +- routes/federated.html | 4 +- routes/lists/[listId].html | 47 +++++++++++++++++++ routes/local.html | 4 +- templates/2xx.html | 1 + 17 files changed, 148 insertions(+), 6 deletions(-) create mode 100644 routes/_api/lists.js rename routes/_store/{obsevers.js => observers.js} (78%) create mode 100644 routes/community/_actions/community.js create mode 100644 routes/lists/[listId].html diff --git a/bin/svgs.js b/bin/svgs.js index f0138f90..70bafae5 100644 --- a/bin/svgs.js +++ b/bin/svgs.js @@ -22,4 +22,5 @@ module.exports = [ {id:'fa-comments', src:'node_modules/font-awesome-svg-png/white/svg/comments.svg', title: 'Conversations'}, {id:'fa-paperclip', src:'node_modules/font-awesome-svg-png/white/svg/paperclip.svg', title: 'Paperclip'}, {id:'fa-thumbtack', src:'node_modules/font-awesome-svg-png/white/svg/thumb-tack.svg', title: 'Thumbtack'}, + {id:'fa-bars', src:'node_modules/font-awesome-svg-png/white/svg/bars.svg', title: 'List'}, ] \ No newline at end of file diff --git a/routes/_api/lists.js b/routes/_api/lists.js new file mode 100644 index 00000000..056154b7 --- /dev/null +++ b/routes/_api/lists.js @@ -0,0 +1,8 @@ +import { get } from '../_utils/ajax' + +export function getLists(instanceName, accessToken) { + let url = `https://${instanceName}/api/v1/lists` + return get(url, { + 'Authorization': `Bearer ${accessToken}` + }) +} \ No newline at end of file diff --git a/routes/_api/timelines.js b/routes/_api/timelines.js index 1f9619d4..40f887e2 100644 --- a/routes/_api/timelines.js +++ b/routes/_api/timelines.js @@ -19,6 +19,8 @@ function getTimelineUrlPath(timeline) { return 'statuses' } else if (timeline.startsWith('account/')) { return 'accounts' + } else if (timeline.startsWith('list/')) { + return 'timelines/list' } } @@ -31,7 +33,9 @@ export function getTimeline(instanceName, accessToken, timeline, maxId, since) { } else if (timeline.startsWith('status/')) { url += '/' + timeline.split('/').slice(-1)[0] + '/context' } else if (timeline.startsWith('account/')) { - url += '/' + timeline.split('/').slice(-1)[0] +'/statuses' + url += '/' + timeline.split('/').slice(-1)[0] + '/statuses' + } else if (timeline.startsWith('list/')) { + url += '/' + timeline.split('/').slice(-1)[0] } let params = {} diff --git a/routes/_components/Nav.html b/routes/_components/Nav.html index e8c82225..655bb478 100644 --- a/routes/_components/Nav.html +++ b/routes/_components/Nav.html @@ -18,6 +18,10 @@
  • + {{elseif $pinnedPage.startsWith('/lists/')}} +
  • + +
  • {{/if}}
  • @@ -60,8 +64,15 @@ \ No newline at end of file diff --git a/routes/local.html b/routes/local.html index 4ade3027..bd885ec2 100644 --- a/routes/local.html +++ b/routes/local.html @@ -4,7 +4,9 @@ {{#if $isUserLoggedIn}} - + {{#if $pinnedPage !== '/local'}} + + {{/if}} {{else}} diff --git a/templates/2xx.html b/templates/2xx.html index c465b586..e77acab7 100644 --- a/templates/2xx.html +++ b/templates/2xx.html @@ -87,6 +87,7 @@ body.offline,body.theme-hotpants.offline,body.theme-majesty.offline,body.theme-o Conversations Paperclip Thumbtack +List