channel: name group DMs a comma-separated list of participants

fixes urbit/landscape#623
This commit is contained in:
James Acklin 2021-05-24 19:00:02 -04:00
parent ce74572d02
commit 1300c5b923

View File

@ -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'