diff --git a/web/source/settings/admin/reports/detail.jsx b/web/source/settings/admin/reports/detail.jsx
new file mode 100644
index 000000000..20548a720
--- /dev/null
+++ b/web/source/settings/admin/reports/detail.jsx
@@ -0,0 +1,234 @@
+/*
+ GoToSocial
+ Copyright (C) 2021-2023 GoToSocial Authors admin@gotosocial.org
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+"use strict";
+
+const React = require("react");
+const { useRoute, Redirect } = require("wouter");
+
+const query = require("../../lib/query");
+
+const FormWithData = require("../../lib/form/form-with-data");
+const BackButton = require("../../components/back-button");
+
+const { useValue, useTextInput } = require("../../lib/form");
+const useFormSubmit = require("../../lib/form/submit");
+
+const { TextArea } = require("../../components/form/inputs");
+
+const MutationButton = require("../../components/form/mutation-button");
+const Username = require("./username");
+
+module.exports = function ReportDetail({ baseUrl }) {
+ let [_match, params] = useRoute(`${baseUrl}/:reportId`);
+ if (params?.reportId == undefined) {
+ return ;
+ } else {
+ return (
+
+
+ Report Details
+
+
+
+ );
+ }
+};
+
+function ReportDetailForm({ data: report }) {
+ const from = report.account;
+ const target = report.target_account;
+
+ return (
+
+
+ reported
+
+
+ {report.action_taken &&
+
+
Resolved by @{report.action_taken_by_account.account.acct}
+ at {new Date(report.action_taken_at).toLocaleString()}
+
+ Comment: {report.action_taken_comment}
+
+ }
+
+
+
Report info:
+
+
Created:
+
{new Date(report.created_at).toLocaleString()}
+
+
Forwarded: {report.forwarded ? "Yes" : "No"}
+
Category: {report.category}
+
+
Reason:
+ {report.comment.length > 0
+ ?
{report.comment}
+ :
none provided
+ }
+
+
+
+
+ {!report.action_taken &&
}
+
+ {
+ report.statuses.length > 0 &&
+
+
Reported toots ({report.statuses.length}):
+
+ {report.statuses.map((status) => (
+
+ ))}
+
+
+ }
+
+ );
+}
+
+function ReportActionForm({ report }) {
+ const form = {
+ id: useValue("id", report.id),
+ comment: useTextInput("action_taken_comment")
+ };
+
+ const [submit, result] = useFormSubmit(form, query.useResolveReportMutation(), { changedOnly: false });
+
+ return (
+
+ );
+}
+
+function ReportedToot({ toot }) {
+ const account = toot.account;
+
+ return (
+
+
+
+
+
+
{account.display_name.trim().length > 0 ? account.display_name : account.username}
+
@{account.username}
+
+
+ {toot.spoiler_text?.length > 0
+ ?
+ : toot.content
+ }
+
+
+ {toot.media_attachments?.length > 0 &&
+
+ }
+
+
+
+ );
+}
+
+function TootCW({ note, content }) {
+ const [visible, setVisible] = React.useState(false);
+
+ function toggleVisible() {
+ setVisible(!visible);
+ }
+
+ return (
+ <>
+
+ {note}
+ Show {visible ? "less" : "more"}
+
+ {visible && content}
+ >
+ );
+}
+
+function TootMedia({ media, sensitive }) {
+ let classes = (media.length % 2 == 0) ? "even" : "odd";
+ if (media.length == 1) {
+ classes += " single";
+ }
+
+ return (
+
+ {media.map((m) => (
+
+ {sensitive && <>
+
+
+
+
+
+
+
+
+
+ Show sensitive media
+
+
+
+ >}
+
+
+
+
+ ))}
+
+ );
+}
\ No newline at end of file
diff --git a/web/source/settings/admin/reports/index.jsx b/web/source/settings/admin/reports/index.jsx
new file mode 100644
index 000000000..61483b0d6
--- /dev/null
+++ b/web/source/settings/admin/reports/index.jsx
@@ -0,0 +1,112 @@
+/*
+ GoToSocial
+ Copyright (C) 2021-2023 GoToSocial Authors admin@gotosocial.org
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+"use strict";
+
+const React = require("react");
+const { Link, Switch, Route } = require("wouter");
+
+const query = require("../../lib/query");
+
+const FormWithData = require("../../lib/form/form-with-data");
+
+const ReportDetail = require("./detail");
+const Username = require("./username");
+
+const baseUrl = "/settings/admin/reports";
+
+module.exports = function Reports() {
+ return (
+
+
+
+
+
+
+
+
+ );
+};
+
+function ReportOverview({ _baseUrl }) {
+ return (
+ <>
+ Reports
+
+
+
+
+ This interface is currently very limited , only providing a basic overview.
+ Work is in progress on a more full-fledged moderation experience.
+
+
+
+ Here you can view and resolve reports made to your instance, originating from local and remote users.
+
+
+
+ >
+ );
+}
+
+function ReportsList({ data: reports }) {
+ return (
+
+ {reports.map((report) => (
+
+ ))}
+
+ );
+}
+
+function ReportEntry({ report }) {
+ const from = report.account;
+ const target = report.target_account;
+
+ let comment = report.comment.length > 200
+ ? report.comment.slice(0, 200) + "..."
+ : report.comment;
+
+ return (
+
+
+
+
+ reported
+
+
+ {report.action_taken ? "Resolved" : "Open"}
+
+
+
+
Created:
+
{new Date(report.created_at).toLocaleString()}
+
+
Reason:
+ {comment.length > 0
+ ?
{comment}
+ :
none provided
+ }
+
+
+
+ );
+}
\ No newline at end of file
diff --git a/web/source/settings/admin/reports/username.jsx b/web/source/settings/admin/reports/username.jsx
new file mode 100644
index 000000000..5eeea4310
--- /dev/null
+++ b/web/source/settings/admin/reports/username.jsx
@@ -0,0 +1,54 @@
+/*
+ GoToSocial
+ Copyright (C) 2021-2023 GoToSocial Authors admin@gotosocial.org
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+"use strict";
+
+const React = require("react");
+
+module.exports = function Username({ user, link = true }) {
+ let className = "user";
+ let isLocal = user.domain == null;
+
+ if (user.suspended) {
+ className += " suspended";
+ }
+
+ if (isLocal) {
+ className += " local";
+ }
+
+ let icon = isLocal
+ ? { fa: "fa-home", info: "Local user" }
+ : { fa: "fa-external-link-square", info: "Remote user" };
+
+ let Element = "span";
+ let href = null;
+
+ if (link) {
+ Element = "a";
+ href = user.account.url;
+ }
+
+ return (
+
+ @{user.account.acct}
+
+ {icon.info}
+
+ );
+};
\ No newline at end of file
diff --git a/web/source/settings/index.js b/web/source/settings/index.js
index 6de72581e..812fff6b4 100644
--- a/web/source/settings/index.js
+++ b/web/source/settings/index.js
@@ -43,6 +43,7 @@ const nav = {
"Instance Settings": require("./admin/settings.js"),
"Actions": require("./admin/actions"),
"Federation": require("./admin/federation"),
+ "Reports": require("./admin/reports")
},
"Custom Emoji": {
adminOnly: true,
diff --git a/web/source/settings/lib/query/admin/index.js b/web/source/settings/lib/query/admin/index.js
index 33e14521e..c348a2701 100644
--- a/web/source/settings/lib/query/admin/index.js
+++ b/web/source/settings/lib/query/admin/index.js
@@ -78,7 +78,8 @@ const endpoints = (build) => ({
})
}),
...require("./import-export")(build),
- ...require("./custom-emoji")(build)
+ ...require("./custom-emoji")(build),
+ ...require("./reports")(build)
});
module.exports = base.injectEndpoints({ endpoints });
\ No newline at end of file
diff --git a/web/source/settings/lib/query/admin/reports.js b/web/source/settings/lib/query/admin/reports.js
new file mode 100644
index 000000000..96fec8ae2
--- /dev/null
+++ b/web/source/settings/lib/query/admin/reports.js
@@ -0,0 +1,52 @@
+/*
+ GoToSocial
+ Copyright (C) 2021-2023 GoToSocial Authors admin@gotosocial.org
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+"use strict";
+
+module.exports = (build) => ({
+ listReports: build.query({
+ query: (params = {}) => ({
+ url: "/api/v1/admin/reports",
+ params: {
+ limit: 100,
+ ...params
+ }
+ }),
+ providesTags: ["Reports"]
+ }),
+
+ getReport: build.query({
+ query: (id) => ({
+ url: `/api/v1/admin/reports/${id}`
+ }),
+ providesTags: (res, error, id) => [{ type: "Reports", id }]
+ }),
+
+ resolveReport: build.mutation({
+ query: (formData) => ({
+ url: `/api/v1/admin/reports/${formData.id}/resolve`,
+ method: "POST",
+ asForm: true,
+ body: formData
+ }),
+ invalidatesTags: (res) =>
+ res
+ ? [{ type: "Reports", id: "LIST" }, { type: "Reports", id: res.id }]
+ : [{ type: "Reports", id: "LIST" }]
+ })
+});
\ No newline at end of file
diff --git a/web/source/settings/lib/query/base.js b/web/source/settings/lib/query/base.js
index d9d62d356..4020616f2 100644
--- a/web/source/settings/lib/query/base.js
+++ b/web/source/settings/lib/query/base.js
@@ -72,7 +72,7 @@ function instanceBasedQuery(args, api, extraOptions) {
module.exports = createApi({
reducerPath: "api",
baseQuery: instanceBasedQuery,
- tagTypes: ["Auth", "Emoji"],
+ tagTypes: ["Auth", "Emoji", "Reports"],
endpoints: (build) => ({
instance: build.query({
query: () => ({
diff --git a/web/source/settings/style.css b/web/source/settings/style.css
index 7affd8269..17ccec6d3 100644
--- a/web/source/settings/style.css
+++ b/web/source/settings/style.css
@@ -663,6 +663,10 @@ span.form-info {
a {
color: $info-link;
}
+
+ p {
+ margin-top: 0;
+ }
}
button.with-icon {
@@ -805,6 +809,121 @@ button.with-padding {
}
}
+.reports {
+ p {
+ margin: 0;
+ }
+
+ .report {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5rem;
+ margin: 0.5rem 0;
+
+ text-decoration: none;
+ color: $fg;
+
+ padding: 1rem;
+
+ border: none;
+ border-left: 0.3rem solid $border-accent;
+
+ .byline {
+ display: grid;
+ grid-template-columns: 1fr auto;
+
+ .status {
+ color: $border-accent;
+ }
+ }
+
+ .details {
+ display: grid;
+ grid-template-columns: auto 1fr;
+ gap: 0.2rem 0.5rem;
+ padding: 0.5rem;
+
+ justify-items: start;
+ }
+
+ h3 {
+ margin: 0;
+ }
+
+ &.resolved {
+ color: $fg-reduced;
+ border-left: 0.4rem solid $bg;
+
+ .byline .status {
+ color: $fg-reduced;
+ }
+
+ .user {
+ opacity: 0.8;
+ }
+ }
+
+ &.detail {
+ border: none;
+ padding: 0;
+ }
+ }
+
+ .report.detail {
+ display: flex;
+ flex-direction: column;
+ margin-top: 1rem;
+ gap: 1rem;
+
+ .info-block {
+ padding: 0.5rem;
+ background: $gray2;
+ }
+
+ .info {
+ display: block;
+ }
+
+ .reported-toots {
+ margin-top: 0.5rem;
+ }
+
+ .toot .toot-info {
+ padding: 0.5rem;
+ background: $toot-info-bg;
+
+ a {
+ color: $fg-reduced;
+ }
+
+ &:last-child {
+ border-bottom-left-radius: $br;
+ border-bottom-right-radius: $br;
+ }
+ }
+ }
+
+ .user {
+ background: $fg-accent;
+ color: $bg;
+ border-radius: $br;
+ padding: 0.1rem 0.2rem;
+ margin: 0 0.1rem;
+ font-weight: bold;
+ text-decoration: none;
+
+ &.suspended {
+ background: $bg-accent;
+ color: $fg;
+ text-decoration: line-through;
+ }
+
+ &.local {
+ background: $green1;
+ }
+ }
+}
+
[role="button"] {
cursor: pointer;
}