mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2024-11-10 15:04:17 +00:00
[bugfix] use instance configured emoji maxsize on emoji update validation (#3056)
This commit is contained in:
parent
137ef5a9ff
commit
a76670a471
1 changed files with 8 additions and 2 deletions
|
@ -17,7 +17,7 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect, useMemo } from "react";
|
||||||
import { Redirect, useParams } from "wouter";
|
import { Redirect, useParams } from "wouter";
|
||||||
import { useComboBoxInput, useFileInput, useValue } from "../../../../lib/form";
|
import { useComboBoxInput, useFileInput, useValue } from "../../../../lib/form";
|
||||||
import useFormSubmit from "../../../../lib/form/submit";
|
import useFormSubmit from "../../../../lib/form/submit";
|
||||||
|
@ -29,6 +29,7 @@ import { FileInput } from "../../../../components/form/inputs";
|
||||||
import MutationButton from "../../../../components/form/mutation-button";
|
import MutationButton from "../../../../components/form/mutation-button";
|
||||||
import { Error } from "../../../../components/error";
|
import { Error } from "../../../../components/error";
|
||||||
import { useGetEmojiQuery, useEditEmojiMutation, useDeleteEmojiMutation } from "../../../../lib/query/admin/custom-emoji";
|
import { useGetEmojiQuery, useEditEmojiMutation, useDeleteEmojiMutation } from "../../../../lib/query/admin/custom-emoji";
|
||||||
|
import { useInstanceV1Query } from "../../../../lib/query/gts-api";
|
||||||
import { CategorySelect } from "../category-select";
|
import { CategorySelect } from "../category-select";
|
||||||
import BackButton from "../../../../components/back-button";
|
import BackButton from "../../../../components/back-button";
|
||||||
|
|
||||||
|
@ -44,13 +45,18 @@ export default function EmojiDetail() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function EmojiDetailForm({ data: emoji }) {
|
function EmojiDetailForm({ data: emoji }) {
|
||||||
|
const { data: instance } = useInstanceV1Query();
|
||||||
|
const emojiMaxSize = useMemo(() => {
|
||||||
|
return instance?.configuration?.emojis?.emoji_size_limit ?? 50 * 1024;
|
||||||
|
}, [instance]);
|
||||||
|
|
||||||
const baseUrl = useBaseUrl();
|
const baseUrl = useBaseUrl();
|
||||||
const form = {
|
const form = {
|
||||||
id: useValue("id", emoji.id),
|
id: useValue("id", emoji.id),
|
||||||
category: useComboBoxInput("category", { source: emoji }),
|
category: useComboBoxInput("category", { source: emoji }),
|
||||||
image: useFileInput("image", {
|
image: useFileInput("image", {
|
||||||
withPreview: true,
|
withPreview: true,
|
||||||
maxSize: 50 * 1024 // TODO: get from instance api
|
maxSize: emojiMaxSize
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue