diff --git a/README.md b/README.md index 1f48187fbe..cbd2c296ea 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ - added bite notification support - add bite user and bite status buttons on status and status detailed components - don't alert for 501 api errors +- show alerts after biting a user or a note # Chuckya (standalone frontend) diff --git a/app/javascript/flavours/glitch/actions/interactions.js b/app/javascript/flavours/glitch/actions/interactions.js index f0a9add638..512cb1e3fb 100644 --- a/app/javascript/flavours/glitch/actions/interactions.js +++ b/app/javascript/flavours/glitch/actions/interactions.js @@ -6,6 +6,7 @@ import { fetchRelationships } from './accounts'; import { importFetchedAccounts, importFetchedStatus } from './importer'; import { unreblog, reblog } from './interactions_typed'; import { openModal } from './modal'; +import {showAlert} from "flavours/glitch/actions/alerts"; export const REBLOGS_EXPAND_REQUEST = 'REBLOGS_EXPAND_REQUEST'; export const REBLOGS_EXPAND_SUCCESS = 'REBLOGS_EXPAND_SUCCESS'; @@ -519,6 +520,9 @@ export function bite(statusId) { api().post(`/api/v1/statuses/${statusId}/bite`).then(function () { dispatch(biteRequestSuccess(statusId)); + dispatch(showAlert({ + message: 'Bit status' + })); }).catch(function (error) { dispatch(biteRequestFail(statusId, error)); }); @@ -551,11 +555,20 @@ export function biteRequestFail(statusId, error) { } export function biteUser(accountId) { - return (dispatch) => { + return (dispatch, getState) => { + const state = getState(); + let account = state.accounts.get(accountId); + + if (!account) + return; + dispatch(biteUserRequest(accountId)); api().post(`/api/v1/users/${accountId}/bite`).then(function () { dispatch(biteUserRequestSuccess(accountId)); + dispatch(showAlert({ + message: 'Bit @' + account.get('username') + })); }).catch(function (error) { dispatch(biteUserRequestFail(accountId, error)); });