diff --git a/src/detail-status.tsx b/src/detail-status.tsx
index c72cae0..26af281 100644
--- a/src/detail-status.tsx
+++ b/src/detail-status.tsx
@@ -11,7 +11,7 @@ export default function DetailCommand(props: LaunchProps<{ draftValues: Partial<
{files.length !== 0 && }
-
+
);
diff --git a/src/simple-status.tsx b/src/simple-status.tsx
index f9d835b..e8bc767 100644
--- a/src/simple-status.tsx
+++ b/src/simple-status.tsx
@@ -12,11 +12,8 @@ import {
getPreferenceValues,
LaunchProps,
} from "@raycast/api";
-
import apiServer from "./api";
-
import { AkkomaError, StatusResponse, Preference, Status } from "./types";
-
import { authorize } from "./oauth";
import VisibilityDropdown from "./components/VisibilityDropdown";
@@ -38,7 +35,7 @@ export default function SimpleCommand(props: CommandProps) {
const { draftValues } = props;
const [cw, setCw] = useState(draftValues?.spoiler_text || "");
const [isMarkdown, setIsMarkdown] = useState(true);
- const [showCw, setShowCw] = useState(false);
+ const [sensitive, setSensitive] = useState(false);
const [openActionText, setOpenActionText] = useState("Open the last published status");
const [fqn, setFqn] = useState("");
@@ -59,7 +56,7 @@ export default function SimpleCommand(props: CommandProps) {
const handleSubmit = async ({ spoiler_text, status, scheduled_at, visibility, files, description }: StatusForm) => {
try {
- if (!status) throw new Error("You might forget the content, right ? |・ω・)");
+ if (!status && !files) throw new Error("You might forget the content, right ? |・ω・)");
showToast(Toast.Style.Animated, "Publishing to the Fediverse ... ᕕ( ᐛ )ᕗ");
@@ -70,6 +67,7 @@ export default function SimpleCommand(props: CommandProps) {
})
);
+ console.log(scheduled_at);
const newStatus: Partial = {
spoiler_text,
status,
@@ -77,12 +75,17 @@ export default function SimpleCommand(props: CommandProps) {
visibility,
content_type: isMarkdown ? "text/markdown" : "text/plain",
media_ids: mediaIds,
+ sensitive,
};
const response = await apiServer.postNewStatus(newStatus);
setStatusInfo(response);
- cache.set("latest_published_status", JSON.stringify(response));
+
+ if (!scheduled_at) {
+ cache.set("latest_published_status", JSON.stringify(response));
+ }
+
showToast(Toast.Style.Success, "Status has been published (≧∇≦)/ ! ");
setOpenActionText("Open the status in Browser");
setTimeout(() => {
@@ -95,7 +98,7 @@ export default function SimpleCommand(props: CommandProps) {
};
const handleCw = (value: boolean) => {
- setShowCw(value);
+ setSensitive(value);
if (cwRef.current) {
cwRef.current.focus();
}
@@ -113,7 +116,7 @@ export default function SimpleCommand(props: CommandProps) {
}
>
- {showCw && (
+ {sensitive && (
}
{props.children}
-
+
);
}