mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 16:51:42 +03:00
interface: update logic to work with removePosts
This commit is contained in:
parent
f44236b7a2
commit
db6b98d31c
@ -83,7 +83,7 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
joiningGraphs = new Set<string>();
|
||||
|
||||
private storeAction(action: any): Promise<any> {
|
||||
return this.action('graph-store', 'graph-update-1', action);
|
||||
return this.action('graph-store', 'graph-update-2', action);
|
||||
}
|
||||
|
||||
private viewAction(threadName: string, action: any) {
|
||||
@ -91,7 +91,7 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
}
|
||||
|
||||
private hookAction(ship: Patp, action: any): Promise<any> {
|
||||
return this.action('graph-push-hook', 'graph-update-1', action);
|
||||
return this.action('graph-push-hook', 'graph-update-2', action);
|
||||
}
|
||||
|
||||
createManagedGraph(
|
||||
@ -227,7 +227,7 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
};
|
||||
|
||||
const pendingPromise = this.spider(
|
||||
'graph-update-1',
|
||||
'graph-update-2',
|
||||
'graph-view-action',
|
||||
'graph-add-nodes',
|
||||
action
|
||||
@ -283,9 +283,9 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
}
|
||||
|
||||
|
||||
removeNodes(ship: Patp, name: string, indices: string[]) {
|
||||
removePosts(ship: Patp, name: string, indices: string[]) {
|
||||
return this.hookAction(ship, {
|
||||
'remove-nodes': {
|
||||
'remove-posts': {
|
||||
resource: { ship, name },
|
||||
indices
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ export const GraphReducer = (json) => {
|
||||
addGraph,
|
||||
removeGraph,
|
||||
addNodes,
|
||||
removeNodes
|
||||
removePosts
|
||||
]);
|
||||
}
|
||||
const loose = _.get(json, 'graph-update-loose', false);
|
||||
@ -181,7 +181,6 @@ const addNodes = (json, state) => {
|
||||
graph = _killByFuzzyTimestamp(graph, resource, post['time-sent']);
|
||||
graph = _killByFuzzyTimestamp(graph, resource, post['time-sent'] - 1);
|
||||
graph = _killByFuzzyTimestamp(graph, resource, post['time-sent'] + 1);
|
||||
|
||||
return graph;
|
||||
};
|
||||
|
||||
@ -240,10 +239,10 @@ const addNodes = (json, state) => {
|
||||
return state;
|
||||
};
|
||||
|
||||
const removeNodes = (json, state: GraphState): GraphState => {
|
||||
const removePosts = (json, state: GraphState): GraphState => {
|
||||
const _remove = (graph, index) => {
|
||||
if (index.length === 1) {
|
||||
graph.delete(index[0]);
|
||||
graph.set(index[0], child.post.hash);
|
||||
} else {
|
||||
const child = graph.get(index[0]);
|
||||
if (child) {
|
||||
@ -253,7 +252,7 @@ const removeNodes = (json, state: GraphState): GraphState => {
|
||||
}
|
||||
};
|
||||
|
||||
const data = _.get(json, 'remove-nodes', false);
|
||||
const data = _.get(json, 'remove-posts', false);
|
||||
if (data) {
|
||||
const { ship, name } = data.resource;
|
||||
const res = `${ship}/${name}`;
|
||||
|
Loading…
Reference in New Issue
Block a user