]>
cat aescling's git repositories - mastodon.git/blob - app/javascript/mastodon/actions/reports.js
1 import api
from '../api';
3 export const REPORT_INIT
= 'REPORT_INIT';
4 export const REPORT_CANCEL
= 'REPORT_CANCEL';
6 export const REPORT_SUBMIT_REQUEST
= 'REPORT_SUBMIT_REQUEST';
7 export const REPORT_SUBMIT_SUCCESS
= 'REPORT_SUBMIT_SUCCESS';
8 export const REPORT_SUBMIT_FAIL
= 'REPORT_SUBMIT_FAIL';
10 export const REPORT_STATUS_TOGGLE
= 'REPORT_STATUS_TOGGLE';
11 export const REPORT_COMMENT_CHANGE
= 'REPORT_COMMENT_CHANGE';
13 export function initReport(account
, status
) {
21 export function cancelReport() {
27 export function toggleStatusReport(statusId
, checked
) {
29 type: REPORT_STATUS_TOGGLE
,
35 export function submitReport() {
36 return (dispatch
, getState
) => {
37 dispatch(submitReportRequest());
39 api(getState
).post('/api/v1/reports', {
40 account_id: getState().getIn(['reports', 'new', 'account_id']),
41 status_ids: getState().getIn(['reports', 'new', 'status_ids']),
42 comment: getState().getIn(['reports', 'new', 'comment']),
43 }).then(response
=> dispatch(submitReportSuccess(response
.data
))).catch(error
=> dispatch(submitReportFail(error
)));
47 export function submitReportRequest() {
49 type: REPORT_SUBMIT_REQUEST
,
53 export function submitReportSuccess(report
) {
55 type: REPORT_SUBMIT_SUCCESS
,
60 export function submitReportFail(error
) {
62 type: REPORT_SUBMIT_FAIL
,
67 export function changeReportComment(comment
) {
69 type: REPORT_COMMENT_CHANGE
,
This page took 0.098128 seconds and 5 git commands to generate.