Skip to content

Commit

Permalink
Merge pull request #3764 from tloncorp/hm/faster-mark-everything
Browse files Browse the repository at this point in the history
activity: make mark everything faster
  • Loading branch information
arthyn authored Jul 18, 2024
2 parents 1c473ad + f6addd8 commit e201410
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
4 changes: 2 additions & 2 deletions apps/tlon-web/src/components/Sidebar/ActivityIndicator.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cn from 'classnames';

import { useNotifications } from '@/notifications/useNotifications';
import { useSourceActivity } from '@/state/activity';
import { useCalmSetting } from '@/state/settings';

import BellIcon from '../icons/BellIcon';
Expand Down Expand Up @@ -40,7 +40,7 @@ export default function ActivityIndicator({
}

export function ActivitySidebarItem() {
const { activity } = useNotifications();
const { activity } = useSourceActivity('base');
const activeTab = useActiveTab();

return (
Expand Down
4 changes: 2 additions & 2 deletions apps/tlon-web/src/components/Sidebar/AppNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { isNativeApp, useSafeAreaInsets } from '@/logic/native';
import useAppUpdates, { AppUpdateContext } from '@/logic/useAppUpdates';
import { useIsDark, useIsMobile } from '@/logic/useMedia';
import useShowTabBar from '@/logic/useShowTabBar';
import { useNotifications } from '@/notifications/useNotifications';
import {
useCombinedChatUnreads,
useCombinedGroupUnreads,
useMarkAllGroupsRead,
useSourceActivity,
} from '@/state/activity';
import { useCharge } from '@/state/docket';
import { useLocalState } from '@/state/local';
Expand Down Expand Up @@ -220,7 +220,7 @@ function MessagesTab(props: { isInactive: boolean; isDarkMode: boolean }) {

function ActivityTab(props: { isInactive: boolean; isDarkMode: boolean }) {
const navigate = useNavigate();
const { activity } = useNotifications();
const { activity } = useSourceActivity('base');
const isMobile = useIsMobile();

if (isMobile) {
Expand Down
8 changes: 5 additions & 3 deletions desk/app/activity.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
%add (add-event +.action)
%bump (bump +.action)
%del (del-source +.action)
%read (read source.action read-action.action)
%read (read source.action read-action.action |)
%adjust (adjust +.action)
%allow-notifications (allow +.action)
==
Expand Down Expand Up @@ -730,7 +730,7 @@
%- (log |.("sending activity: {<new-activity>}"))
(give-update [%activity new-activity] [%hose ~])
++ read
|= [=source:a action=read-action:a]
|= [=source:a action=read-action:a from-parent=?]
^+ cor
=/ =index:a (get-index source)
?- -.action
Expand All @@ -753,11 +753,13 @@
|-
?~ children cor
=/ =source:a i.children
=. cor (read source action)
=. cor (read source action &)
$(children t.children)
:: we need to refresh our own index to reflect new reads
%- (log |.("refeshing index: {<source>}"))
=. indices (~(put by indices) source new)
?: from-parent
(refresh-summary source)
=. cor (refresh source)
=/ new-activity=activity:a
%+ roll
Expand Down
11 changes: 2 additions & 9 deletions packages/shared/src/urbit/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,20 +692,13 @@ export function getSource(bundle: ActivityBundle): Source {

if ('flag-post' in top) {
return {
channel: {
nest: top['flag-post'].channel,
group: top['flag-post'].group,
},
group: top['flag-post'].group,
};
}

if ('flag-reply' in top) {
return {
thread: {
key: top['flag-reply'].parent,
channel: top['flag-reply'].channel,
group: top['flag-reply'].group,
},
group: top['flag-reply'].group,
};
}

Expand Down

0 comments on commit e201410

Please sign in to comment.