From 963b2d89ba3d47e64087970c8872159917c76a88 Mon Sep 17 00:00:00 2001 From: InfiniteStash <117855276+InfiniteStash@users.noreply.github.com> Date: Wed, 8 Jan 2025 21:40:09 +0100 Subject: [PATCH] Add note about remaining edit update counts (#895) --- frontend/src/graphql/queries/Config.gql | 1 + frontend/src/graphql/types.ts | 6 ++ frontend/src/pages/edits/Edit.tsx | 5 ++ .../pages/edits/components/UpdateCount.tsx | 22 +++++++ graphql/schema/types/config.graphql | 1 + pkg/api/resolver.go | 1 + pkg/models/generated_exec.go | 60 +++++++++++++++++++ pkg/models/generated_models.go | 1 + 8 files changed, 97 insertions(+) create mode 100644 frontend/src/pages/edits/components/UpdateCount.tsx diff --git a/frontend/src/graphql/queries/Config.gql b/frontend/src/graphql/queries/Config.gql index ee872d826..37451d7ab 100644 --- a/frontend/src/graphql/queries/Config.gql +++ b/frontend/src/graphql/queries/Config.gql @@ -1,5 +1,6 @@ query Config { getConfig { + edit_update_limit host_url require_invite require_activation diff --git a/frontend/src/graphql/types.ts b/frontend/src/graphql/types.ts index d61398bc1..a12ea93bf 100644 --- a/frontend/src/graphql/types.ts +++ b/frontend/src/graphql/types.ts @@ -1728,6 +1728,7 @@ export enum SortDirectionEnum { export type StashBoxConfig = { __typename: "StashBoxConfig"; + edit_update_limit: Scalars["Int"]["output"]; guidelines_url: Scalars["String"]["output"]; host_url: Scalars["String"]["output"]; min_destructive_voting_period: Scalars["Int"]["output"]; @@ -14531,6 +14532,7 @@ export type ConfigQuery = { __typename: "Query"; getConfig: { __typename: "StashBoxConfig"; + edit_update_limit: number; host_url: string; require_invite: boolean; require_activation: boolean; @@ -53360,6 +53362,10 @@ export const ConfigDocument = { selectionSet: { kind: "SelectionSet", selections: [ + { + kind: "Field", + name: { kind: "Name", value: "edit_update_limit" }, + }, { kind: "Field", name: { kind: "Name", value: "host_url" } }, { kind: "Field", diff --git a/frontend/src/pages/edits/Edit.tsx b/frontend/src/pages/edits/Edit.tsx index c37f86c7f..dd376016a 100644 --- a/frontend/src/pages/edits/Edit.tsx +++ b/frontend/src/pages/edits/Edit.tsx @@ -1,6 +1,7 @@ import { FC, useState } from "react"; import { Button } from "react-bootstrap"; import { useParams, Link } from "react-router-dom"; +import { UpdateCount } from "./components/UpdateCount"; import { useEdit, @@ -80,6 +81,10 @@ const EditComponent: FC = () => { const buttons = (isAdmin || isSelf(edit.user?.id)) && edit.status === VoteStatusEnum.PENDING && (
+ {edit.updatable && (