channel: name group DMs a comma-separated list of participants
fixes urbit/landscape#623
@@ -53,8 +53,22 @@ export function NewChannel(props: NewChannelProps): ReactElement {
const groups = useGroupState(state => state.groups);
const waiter = useWaitForProps({ groups }, 5000);
+ const channelName = (values) => {
+ if (values.name)
+ return value.name;
+ if (!values.name && workspace?.type === 'messages') {
+ const joinedShips = values.ships
+ .filter(Boolean)
+ .map(ship => `~${deSig(ship)}`)
+ .join(', ')
+ .concat(`, ~${deSig(window.ship)}`);
+ return joinedShips;
+ }
+ return values.moduleType;
+ };
+
const onSubmit = async (values: FormSchema, actions) => {
- const name = values.name ? values.name : values.moduleType;
+ const name = channelName(values);
const resId: string =
stringToSymbol(values.name) +
(workspace?.type !== 'messages'
