refactor: use post number instead of shortCid in reply modal and quote previews

This commit is contained in:
plebeius
2025-12-28 11:53:02 +01:00
parent 2b8d6f4fce
commit bf2c7ae61b
42 changed files with 61 additions and 52 deletions
+6 -2
View File
@@ -4,16 +4,18 @@ import useSelectedTextStore from './use-selected-text-store';
interface ReplyModalState {
showReplyModal: boolean;
activeCid: string | null;
parentNumber: number | null;
threadCid: string | null;
subplebbitAddress: string | null;
scrollY: number;
closeModal: () => void;
openReplyModal: (parentCid: string, postCid: string, subplebbitAddress: string) => void;
openReplyModal: (parentCid: string, parentNumber: number | undefined, postCid: string, subplebbitAddress: string) => void;
}
const useReplyModalStore = create<ReplyModalState>((set, get) => ({
showReplyModal: false,
activeCid: null,
parentNumber: null,
threadCid: null,
subplebbitAddress: null,
scrollY: 0,
@@ -24,10 +26,11 @@ const useReplyModalStore = create<ReplyModalState>((set, get) => ({
set({
showReplyModal: false,
activeCid: null,
parentNumber: null,
});
},
openReplyModal: (parentCid, postCid, subplebbitAddress) => {
openReplyModal: (parentCid, parentNumber, postCid, subplebbitAddress) => {
// Don't update if already open with different parent
if (get().activeCid && get().activeCid !== parentCid) {
window.alert('Multiple quotes are not possible on 5chan for the time being, because of a protocol limitation. Please reply to one post at a time.');
@@ -46,6 +49,7 @@ const useReplyModalStore = create<ReplyModalState>((set, get) => ({
set({
activeCid: parentCid,
parentNumber: parentNumber ?? null,
threadCid: postCid,
showReplyModal: true,
subplebbitAddress,