Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"jotai": "^2.12.4",
"localforage": "^1.10.0",
"mediainfo.js": "^0.3.6",
"qapp-core": "^1.0.76",
"qapp-core": "^1.0.79",
"quill-image-resize-module-react": "^3.0.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
Expand Down
33 changes: 23 additions & 10 deletions src/components/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
ENTITY_REPLY,
ENTITY_REPOST,
ENTITY_ROOT,
DISABLE_SUBSCRIPTIONS,
GROUP_PRIVATE,
LIST_POSTS_FEED,
LIST_POSTS_FEED_FOLLOWING_SUB,
Expand Down Expand Up @@ -317,7 +318,6 @@ export function Feed({
null
);
const [followingNames, setFollowingNames] = useState<string[] | null>(null);

// Access group owner primary names on the fly without dependency
const groupOwnerNames = useAtomValue(groupOwnerPrimaryNamesAtom);
const [primaryNamesGroup, setPrimaryNamesGroup] = useState<string[] | null>(
Expand All @@ -340,11 +340,10 @@ export function Feed({
if (isLoadingGroupOwnerNames) return;
const buildPrefix = async () => {
if (!identifierOperations) return;
if (memberGroups === null) return;
if (!DISABLE_SUBSCRIPTIONS && memberGroups === null) return;

try {
const followedNames = await fetchFollowedNames();

setFollowingNames(followedNames);
const prefix = await identifierOperations.buildSearchPrefix(
ENTITY_POST,
Expand All @@ -362,17 +361,24 @@ export function Feed({
ENTITY_REPOST,
''
);
setRepostSearchPrefix(repostPrefix);
if (DISABLE_SUBSCRIPTIONS) {
setGroupSearchPrefix(null);
setPrimaryNamesGroup([]);
setGroupSearchPrefixes([]);
return;
}

const groupPrefix = await identifierOperations.buildSearchPrefix(
null,
'',
GROUP_PRIVATE
);

setRepostSearchPrefix(repostPrefix);
setGroupSearchPrefix(groupPrefix);
setPrimaryNamesGroup(groupOwnerNames);

const groupIds = Array.from(memberGroups.keys());
const groupIds = Array.from(memberGroups?.keys() || []);
if (groupIds.length > 0) {
const groupSearchPrefixesResponses = await Promise.all(
groupIds.map(async (groupId) => {
Expand All @@ -391,7 +397,13 @@ export function Feed({
};

buildPrefix();
}, [identifierOperations, isLoadingGroupOwnerNames, memberGroups]);
}, [
fetchFollowedNames,
groupOwnerNames,
identifierOperations,
isLoadingGroupOwnerNames,
memberGroups,
]);

const loaderItem = useCallback(() => {
return <LoaderItem />;
Expand Down Expand Up @@ -474,8 +486,7 @@ export function Feed({
!followingNames ||
!replySearchPrefix ||
!repostSearchPrefix ||
!primaryNamesGroup ||
!groupSearchPrefix
(!DISABLE_SUBSCRIPTIONS && (!primaryNamesGroup || !groupSearchPrefix))
)
return undefined;

Expand Down Expand Up @@ -571,7 +582,7 @@ export function Feed({
!intervalSearch ||
!searchPrefix ||
!replySearchPrefix ||
!groupSearchPrefix ||
(!DISABLE_SUBSCRIPTIONS && !groupSearchPrefix) ||
!repostSearchPrefix
) {
return (
Expand Down Expand Up @@ -698,7 +709,7 @@ export function Feed({
disabled={!isAuthenticated}
>
<PeopleIcon />
Following & Subs
{DISABLE_SUBSCRIPTIONS ? 'Following' : 'Following & Subs'}
</StyledToggleButton>
</StyledToggleButtonGroup>
</FilterContainer>
Expand Down Expand Up @@ -743,6 +754,7 @@ export function Feed({
searchNewData={undefined}
onNewData={onNewData}
ref={helperListMethodsRef}
isLoading={isLoadingChangeFeedType}
/>
</>
) : (
Expand Down Expand Up @@ -778,6 +790,7 @@ export function Feed({
}
onNewData={onNewData}
ref={helperListMethodsRef}
isLoading={isLoadingChangeFeedType}
/>
)}
</PostsContainer>
Expand Down
24 changes: 13 additions & 11 deletions src/components/MobileNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useState } from 'react';
import { useAtomValue } from 'jotai';
import { hasUnreadNotificationsAtom } from '../state/global/notifications';
import { isPublicNodeAtom } from '../state/global/system';
import { DISABLE_SUBSCRIPTIONS } from '../constants/qdn';
import { useGlobal } from 'qapp-core';
import { NameSwitcher } from './NameSwitcher';

Expand Down Expand Up @@ -174,7 +175,7 @@ export function MobileNavigation({
page === 'profile' ||
page === 'notifications' ||
page === 'blocked' ||
page === 'groups'
(!DISABLE_SUBSCRIPTIONS && page === 'groups')
) {
if (!auth?.name) return;
}
Expand All @@ -195,7 +196,7 @@ export function MobileNavigation({
page === 'profile' ||
page === 'notifications' ||
page === 'blocked' ||
page === 'groups'
(!DISABLE_SUBSCRIPTIONS && page === 'groups')
) {
if (!auth?.name) return;
}
Expand Down Expand Up @@ -312,17 +313,18 @@ export function MobileNavigation({
</MenuButton>
)}

<MenuButton
active={activePage === 'groups'}
onClick={() => handleMenuItemClick('groups')}
disabled={!auth?.name}
>
<GroupsIcon />
Subscriptions
</MenuButton>
{!DISABLE_SUBSCRIPTIONS && (
<MenuButton
active={activePage === 'groups'}
onClick={() => handleMenuItemClick('groups')}
disabled={!auth?.name}
>
<GroupsIcon />
Subscriptions
</MenuButton>
)}
</DrawerContent>
</Drawer>
</>
);
}

19 changes: 15 additions & 4 deletions src/components/NewPostInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { showError } from 'qapp-core';
import { useAtomValue } from 'jotai';
import { attachedGroupsAtom, ownedGroupsAtom } from '../state/global/profile';
import { AttachedGroup } from '../utils/profileQdn';
import { DISABLE_SUBSCRIPTIONS } from '../constants/qdn';

// Declare qortalRequest as a global function (provided by Qortal runtime)

Expand Down Expand Up @@ -444,11 +445,17 @@ export function NewPostInput({
const [showEmojiPicker, setShowEmojiPicker] = useState(false);
// Set initial visibility based on replyingToGroupId (for encrypted replies) or editingPostGroupId (for editing)
const [visibility, setVisibility] = useState<string>(
replyingToGroupId?.toString() || editingPostGroupId?.toString() || 'public'
DISABLE_SUBSCRIPTIONS
? 'public'
: replyingToGroupId?.toString() ||
editingPostGroupId?.toString() ||
'public'
);

// Enrich attached groups with groupName from ownedGroups if missing
const enrichedAttachedGroups = useMemo(() => {
if (DISABLE_SUBSCRIPTIONS) return [];

const groups = attachedGroups
.filter((item) => !!ownedGroups.find((g) => g.groupId === item))
.map((attachedGroup) => {
Expand Down Expand Up @@ -526,7 +533,9 @@ export function NewPostInput({
setText(initialText);
setMedia(initialMedia);
// Set visibility based on editingPostGroupId
if (editingPostGroupId) {
if (DISABLE_SUBSCRIPTIONS) {
setVisibility('public');
} else if (editingPostGroupId) {
setVisibility(editingPostGroupId.toString());
} else {
setVisibility('public');
Expand Down Expand Up @@ -668,7 +677,9 @@ export function NewPostInput({
try {
// Get groupId from visibility if it's not 'public'
const selectedGroupId =
visibility !== 'public' ? parseInt(visibility) : undefined;
!DISABLE_SUBSCRIPTIONS && visibility !== 'public'
? parseInt(visibility)
: undefined;

await onPost({
text,
Expand Down Expand Up @@ -1444,7 +1455,7 @@ export function NewPostInput({
</MediaActions>
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
{/* Only show visibility selector when creating a new post (not editing or replying) */}
{!isEditing && !isReplying && (
{!DISABLE_SUBSCRIPTIONS && !isEditing && !isReplying && (
<VisibilitySelector size="small">
<Select
value={visibility}
Expand Down
9 changes: 6 additions & 3 deletions src/components/PostPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
usePublish,
} from 'qapp-core';
import {
DISABLE_SUBSCRIPTIONS,
ENTITY_POST,
ENTITY_REPLY,
ENTITY_REPLY_PRIVATE,
Expand Down Expand Up @@ -288,7 +289,7 @@ export function PostPage({
resource.qortalMetadata.identifier,
resource.qortalMetadata.name,
content,
resource.data?.groupId // Pass groupId for encrypted replies
DISABLE_SUBSCRIPTIONS ? undefined : resource.data?.groupId
);
},
[resource, onNewReply]
Expand Down Expand Up @@ -401,7 +402,9 @@ export function PostPage({
userName={userName}
isPublishing={isPublishing}
placeholder="Post your reply..."
replyingToGroupId={currentPost?.groupId}
replyingToGroupId={
DISABLE_SUBSCRIPTIONS ? undefined : currentPost?.groupId
}
isReplying={true}
/>
</ReplyInputContainer>
Expand All @@ -425,7 +428,7 @@ export function PostPage({
returnType="JSON"
loaderList={loaderList}
entityParams={{
entityType: currentPost?.groupId
entityType: !DISABLE_SUBSCRIPTIONS && currentPost?.groupId
? ENTITY_REPLY_PRIVATE
: ENTITY_REPLY,
parentId: postId,
Expand Down
Loading
Loading