Skip to content

Commit

Permalink
πŸ” Rename publication to post for v3 preparation: v13 (#pre-lens-v3)
Browse files Browse the repository at this point in the history
Summary: Renamed "publication" to "post" across various components and tests.

Highlights:

β€’ Updated `getCollectModuleMetadata.spec.ts` to use "Test Post" instead of "Test Publication".
β€’ Changed `mockPublicationData` to `mockPostData` in `getPostOGImages.spec.ts`.
β€’ Renamed `DEFAULT_AUDIO_PUBLICATION` to `DEFAULT_AUDIO_POST` in `usePostAudioStore.ts`.

Read more: https://pierre.co/hey/hey/pre-lens-v3
  • Loading branch information
Yoginth authored and Pierre committed Nov 14, 2024
1 parent 3df6538 commit 1ce33f3
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 45 deletions.
10 changes: 5 additions & 5 deletions apps/og/src/helpers/getCollectModuleMetadata.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("getCollectModuleMetadata", () => {
ownedBy: { address: "0x1234567890abcdef" }
},
metadata: {
title: "Test Publication"
title: "Test Post"
},
openActionModules: [
{
Expand Down Expand Up @@ -65,7 +65,7 @@ describe("getCollectModuleMetadata", () => {
ownedBy: { address: "0x1234567890abcdef" }
},
metadata: {
title: "Test Publication"
title: "Test Post"
},
openActionModules: [],
stats: { countOpenActions: 0 },
Expand All @@ -83,7 +83,7 @@ describe("getCollectModuleMetadata", () => {
ownedBy: { address: "0x1234567890abcdef" }
},
metadata: {
title: "Test Publication"
title: "Test Post"
},
openActionModules: [
{ type: "NonAllowedModuleType", contract: { address: "0xabcdef" } }
Expand All @@ -103,7 +103,7 @@ describe("getCollectModuleMetadata", () => {
ownedBy: { address: "0x1234567890abcdef" }
},
metadata: {
title: "Test Publication"
title: "Test Post"
},
stats: { countOpenActions: 0 },
id: "post-id-123"
Expand All @@ -120,7 +120,7 @@ describe("getCollectModuleMetadata", () => {
ownedBy: { address: "0x1234567890abcdef" }
},
metadata: {
title: "Test Publication"
title: "Test Post"
},
openActionModules: [
{ type: "UnknownModuleType", contract: { address: "0xabcdef" } }
Expand Down
20 changes: 10 additions & 10 deletions apps/og/src/helpers/getPostOGImages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ describe("getPostOGImages", () => {

test("should return image URIs from attachments when asset is an image", () => {
const mockMetadata = { __typename: "ImageMetadata" } as any;
const mockPublicationData = {
const mockPostData = {
attachments: [
{ uri: "https://example.com/image1.jpg" },
{ uri: "https://example.com/image2.jpg" }
],
asset: { type: "Image", uri: "https://example.com/asset-image.jpg" }
};

(getPostData as any).mockReturnValue(mockPublicationData);
(getPostData as any).mockReturnValue(mockPostData);

const result = getPostOGImages(mockMetadata);
expect(result).toEqual([
Expand All @@ -32,54 +32,54 @@ describe("getPostOGImages", () => {

test("should return asset image URI when no attachments are present", () => {
const mockMetadata = { __typename: "ImageMetadata" } as any;
const mockPublicationData = {
const mockPostData = {
attachments: [],
asset: { type: "Image", uri: "https://example.com/asset-image.jpg" }
};

(getPostData as any).mockReturnValue(mockPublicationData);
(getPostData as any).mockReturnValue(mockPostData);

const result = getPostOGImages(mockMetadata);
expect(result).toEqual(["https://example.com/asset-image.jpg"]);
});

test("should return video cover URI when no attachments are present", () => {
const mockMetadata = { __typename: "VideoMetadata" } as any;
const mockPublicationData = {
const mockPostData = {
attachments: [],
asset: { type: "Video", cover: "https://example.com/video-cover.jpg" }
};

(getPostData as any).mockReturnValue(mockPublicationData);
(getPostData as any).mockReturnValue(mockPostData);

const result = getPostOGImages(mockMetadata);
expect(result).toEqual(["https://example.com/video-cover.jpg"]);
});

test("should return audio cover URI when no attachments are present", () => {
const mockMetadata = { __typename: "AudioMetadata" } as any;
const mockPublicationData = {
const mockPostData = {
attachments: [],
asset: { type: "Audio", cover: "https://example.com/audio-cover.jpg" }
};

(getPostData as any).mockReturnValue(mockPublicationData);
(getPostData as any).mockReturnValue(mockPostData);

const result = getPostOGImages(mockMetadata);
expect(result).toEqual(["https://example.com/audio-cover.jpg"]);
});

test("should return attachment URIs for video if present", () => {
const mockMetadata = { __typename: "VideoMetadata" } as any;
const mockPublicationData = {
const mockPostData = {
attachments: [
{ uri: "https://example.com/video1.jpg" },
{ uri: "https://example.com/video2.jpg" }
],
asset: { type: "Video", cover: "https://example.com/video-cover.jpg" }
};

(getPostData as any).mockReturnValue(mockPublicationData);
(getPostData as any).mockReturnValue(mockPostData);

const result = getPostOGImages(mockMetadata);
expect(result).toEqual([
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Composer/NewPublication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { useCollectModuleStore } from "src/store/non-persisted/post/useCollectMo
import { usePostAttachmentStore } from "src/store/non-persisted/post/usePostAttachmentStore";
import { usePostAttributesStore } from "src/store/non-persisted/post/usePostAttributesStore";
import {
DEFAULT_AUDIO_PUBLICATION,
DEFAULT_AUDIO_POST,
usePostAudioStore
} from "src/store/non-persisted/post/usePostAudioStore";
import { usePostLicenseStore } from "src/store/non-persisted/post/usePostLicenseStore";
Expand Down Expand Up @@ -178,7 +178,7 @@ const NewPublication: FC<NewPublicationProps> = ({ className, post }) => {
setAttachments([]);
setQuotedPost(null);
setVideoThumbnail(DEFAULT_VIDEO_THUMBNAIL);
setAudioPost(DEFAULT_AUDIO_PUBLICATION);
setAudioPost(DEFAULT_AUDIO_POST);
setLicense(null);
resetAttributes();
resetCollectSettings();
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Post/Actions/Menu/Report.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface ReportProps {
}

const Report: FC<ReportProps> = ({ post }) => {
const { setShowPublicationReportModal } = useGlobalModalStateStore();
const { setShowPostReportModal } = useGlobalModalStateStore();

return (
<MenuItem
Expand All @@ -24,7 +24,7 @@ const Report: FC<ReportProps> = ({ post }) => {
}
onClick={(event) => {
stopEventPropagation(event);
setShowPublicationReportModal(true, post.id);
setShowPostReportModal(true, post.id);
}}
>
<div className="flex items-center space-x-2">
Expand Down
16 changes: 7 additions & 9 deletions apps/web/src/components/Shared/GlobalModals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ const GlobalModals: FC = () => {
const {
authModalType,
reportingProfile,
reportingPublicationId,
reportingPostId,
setShowAuthModal,
setShowNewPostModal,
setShowOptimisticTransactionsModal,
setShowProfileSwitchModal,
setShowPublicationReportModal,
setShowPostReportModal,
setShowReportProfileModal,
showAuthModal,
showNewPostModal,
showOptimisticTransactionsModal,
showProfileSwitchModal,
showPublicationReportModal,
showPostReportModal,
showReportProfileModal,
showEditStatusModal,
setShowEditStatusModal,
Expand All @@ -50,13 +50,11 @@ const GlobalModals: FC = () => {
<>
<GlobalModalsFromUrl />
<Modal
onClose={() =>
setShowPublicationReportModal(false, reportingPublicationId)
}
show={showPublicationReportModal}
title="Report Publication"
onClose={() => setShowPostReportModal(false, reportingPostId)}
show={showPostReportModal}
title="Report Post"
>
<ReportPost postId={reportingPublicationId} />
<ReportPost postId={reportingPostId} />
</Modal>
<Modal
onClose={() => setShowReportProfileModal(false, reportingProfile)}
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/store/non-persisted/post/usePostAudioStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface AudioPublication {
title: string;
}

export const DEFAULT_AUDIO_PUBLICATION: AudioPublication = {
export const DEFAULT_AUDIO_POST: AudioPublication = {
artist: "",
cover: "",
mimeType: "",
Expand All @@ -21,7 +21,7 @@ interface State {
}

const store = create<State>((set) => ({
audioPost: DEFAULT_AUDIO_PUBLICATION,
audioPost: DEFAULT_AUDIO_POST,
setAudioPost: (audioPost) => set(() => ({ audioPost }))
}));

Expand Down
24 changes: 9 additions & 15 deletions apps/web/src/store/non-persisted/useGlobalModalStateStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type AuthModalType = "login" | "signup";
interface State {
authModalType: AuthModalType;
reportingProfile: null | Profile;
reportingPublicationId: null | string;
reportingPostId: null | string;
setShowAuthModal: (
showAuthModal: boolean,
authModalType?: AuthModalType
Expand All @@ -18,9 +18,9 @@ interface State {
showOptimisticTransactionsModal: boolean
) => void;
setShowProfileSwitchModal: (showProfileSwitchModal: boolean) => void;
setShowPublicationReportModal: (
showPublicationReportModal: boolean,
reportingPublicationId: null | string
setShowPostReportModal: (
showPostReportModal: boolean,
reportingPostId: null | string
) => void;
setShowReportProfileModal: (
reportProfileModal: boolean,
Expand All @@ -31,7 +31,7 @@ interface State {
showNewPostModal: boolean;
showOptimisticTransactionsModal: boolean;
showProfileSwitchModal: boolean;
showPublicationReportModal: boolean;
showPostReportModal: boolean;
showReportProfileModal: boolean;
showEditStatusModal: boolean;
setShowEditStatusModal: (showEditStatusModal: boolean) => void;
Expand All @@ -46,7 +46,7 @@ interface State {
const store = create<State>((set) => ({
authModalType: "login",
reportingProfile: null,
reportingPublicationId: null,
reportingPostId: null,
setShowAuthModal: (showAuthModal, authModalType) => {
set(() => ({ authModalType, showAuthModal }));
},
Expand All @@ -56,22 +56,16 @@ const store = create<State>((set) => ({
set(() => ({ showOptimisticTransactionsModal })),
setShowProfileSwitchModal: (showProfileSwitchModal) =>
set(() => ({ showProfileSwitchModal })),
setShowPublicationReportModal: (
showPublicationReportModal,
reportingPublicationId
) =>
set(() => ({
reportingPublicationId,
showPublicationReportModal
})),
setShowPostReportModal: (showPostReportModal, reportingPostId) =>
set(() => ({ reportingPostId, showPostReportModal })),
setShowReportProfileModal: (showReportProfileModal, reportingProfile) =>
set(() => ({ reportingProfile, showReportProfileModal })),
showAuthModal: false,
showMobileDrawer: false,
showNewPostModal: false,
showOptimisticTransactionsModal: false,
showProfileSwitchModal: false,
showPublicationReportModal: false,
showPostReportModal: false,
showReportProfileModal: false,
showEditStatusModal: false,
setShowEditStatusModal: (showEditStatusModal) =>
Expand Down

1 comment on commit 1ce33f3

@vercel
Copy link

@vercel vercel bot commented on 1ce33f3 Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

web – ./

web-heyxyz.vercel.app
web-git-main-heyxyz.vercel.app
heyxyz.vercel.app
hey.xyz

Please sign in to comment.