Skip to content

Commit

Permalink
dropdown menu items hide all of item when loading, can subscribe to o…
Browse files Browse the repository at this point in the history
…wn feed
  • Loading branch information
darkruby501 committed May 15, 2024
1 parent dc49213 commit b70207a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
28 changes: 14 additions & 14 deletions packages/lesswrong/components/dropdowns/DropdownItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,24 +119,24 @@ const DropdownItem = ({
<Loading />
</ListItemIcon>
}
{icon && !loading &&
<ListItemIcon>
{!loading && <>
{icon && <ListItemIcon>
{typeof icon === "string"
? <ForumIcon icon={icon} className={iconClassName} />
: icon()
}
</ListItemIcon>
}
<span className={classes.title}>{title}</span>
{typeof afterIcon === "string"
? <ForumIcon icon={afterIcon} className={classes.afterIcon} />
: afterIcon?.()
}
{sideMessage &&
<div className={classes.sideMessage}>
{sideMessage}
</div>
}
</ListItemIcon>}
<span className={classes.title}>{title}</span>
{typeof afterIcon === "string"
? <ForumIcon icon={afterIcon} className={classes.afterIcon} />
: afterIcon?.()
}
{sideMessage &&
<div className={classes.sideMessage}>
{sideMessage}
</div>
}
</>}
</MenuItem>
</TooltipWrapper>
</LinkWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const NotifyMeToggleDropdownItemInternal = ({
subscriptionType,
classes,
}: NotifyMeToggleDropdownItemInternalProps) => {
const {isSubscribed, onSubscribe} = useNotifyMe({
const {isSubscribed, onSubscribe, loading, disabled } = useNotifyMe({
document,
overrideSubscriptionType: subscriptionType,
hideFlashes: true,
Expand All @@ -53,6 +53,8 @@ export const NotifyMeToggleDropdownItemInternal = ({
title={title}
onClick={toggleSubscribed}
afterIcon={afterIcon}
loading={loading}
disabled={disabled}
/>
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/lesswrong/components/hooks/useNotifyMe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ export const useNotifyMe = ({
};
};

// Can't subscribe to yourself
if (collectionName === 'Users' && document._id === currentUser?._id) {
// Can't subscribe to yourself, unless it's for your feed
if (collectionName === 'Users' && document._id === currentUser?._id && subscriptionType !== 'newActivityForFeed') {
return {
disabled: true,
loading: false,
Expand Down
2 changes: 2 additions & 0 deletions packages/lesswrong/lib/subscriptionUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export function userIsDefaultSubscribed({user, subscriptionType, collectionName,
case subscriptionTypes.newDialogueMessages:
const authorIds = [document.userId, ...getConfirmedCoauthorIds(document)];
return authorIds.includes(user._id);
case subscriptionTypes.newActivityForFeed:
return false;
default:
//eslint-disable-next-line no-console
console.error("Unrecognized subscription type: "+subscriptionType);
Expand Down

0 comments on commit b70207a

Please sign in to comment.