add report button

This commit is contained in:
feruz 2020-08-19 22:42:44 +03:00
parent 213b8e440d
commit 7cba799e8b
4 changed files with 42 additions and 3 deletions

View File

@ -8,7 +8,7 @@ import get from 'lodash/get';
// Services and Actions
import { reblog } from '../../../providers/steem/dsteem';
import { addBookmark } from '../../../providers/esteem/esteem';
import { addBookmark, addReport } from '../../../providers/esteem/esteem';
import { toastNotification, setRcOffer } from '../../../redux/actions/uiAction';
import { openPinCodeModal } from '../../../redux/actions/applicationActions';
@ -102,6 +102,10 @@ class PostDropdownContainer extends PureComponent {
this._redirectToPromote(ROUTES.SCREENS.REDEEM, 2, 'boost');
break;
case 'report':
this._report(get(content, 'url'));
break;
default:
break;
}
@ -116,6 +120,30 @@ class PostDropdownContainer extends PureComponent {
});
};
_report = (url) => {
const { dispatch, intl } = this.props;
addReport(url)
.then(() => {
dispatch(
toastNotification(
intl.formatMessage({
id: 'report.added',
}),
),
);
})
.catch(() => {
dispatch(
toastNotification(
intl.formatMessage({
id: 'report.added',
}),
),
);
});
};
_addToBookmarks = () => {
const { content, currentAccount, dispatch, intl } = this.props;

View File

@ -373,6 +373,9 @@
"added": "Added to bookmarks",
"add": "Add to bookmarks"
},
"report": {
"added": "Reported objectionable content"
},
"favorites": {
"title": "Favorites",
"load_error": "Could not load favorites",
@ -403,7 +406,8 @@
"share": "share",
"bookmarks": "add to bookmarks",
"promote": "promote",
"boost": "boost"
"boost": "boost",
"report": "report"
},
"deep_link": {
"no_existing_user": "No existing user",

View File

@ -1 +1 @@
export default ['copy', 'reblog', 'reply', 'share', 'bookmarks', 'promote', 'boost'];
export default ['copy', 'reply', 'reblog', 'share', 'bookmarks', 'promote', 'boost', 'report'];

View File

@ -115,6 +115,13 @@ export const addBookmark = (username, author, permlink) =>
})
.then((resp) => resp.data);
export const addReport = (url) =>
api
.post('/report', {
url,
})
.then((resp) => resp.data);
/**
* @params current username
*/