From 02afea70ed5959e78fb62caa34576e2db5db6c3c Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sat, 10 Feb 2018 16:03:28 -0800 Subject: [PATCH] add blocked accounts, muted accounts, pinned toots --- bin/svgs.js | 6 +- routes/_api/blockedAndMuted.js | 17 +++++ routes/_api/pinnedStatuses.js | 12 +++ routes/_api/reblogsAndFavs.js | 2 - routes/_components/AccountsListPage.html | 7 +- routes/blocked.html | 28 +++++++ .../community/_components/PageListItem.html | 13 ++-- routes/community/index.html | 55 ++++++++++++-- routes/muted.html | 28 +++++++ routes/pinned.html | 75 +++++++++++++++++++ routes/statuses/[statusId]/favorites.html | 15 ++-- routes/statuses/[statusId]/reblogs.html | 15 ++-- templates/2xx.html | 4 +- 13 files changed, 242 insertions(+), 35 deletions(-) create mode 100644 routes/_api/blockedAndMuted.js create mode 100644 routes/_api/pinnedStatuses.js create mode 100644 routes/blocked.html create mode 100644 routes/muted.html create mode 100644 routes/pinned.html diff --git a/bin/svgs.js b/bin/svgs.js index 223888e7..8ca2e06e 100644 --- a/bin/svgs.js +++ b/bin/svgs.js @@ -21,6 +21,8 @@ module.exports = [ {id: 'fa-search', src: 'node_modules/font-awesome-svg-png/white/svg/search.svg', title: 'Search'}, {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'} + {id: 'fa-thumb-tack', 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'}, + {id: 'fa-volume-off', src: 'node_modules/font-awesome-svg-png/white/svg/volume-off.svg', title: 'Volume off'}, + {id: 'fa-ban', src: 'node_modules/font-awesome-svg-png/white/svg/ban.svg', title: 'Ban'}, ] diff --git a/routes/_api/blockedAndMuted.js b/routes/_api/blockedAndMuted.js new file mode 100644 index 00000000..da0b270d --- /dev/null +++ b/routes/_api/blockedAndMuted.js @@ -0,0 +1,17 @@ +import { get, paramsString } from '../_utils/ajax' + +export async function getBlockedAccounts(instanceName, accessToken, limit = 80) { + let url = `https://${instanceName}/api/v1/blocks` + url += '?' + paramsString({ limit }) + return get(url, { + 'Authorization': `Bearer ${accessToken}` + }) +} + +export async function getMutedAccounts(instanceName, accessToken, limit = 80) { + let url = `https://${instanceName}/api/v1/mutes` + url += '?' + paramsString({ limit }) + return get(url, { + 'Authorization': `Bearer ${accessToken}` + }) +} \ No newline at end of file diff --git a/routes/_api/pinnedStatuses.js b/routes/_api/pinnedStatuses.js new file mode 100644 index 00000000..e8c68549 --- /dev/null +++ b/routes/_api/pinnedStatuses.js @@ -0,0 +1,12 @@ +import { get, paramsString } from '../_utils/ajax' + +export async function getPinnedStatuses(instanceName, accessToken, accountId) { + let url = `https://${instanceName}/api/v1/accounts/${accountId}/statuses` + url += '?' + paramsString({ + limit: 40, + pinned: true + }) + return get(url, { + 'Authorization': `Bearer ${accessToken}` + }) +} \ No newline at end of file diff --git a/routes/_api/reblogsAndFavs.js b/routes/_api/reblogsAndFavs.js index f59b8005..a6d1a533 100644 --- a/routes/_api/reblogsAndFavs.js +++ b/routes/_api/reblogsAndFavs.js @@ -1,7 +1,5 @@ import { get, paramsString } from '../_utils/ajax' -// TODO: paginate - export async function getReblogs(instanceName, accessToken, statusId, limit = 80) { let url = `https://${instanceName}/api/v1/statuses/${statusId}/reblogged_by` url += '?' + paramsString({ limit }) diff --git a/routes/_components/AccountsListPage.html b/routes/_components/AccountsListPage.html index 286fa87a..575c6410 100644 --- a/routes/_components/AccountsListPage.html +++ b/routes/_components/AccountsListPage.html @@ -13,6 +13,7 @@ .accounts-page { min-height: 60vh; padding: 20px 20px; + position: relative; } .accounts-results { list-style: none; @@ -36,11 +37,9 @@ export default { async oncreate() { let accountsFetcher = this.get('accountsFetcher') - let statusId = this.get('statusId') - let instanceName = this.store.get('currentInstance') - let accessToken = this.store.get('accessToken') try { - let accounts = await accountsFetcher(instanceName, accessToken, statusId) + // TODO: paginate + let accounts = await accountsFetcher() this.set({ accounts: accounts }) } catch (e) { toast.say('Error: ' + (e.name || '') + ' ' + (e.message || '')) diff --git a/routes/blocked.html b/routes/blocked.html new file mode 100644 index 00000000..c324799c --- /dev/null +++ b/routes/blocked.html @@ -0,0 +1,28 @@ +<:Head> + Pinafore – Blocked users + + + + + + + \ No newline at end of file diff --git a/routes/community/_components/PageListItem.html b/routes/community/_components/PageListItem.html index d1a49161..d5663676 100644 --- a/routes/community/_components/PageListItem.html +++ b/routes/community/_components/PageListItem.html @@ -6,12 +6,13 @@ {{label}} - + {{#if pinnable}} + + {{/if}} + \ No newline at end of file diff --git a/routes/statuses/[statusId]/favorites.html b/routes/statuses/[statusId]/favorites.html index 751fbd48..8bf0df8c 100644 --- a/routes/statuses/[statusId]/favorites.html +++ b/routes/statuses/[statusId]/favorites.html @@ -3,23 +3,26 @@ - + + \ No newline at end of file diff --git a/routes/statuses/[statusId]/reblogs.html b/routes/statuses/[statusId]/reblogs.html index ffd9f719..4a8b5890 100644 --- a/routes/statuses/[statusId]/reblogs.html +++ b/routes/statuses/[statusId]/reblogs.html @@ -3,23 +3,26 @@ - + + \ No newline at end of file diff --git a/templates/2xx.html b/templates/2xx.html index e77acab7..3a3c7155 100644 --- a/templates/2xx.html +++ b/templates/2xx.html @@ -86,8 +86,10 @@ body.offline,body.theme-hotpants.offline,body.theme-majesty.offline,body.theme-o Search Conversations Paperclip -Thumbtack +Thumbtack List +Volume off +Ban