Skip to content

Commit

Permalink
Merge branch 'develop' into alec/land-1215-welcome-card
Browse files Browse the repository at this point in the history
  • Loading branch information
alecananian committed Nov 21, 2023
2 parents 86c5a1a + 6665c0e commit e9abbd0
Show file tree
Hide file tree
Showing 25 changed files with 345 additions and 150 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ Gallery is a versatile repository for collective knowledge and references you
want to share or remember. Within Groups, you can use Gallery to collect links,
images, media, and even random musings.

## Learn more about Landscape, Tlon, and Urbit

- [Learn more about Tlon →](https://tlon.io)
- [Learn more about Urbit →](https://urbit.org)

---

## Developer documentation
Expand Down
29 changes: 21 additions & 8 deletions desk/app/chat.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@
=. cor restore-missing-subs
=. cor (emit %pass ca-area:ca-core:cor %agent [our.bowl dap.bowl] %poke %recheck-all-perms !>(0))
=. cor (emit %pass ca-area:ca-core:cor %agent [our.bowl dap.bowl] %poke %leave-old-channels !>(0))
=. cor
%+ roll ~(tap in `(set @p)`(~(run in ~(key by chats)) head))
|= [=ship cr=_cor]
?: =(ship our.bowl) cr
(watch-epic:cr ship &)
?: =(okay:c cool) cor
:: =? cor bad (emit (keep !>(old)))
%- (note:wood %ver leaf/"New Epic" ~)
Expand Down Expand Up @@ -303,10 +308,15 @@
(emit %pass /groups %agent [our.bowl %groups] %watch /groups)
::
++ watch-epic
|= her=ship
|= [her=ship leave=?]
^+ cor
=/ =wire /epic
=/ =dock [her dap.bowl]
?: leave
%- emil
:~ [%pass wire %agent [her dap.bowl] %leave ~]
[%pass wire %agent [her dap.bowl] %watch /epic]
==
?: (~(has by wex.bowl) [wire dock])
cor
(emit %pass wire %agent [her dap.bowl] %watch /epic)
Expand Down Expand Up @@ -837,15 +847,13 @@
^+ cor
?+ -.sign cor
%kick
(watch-epic src.bowl)
(watch-epic src.bowl |)
::
%fact
?. =(%epic p.cage.sign)
%- (note:wood %odd leaf/"!!! weird fact on /epic" ~)
cor
=+ !<(=epic:e q.cage.sign)
?. =(epic okay:c) :: is now our guy
cor
%+ roll ~(tap by chats)
|= [[=flag:g =chat:c] out=_cor]
?. =(src.bowl p.flag)
Expand Down Expand Up @@ -1628,7 +1636,7 @@
ca-core
::
%watch-ack
=. net.chat [%sub src.bowl & %chi ~]
=? net.chat ?=(%sub -.net.chat) net.chat(load ?=(~ p.sign))
?~ p.sign ca-core
%- (slog leaf/"Failed subscription" u.p.sign)
:: =. gone &
Expand Down Expand Up @@ -1656,7 +1664,7 @@
ca-core
%- (note:wood %ver leaf/"took lev epic: {<flag>}" ~)
=. saga.net.chat lev/~
=. cor (watch-epic p.flag)
=. cor (watch-epic p.flag |)
ca-core
::
++ ca-make-chi
Expand Down Expand Up @@ -1754,12 +1762,17 @@
|= j=join:c
^+ ca-core
?> |(=(p.group.j src.bowl) =(src.bowl our.bowl))
=. chats (~(put by chats) chan.j *chat:c)
=| =chat:c
=. net.chat
?: =(our.bowl p.chan.j) [%pub ~]
[%sub p.chan.j | %chi ~]
=. chats (~(put by chats) chan.j chat)
=. ca-core (ca-abed chan.j)
=. last-read.remark.chat now.bowl
=. group.perm.chat group.j
=. cor (give-brief flag/flag ca-brief)
ca-sub
=. cor (watch-epic p.flag &)
ca-core
::
++ ca-leave
=/ =dock [p.flag dap.bowl]
Expand Down
10 changes: 7 additions & 3 deletions desk/app/diary.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@
di-core
::
%watch-ack
=. net.diary [%sub src.bowl & [%chi ~]]
=? net.diary ?=(%sub -.net.diary) net.diary(load ?=(~ p.sign))
?~ p.sign di-core
%- (slog leaf/"Failed subscription" u.p.sign)
:: =. gone &
Expand Down Expand Up @@ -971,13 +971,17 @@
|= j=join:d
^+ di-core
?> |(=(p.group.j src.bowl) =(src.bowl our.bowl))
=. shelf (~(put by shelf) chan.j *diary:d)
=| diary:d
=. net.diary
?: =(our.bowl p.chan.j) [%pub ~]
[%sub p.chan.j | %chi ~]
=. shelf (~(put by shelf) chan.j diary)
=. di-core (di-abed chan.j)
=. group.perm.diary group.j
=. last-read.remark.diary now.bowl
=. cor (give-brief flag di-brief)
=. cor (watch-epic p.flag &)
di-sub
di-core
::
++ di-leave
=/ =dock [p.flag dap.bowl]
Expand Down
33 changes: 23 additions & 10 deletions desk/app/heap.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@
=. cor restore-missing-subs
=. cor (emit %pass he-area:he-core:cor %agent [our.bowl dap.bowl] %poke %recheck-all-perms !>(0))
=. cor (emit %pass he-area:he-core:cor %agent [our.bowl dap.bowl] %poke %leave-old-channels !>(0))
=. cor
%+ roll ~(tap in `(set @p)`(~(run in ~(key by stash)) head))
|= [=ship cr=_cor]
?: =(ship our.bowl) cr
(watch-epic:cr ship &)
?: =(okay:h cool) cor
:: speak the good news
=. cor (emil (drop load:epos))
Expand Down Expand Up @@ -374,10 +379,15 @@
==
==
++ watch-epic
|= her=ship
|= [her=ship leave=?]
^+ cor
=/ =wire /epic
=/ =dock [her dap.bowl]
?: leave
%- emil
:~ [%pass wire %agent [her dap.bowl] %leave ~]
[%pass wire %agent [her dap.bowl] %watch /epic]
==
?: (~(has by wex.bowl) [wire dock])
cor
(emit %pass wire %agent [her dap.bowl] %watch /epic)
Expand All @@ -387,20 +397,18 @@
^+ cor
?+ -.sign cor
%kick
(watch-epic src.bowl)
(watch-epic src.bowl |)
::
%fact
?. =(%epic p.cage.sign)
~& '!!! weird fact on /epic'
cor
=+ !<(=epic:e q.cage.sign)
?. =(epic okay:h)
cor
~& >> "good news everyone!"
%+ roll ~(tap by stash)
|= [[=flag:g =heap:h] out=_cor]
?> =(src.bowl p.flag)
?. =(src.bowl p.flag) out
he-abet:(he-take-epic:(he-abed:he-core:out flag) epic)
::
%watch-ack
%. cor
?~ p.sign same
Expand Down Expand Up @@ -821,7 +829,7 @@
he-core
~& make-lev/flag
=. saga.net.heap lev+~
=. cor (watch-epic p.flag)
=. cor (watch-epic p.flag |)
he-core
::
++ he-make-chi
Expand All @@ -841,7 +849,7 @@
he-core
::
%watch-ack
=. net.heap [%sub src.bowl & [%chi ~]]
=? net.heap ?=(%sub -.net.heap) net.heap(load ?=(~ p.sign))
?~ p.sign he-core
%- (slog leaf/"Failed subscription" u.p.sign)
:: =. gone &
Expand Down Expand Up @@ -943,12 +951,17 @@
|= j=join:h
^+ he-core
?> |(=(p.group.j src.bowl) =(src.bowl our.bowl))
=. stash (~(put by stash) chan.j *heap:h)
=| =heap:h
=. net.heap
?: =(our.bowl p.chan.j) [%pub ~]
[%sub p.chan.j | %chi ~]
=. stash (~(put by stash) chan.j heap)
=. he-core (he-abed chan.j)
=. group.perm.heap group.j
=. last-read.remark.heap now.bowl
=. cor (give-brief flag he-brief)
he-sub
=. cor (watch-epic p.flag &)
he-core
::
++ he-leave
=/ =dock [p.flag dap.bowl]
Expand Down
4 changes: 2 additions & 2 deletions desk/desk.docket-0
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
info+'Start, host, and cultivate communities. Own your communications, organize your resources, and share documents. Groups is a decentralized platform that integrates with Talk, Notebook, and Gallery for a full, communal suite of tools.'
color+0xef.f0f4
image+'https://bootstrap.urbit.org/icon-groups.svg?v=1'
glob-http+['https://bootstrap.urbit.org/glob-0vpkb66.7906k.fhl40.sfbag.3h35r.glob' 0vpkb66.7906k.fhl40.sfbag.3h35r]
glob-http+['https://bootstrap.urbit.org/glob-0v3.nm7sd.0feba.nn9oj.4osu9.cebao.glob' 0v3.nm7sd.0feba.nn9oj.4osu9.cebao]
base+'groups'
version+[4 8 1]
version+[4 9 0]
website+'https://tlon.io'
license+'MIT'
==
4 changes: 2 additions & 2 deletions talk/desk.docket-0
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
info+'Send encrypted direct messages to one or many friends. Talk is a simple chat tool for catching up, getting work done, and everything in between.'
color+0x10.5ec7
image+'https://bootstrap.urbit.org/icon-talk.svg?v=1'
glob-http+['https://bootstrap.urbit.org/glob-0v7.lnq57.22fup.bdspn.9v0b5.gotem.glob' 0v7.lnq57.22fup.bdspn.9v0b5.gotem]
glob-http+['https://bootstrap.urbit.org/glob-0v2.1rv9j.2hplp.ef5ff.ndd4n.4b36s.glob' 0v2.1rv9j.2hplp.ef5ff.ndd4n.4b36s]
base+'talk'
version+[4 8 1]
version+[4 9 0]
website+'https://tlon.io'
license+'MIT'
==
41 changes: 41 additions & 0 deletions ui/E2E.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# UI Tests

The ui app contains a suite of automated e2e tests that run in CI and can be run locally.

The main test script is located in `rube/index.ts` and uses [Playwright](https://playwright.dev) to run.

The script:

1. fetches fake ships piers from GCS
2. downloads the urbit binaries for the local architecture
3. boots the ships
4. executes the tests against the current ui code version
5. kills spawned processes

Test specs are in the `e2e/` directory.

## Running locally

After installing this project's dependencies with `npm install`,

```
npm run e2e
```

### Debugging tests

```
npm run e2e:debug
```

Currently, tests utilize two fake ships, `~zod` and `~bus`.


To debug only tests from one of the ships, use for example


```
npm run e2e:debug:bus
```

The script will kill all processes on exit, but in some cases a localhost may be left running and generate an error when trying to run again. If this happens, find it with `ps aux | grep localhost` and kill from cmd line.
2 changes: 1 addition & 1 deletion ui/e2e/001-create-group.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test('Create a group', async ({ page }) => {
test.skip(process.env.SHIP === '~zod', 'skip on ~zod');
test.skip(process.env.APP === 'chat', 'skip on talk');
await page.goto('');
await page.getByText('Some Good Groups').waitFor();
await page.getByRole('link', { name: 'Create Group' }).waitFor();
await page.getByRole('link', { name: 'Create Group' }).click();
await page.getByPlaceholder('e.g. Urbit Fan Club').click();
await page.getByPlaceholder('e.g. Urbit Fan Club').fill('Bus Club');
Expand Down
10 changes: 8 additions & 2 deletions ui/e2e/005-accept-group-invite.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ test('accept group invite', async ({ page }) => {
test.skip(process.env.SHIP === '~bus', 'skip on ~bus');
test.skip(process.env.APP === 'chat', 'skip on talk');
await page.goto('');
await page.getByText('Pending Invites').waitFor();
await page.getByRole('button', { name: 'Join Group' }).first().click();
await page
.getByTestId('group-invite')
.filter({ hasText: 'Bus Club' })
.waitFor();
const groupInvite = page
.getByTestId('group-invite')
.filter({ hasText: 'Bus Club' });
await groupInvite.getByRole('button', { name: 'Accept' }).first().click();
await page.getByText('Join This Group').waitFor();
await page.getByRole('button', { name: 'Join Group' }).first().click();
await page.getByText('bus chat').first().waitFor();
Expand Down
13 changes: 8 additions & 5 deletions ui/rube/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ const ships: Record<
}
> = {
zod: {
url: 'https://bootstrap.urbit.org/rube-zod4.tgz',
savePath: path.join(__dirname, 'rube-zod4.tgz'),
url: 'https://bootstrap.urbit.org/rube-zod5.tgz',
savePath: path.join(__dirname, 'rube-zod5.tgz'),
extractPath: path.join(__dirname, 'zod'),
ship: 'zod',
code: 'lidlut-tabwed-pillex-ridrup',
httpPort: '35453',
loopbackPort: '',
},
bus: {
url: 'https://bootstrap.urbit.org/rube-bus4.tgz',
savePath: path.join(__dirname, 'rube-bus4.tgz'),
url: 'https://bootstrap.urbit.org/rube-bus5.tgz',
savePath: path.join(__dirname, 'rube-bus5.tgz'),
extractPath: path.join(__dirname, 'bus'),
ship: 'bus',
code: 'riddec-bicrym-ridlev-pocsef',
Expand Down Expand Up @@ -502,7 +502,10 @@ const shipsAreReadyForTests = async () => {
return true;
}

console.log(`~${ship.ship} is not ready`);
console.log(`~${ship.ship} is not ready`, {
groups: json.groups.hash,
talk: json.talk.hash,
});

return false;
})
Expand Down
8 changes: 6 additions & 2 deletions ui/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ import Dialog from '@/components/Dialog';
import useIsStandaloneMode from '@/logic/useIsStandaloneMode';
import EmojiPicker from '@/components/EmojiPicker';
import SettingsDialog from '@/components/Settings/SettingsDialog';
import { captureAnalyticsEvent, captureError } from '@/logic/analytics';
import {
ANALYTICS_DEFAULT_PROPERTIES,
captureAnalyticsEvent,
captureError,
} from '@/logic/analytics';
import GroupChannel from '@/groups/GroupChannel';
import PrivacyNotice from '@/groups/PrivacyNotice';
import ActivityModal, { ActivityChecker } from '@/components/ActivityModal';
Expand Down Expand Up @@ -804,7 +808,7 @@ function RoutedApp() {

useEffect(() => {
if (posthog && analyticsId !== '' && logActivity) {
posthog.identify(analyticsId);
posthog.identify(analyticsId, ANALYTICS_DEFAULT_PROPERTIES);
}
}, [posthog, analyticsId, logActivity]);

Expand Down
9 changes: 7 additions & 2 deletions ui/src/components/ActivityModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import {
import { useGroups } from '@/state/groups';
import React, { useEffect } from 'react';
import { isHosted } from '@/logic/utils';
import { analyticsClient } from '@/logic/analytics';
import {
ANALYTICS_DEFAULT_PROPERTIES,
analyticsClient,
} from '@/logic/analytics';
import { PrivacyContents } from '@/groups/PrivacyNotice';
import Dialog from './Dialog';

Expand All @@ -24,7 +27,9 @@ export function ActivityChecker() {
useEffect(() => {
// manage analytics opt-in/out based on settings
if (analyticsClient.has_opted_out_capturing() && logActivity) {
analyticsClient.opt_in_capturing();
analyticsClient.opt_in_capturing({
capture_properties: ANALYTICS_DEFAULT_PROPERTIES,
});
} else if (analyticsClient.has_opted_in_capturing() && !logActivity) {
analyticsClient.opt_out_capturing();
}
Expand Down
4 changes: 4 additions & 0 deletions ui/src/components/References/WritBaseReference.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ function WritBaseReference({
}

const handleOpenReferenceClick = () => {
// We have nowhere to navigate to if we haven't yet loaded group information
if (!preview?.group?.flag) {
return;
}
if (!group) {
navigate(`/gangs/${groupFlag}?type=chat&nest=${nest}&id=${time}`, {
state: { backgroundLocation: location },
Expand Down
Loading

0 comments on commit e9abbd0

Please sign in to comment.