mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +03:00
graph-store: restore @ud encoding
This commit is contained in:
parent
627937f5a0
commit
fdbf225c66
@ -513,7 +513,7 @@
|
||||
=/ =ship (slav %p i.t.t.path)
|
||||
=/ =term i.t.t.t.path
|
||||
=/ =index:store
|
||||
(turn t.t.t.t.path |=(=cord (rash cord dem:ag)))
|
||||
(turn t.t.t.t.path (cury slav %ud))
|
||||
=/ node=(unit node:store) (get-node ship term index)
|
||||
?~ node [~ ~]
|
||||
:- ~ :- ~ :- %graph-update
|
||||
|
@ -4,6 +4,7 @@ import { Patp, Path, PatpNoSig } from '~/types/noun';
|
||||
import _ from 'lodash';
|
||||
import {makeResource, resourceFromPath} from '../lib/group';
|
||||
import {GroupPolicy, Enc, Post, NodeMap} from '~/types';
|
||||
import { numToUd } from '~/logic/lib/util';
|
||||
|
||||
export const createPost = (contents: Object[], parentIndex: string = '') => {
|
||||
return {
|
||||
@ -203,9 +204,10 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
}
|
||||
|
||||
getNode(ship: string, resource: string, index: string) {
|
||||
const idx = index.split('/').map(numToUd).join('/');
|
||||
return this.scry<any>(
|
||||
'graph-store',
|
||||
`/node/${ship}/${resource}${index}`
|
||||
`/node/${ship}/${resource}${idx}`
|
||||
).then((node) => {
|
||||
this.store.handleEvent({
|
||||
data: node
|
||||
|
@ -323,3 +323,15 @@ export function scrollIsAtBottom(container) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a numbers as a `@ud` inserting dot where needed
|
||||
*/
|
||||
export function numToUd(num) {
|
||||
return _.chain(num.toString())
|
||||
.split('')
|
||||
.reverse()
|
||||
.chunk(3)
|
||||
.reverse()
|
||||
.map(s => s.join('')).join('.')
|
||||
.value();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user