Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/interface/src/logic/api/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class ChatApi extends BaseApi<StoreState> {
* If we don't host the chat, then it just leaves
*/
delete(path: Path) {
this.viewAction({ delete: { 'app-path': path } });
return this.viewAction({ delete: { 'app-path': path } });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering why leaves never processed...

}

/**
Expand Down
15 changes: 12 additions & 3 deletions pkg/interface/src/views/apps/chat/components/join.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,22 @@ export class JoinScreen extends Component {
this.setState({ awaiting: true }, () => {
const station = values.station.trim();
if (`/${station}` in props.chatSynced) {
props.history.push(`/~chat/room${station}`);
if (props.station) {
props.history.replace(`/~chat/room${station}`);
} else {
props.history.push(`/~chat/room${station}`);
}
return;
}
const ship = station.substr(1).slice(0,station.substr(1).indexOf('/'));

props.api.chat.join(ship, station, true);
props.history.push(`/~chat/room${station}`);
props.api.chat.join(ship, station, true).then(() => {
if (props.station) {
props.history.replace(`/~chat/room${station}`);
} else {
props.history.push(`/~chat/room${station}`);
}
});
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { memo } from 'react';

export const DeleteButton = memo(({ isOwner, station, changeLoading, association, contacts, api }) => {
export const DeleteButton = memo(({ isOwner, station, changeLoading, association, contacts, api, history }) => {
const leaveButtonClasses = (!isOwner) ? 'pointer' : 'c-default';
const deleteButtonClasses = (isOwner) ?
'b--red2 red2 pointer bg-gray0-d' :
Expand All @@ -12,7 +12,9 @@ export const DeleteButton = memo(({ isOwner, station, changeLoading, association
true,
isOwner ? 'Deleting chat...' : 'Leaving chat...',
() => {
api.chat.delete(station);
api.chat.delete(station).then(() => {
history.push("/~chat");
});
}
);
};
Expand Down
4 changes: 3 additions & 1 deletion pkg/interface/src/views/apps/chat/components/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export class SettingsScreen extends Component {
groups,
api,
station,
match
match,
history
} = this.props;
const isOwner = deSig(match.params.ship) === window.ship;

Expand All @@ -88,6 +89,7 @@ export class SettingsScreen extends Component {
station={station}
association={association}
contacts={contacts}
history={history}
api={api} />
<MetadataSettings
isOwner={isOwner}
Expand Down
10 changes: 7 additions & 3 deletions pkg/interface/src/views/apps/groups/components/join.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,23 @@ export class JoinScreen extends Component {
const incomingGroup = `${props.ship}/${props.name}`;
// push to group if already exists
if (`/ship/${incomingGroup}` in props.groups) {
this.props.history.push(`/~groups/ship/${incomingGroup}`);
this.props.history.replace(`/~groups/ship/${incomingGroup}`);
return;
}
this.setState({ group: incomingGroup }, () => {
this.onClickJoin();
});
}
// once we've joined, push to group page
// once we've joined, replace to group page
if (props.groups) {
if (state.awaiting) {
const group = `/ship/${state.group}`;
if (group in props.groups) {
props.history.push(`/~groups${group}`);
if (props.ship && props.name) {
props.history.replace(`/~groups${group}`);
} else {
props.history.push(`/~groups${group}`);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function JoinScreen(props: JoinScreenProps & RouteComponentProps) {
try {
await api.publish.publishAction(action);
await waiter((p) => !!p.notebooks?.[ship]?.[book]);
props.history.push(`/~publish/notebook/${ship}/${book}`);
props.history.replace(`/~publish/notebook/${ship}/${book}`);
} catch (e) {
console.error(e);
setError(true);
Expand Down