From c13771c3a0e5e7090ed2ecba86b32476432c84b9 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 11 Mar 2018 19:40:32 -0700 Subject: [PATCH] more options button to follow/unfollow --- routes/_actions/follow.js | 5 +- .../_components/dialog/GenericDialogList.html | 57 ++++++++++++++ .../_components/dialog/PostPrivacyDialog.html | 78 ++++--------------- .../dialog/StatusOptionsDialog.html | 52 +++++++++++++ routes/_components/dialog/dialogs.js | 1 + .../dialog/showStatusOptionsDialog.js | 13 ++++ routes/_components/status/StatusToolbar.html | 29 +++++-- tests/spec/014-compose-post-privacy.js | 4 +- 8 files changed, 164 insertions(+), 75 deletions(-) create mode 100644 routes/_components/dialog/GenericDialogList.html create mode 100644 routes/_components/dialog/StatusOptionsDialog.html create mode 100644 routes/_components/dialog/showStatusOptionsDialog.js diff --git a/routes/_actions/follow.js b/routes/_actions/follow.js index 5c6c7e46..cf5ccf57 100644 --- a/routes/_actions/follow.js +++ b/routes/_actions/follow.js @@ -3,7 +3,7 @@ import { followAccount, unfollowAccount } from '../_api/follow' import { database } from '../_database/database' import { toast } from '../_utils/toast' -export async function setAccountFollowed (accountId, follow) { +export async function setAccountFollowed (accountId, follow, toastOnSuccess) { let instanceName = store.get('currentInstance') let accessToken = store.get('accessToken') try { @@ -15,6 +15,9 @@ export async function setAccountFollowed (accountId, follow) { let relationship = await database.getRelationship(instanceName, accountId) relationship.following = follow await database.setRelationship(instanceName, relationship) + if (toastOnSuccess) { + toast.say(`${follow ? 'Followed' : 'Unfollowed'}`) + } } catch (e) { console.error(e) toast.say(`Unable to ${follow ? 'follow' : 'unfollow'} account: ` + (e.message || '')) diff --git a/routes/_components/dialog/GenericDialogList.html b/routes/_components/dialog/GenericDialogList.html new file mode 100644 index 00000000..df1cad9c --- /dev/null +++ b/routes/_components/dialog/GenericDialogList.html @@ -0,0 +1,57 @@ + + \ No newline at end of file diff --git a/routes/_components/dialog/PostPrivacyDialog.html b/routes/_components/dialog/PostPrivacyDialog.html index fd32b9fd..bc433ee7 100644 --- a/routes/_components/dialog/PostPrivacyDialog.html +++ b/routes/_components/dialog/PostPrivacyDialog.html @@ -1,86 +1,28 @@ - + - \ No newline at end of file diff --git a/routes/_components/dialog/dialogs.js b/routes/_components/dialog/dialogs.js index 09d7d93f..f9190409 100644 --- a/routes/_components/dialog/dialogs.js +++ b/routes/_components/dialog/dialogs.js @@ -3,3 +3,4 @@ export * from './showImageDialog' export * from './showVideoDialog' export * from './showEmojiDialog' export * from './showPostPrivacyDialog' +export * from './showStatusOptionsDialog' diff --git a/routes/_components/dialog/showStatusOptionsDialog.js b/routes/_components/dialog/showStatusOptionsDialog.js new file mode 100644 index 00000000..aede6adb --- /dev/null +++ b/routes/_components/dialog/showStatusOptionsDialog.js @@ -0,0 +1,13 @@ +import StatusOptionsDialog from './StatusOptionsDialog.html' + +export function showStatusOptionsDialog (statusId) { + let dialog = new StatusOptionsDialog({ + target: document.getElementById('modal-dialog'), + data: { + label: 'Status options dialog', + title: 'Status options', + statusId: statusId + } + }) + dialog.show() +} diff --git a/routes/_components/status/StatusToolbar.html b/routes/_components/status/StatusToolbar.html index fee691ba..79ea6f01 100644 --- a/routes/_components/status/StatusToolbar.html +++ b/routes/_components/status/StatusToolbar.html @@ -4,7 +4,6 @@ href="#fa-reply" disabled="{{disableReply}}" delegateKey="{{replyKey}}" - ref:replyNode /> + />