diff --git a/README.md b/README.md
index a8dfd03..069a702 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,7 @@ TODO
## Production Server Installation
+
### Configuration
This resource is highly configurable through the [config.json](./config.json). This JSON file holds configuration for the phone itself, for the apps running on it and peripheral information.
@@ -25,12 +26,25 @@ Below is the list of configuration options:
| twitter.generateProfileNameFromUsers | true | Whether or not the server should automtically generate a player's profile name from their user in the database |
| twitter.allowEdtiableProfileName | true | Whether or not players can edit their profile name |
| twitter.allowDeleteTweets | true | Whether or not players can delete their own tweets |
+| twitter.allowReportTweets | true | Whether or not players can report tweets. Optional discord integration. |
| twitter.characterLimit | 240 | Limit on how many characters tweets can contain |
| twitter.enableAvatars | true | Whether or not player's can select avatars for their twitter profile |
| twitter.enableEmojis | true | Whether or not player's can use emojis in tweets |
| twitter.enableImages | true | Whether or not player's can add images to tweets (external URLs) |
| twitter.maxImages | 3 | The maximum amount of images allowed in a tweet |
+### Discord
+
+It is possible to perform discord integration with the phone. To configure discord add the following variables to your `server.cfg` file:
+
+```
+set discord_bot_token "YOUR_DISCORD_BOT_TOKEN"
+set discord_channel_id "YOUR_DISCORD_CHANNEL_ID"
+```
+
+Current discord integrations with the phone:
+
+- Twitter: reporting tweets
## Development
diff --git a/config.json b/config.json
index 8160add..6b01a9c 100644
--- a/config.json
+++ b/config.json
@@ -16,6 +16,7 @@
"generateProfileNameFromUsers": true,
"allowEdtiableProfileName": true,
"allowDeleteTweets": true,
+ "allowReportTweets": true,
"characterLimit": 240,
"enableAvatars": true,
"enableEmojis": true,
diff --git a/phone/src/apps/twitter/components/buttons/ReportButton.tsx b/phone/src/apps/twitter/components/buttons/ReportButton.tsx
new file mode 100644
index 0000000..d80ee35
--- /dev/null
+++ b/phone/src/apps/twitter/components/buttons/ReportButton.tsx
@@ -0,0 +1,49 @@
+import React, { useState } from "react";
+import { useTranslation } from "react-i18next";
+import {
+ Button,
+ CircularProgress,
+ MenuItem
+} from "@material-ui/core";
+import DoneIcon from '@material-ui/icons/Done';
+
+import Nui from "../../../../os/nui-events/utils/Nui";
+
+const LOADING_TIME = 1250;
+
+function ReportButton({ handleClose, tweetId, isReported }) {
+ const { t } = useTranslation();
+ const [loading, setLoading] = useState(false);
+
+ const handleClick = () => {
+ Nui.send("phone:reportTweet", tweetId);
+ setLoading(true);
+ window.setTimeout(() => {
+ setLoading(false);
+ handleClose();
+ }, LOADING_TIME);
+ };
+
+ if (isReported) {
+ return (
+
+ );
+ }
+
+ if (loading) {
+ return (
+
+ );
+ }
+
+ return (
+
+ );
+}
+
+export default ReportButton;
diff --git a/phone/src/apps/twitter/components/tweet/ShowMore.tsx b/phone/src/apps/twitter/components/tweet/ShowMore.tsx
index 6533011..ee5924f 100644
--- a/phone/src/apps/twitter/components/tweet/ShowMore.tsx
+++ b/phone/src/apps/twitter/components/tweet/ShowMore.tsx
@@ -8,6 +8,8 @@ import {
import MoreIcon from "@material-ui/icons/MoreVert";
import { usePhone } from "../../../../os/phone/hooks/usePhone";
import Nui from "../../../../os/nui-events/utils/Nui";
+import ReportButton from '../buttons/ReportButton';
+import { Tweet } from "./Tweet";
/**
@@ -31,7 +33,7 @@ function calculateVerticalOffset(top: number): number {
return top * 0.20 - 38;
}
-export const ShowMore = ({ id, isMine }) => {
+export const ShowMore = ({ id, isReported, isMine }) => {
const [anchorEl, setAnchorEl] = useState(null);
const [verticalOffset, setVerticalOffset] = useState(0);
const { t } = useTranslation();
@@ -58,10 +60,15 @@ export const ShowMore = ({ id, isMine }) => {
}
const allowedToDelete = config.twitter.allowDeleteTweets && isMine;
+ const allowedToReport = config.twitter.allowReportTweets && !isMine;
+
+ // if the user cannot perform any actions in show more then don't
+ // allow them to interact with it
+ let _handleClick = allowedToDelete || allowedToReport ? handleClick : () => null;
return (
<>
-