Change to remove whoami() calls

This commit is contained in:
Christian Bundy
2019-12-07 17:01:04 -08:00
parent 05a4c76ca4
commit 2ee4ece1c1
5 changed files with 14 additions and 25 deletions

View File

@ -27,7 +27,6 @@
"ssbc", "ssbc",
"summerfruit", "summerfruit",
"unfollow", "unfollow",
"unikitty", "unikitty"
"whoami"
] ]
} }

View File

@ -5,7 +5,7 @@ const cooler = require('./lib/cooler')
module.exports = { module.exports = {
isFollowing: async (feedId) => { isFollowing: async (feedId) => {
const ssb = await cooler.connect() const ssb = await cooler.connect()
const { id } = await cooler.get(ssb.whoami) const { id } = ssb
const isFollowing = await cooler.get( const isFollowing = await cooler.get(
ssb.friends.isFollowing, ssb.friends.isFollowing,
@ -18,7 +18,7 @@ module.exports = {
}, },
getRelationship: async (feedId) => { getRelationship: async (feedId) => {
const ssb = await cooler.connect() const ssb = await cooler.connect()
const { id } = await cooler.get(ssb.whoami) const { id } = ssb
if (feedId === id) { if (feedId === id) {
return 'this is you' return 'this is you'

View File

@ -29,7 +29,6 @@ const rawConnect = () => new Promise((resolve, reject) => {
messagesByType: 'source', messagesByType: 'source',
publish: 'async', publish: 'async',
status: 'async', status: 'async',
whoami: 'sync',
tangle: { branch: 'async' }, tangle: { branch: 'async' },
query: { read: 'source' }, query: { read: 'source' },
friends: { friends: {

View File

@ -6,8 +6,8 @@ const pull = require('pull-stream')
module.exports = { module.exports = {
myFeedId: async () => { myFeedId: async () => {
const ssb = await cooler.connect() const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami) const { id } = ssb
return whoami.id return id
}, },
get: async (msgId) => { get: async (msgId) => {
const ssb = await cooler.connect() const ssb = await cooler.connect()

View File

@ -170,8 +170,7 @@ const post = {
fromFeed: async (feedId, customOptions = {}) => { fromFeed: async (feedId, customOptions = {}) => {
const ssb = await cooler.connect() const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami) const myFeedId = ssb.id
const myFeedId = whoami.id
const options = configure({ id: feedId }, customOptions) const options = configure({ id: feedId }, customOptions)
const source = await cooler.read( const source = await cooler.read(
@ -200,8 +199,7 @@ const post = {
mentionsMe: async (customOptions = {}) => { mentionsMe: async (customOptions = {}) => {
const ssb = await cooler.connect() const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami) const myFeedId = ssb.id
const myFeedId = whoami.id
const query = [{ const query = [{
$filter: { $filter: {
@ -222,8 +220,7 @@ const post = {
fromHashtag: async (hashtag, customOptions = {}) => { fromHashtag: async (hashtag, customOptions = {}) => {
const ssb = await cooler.connect() const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami) const myFeedId = ssb.id
const myFeedId = whoami.id
const query = [{ const query = [{
$filter: { $filter: {
@ -288,8 +285,7 @@ const post = {
search: async ({ query }) => { search: async ({ query }) => {
const ssb = await cooler.connect() const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami) const myFeedId = ssb.id
const myFeedId = whoami.id
const options = configure({ const options = configure({
query query
@ -322,8 +318,7 @@ const post = {
latest: async () => { latest: async () => {
const ssb = await cooler.connect() const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami) const myFeedId = ssb.id
const myFeedId = whoami.id
const options = configure({ const options = configure({
type: 'post', type: 'post',
@ -368,8 +363,7 @@ const post = {
throw new Error('invalid period') throw new Error('invalid period')
} }
const whoami = await cooler.get(ssb.whoami) const myFeedId = ssb.id
const myFeedId = whoami.id
const now = new Date() const now = new Date()
const earliest = Number(now) - (1000 * 60 * 60 * 24 * periodDict[period]) const earliest = Number(now) - (1000 * 60 * 60 * 24 * periodDict[period])
@ -476,8 +470,7 @@ const post = {
debug('thread: %s', msgId) debug('thread: %s', msgId)
const ssb = await cooler.connect() const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami) const myFeedId = ssb.id
const myFeedId = whoami.id
const options = configure({ id: msgId }, customOptions) const options = configure({ id: msgId }, customOptions)
const rawMsg = await cooler.get(ssb.get, options) const rawMsg = await cooler.get(ssb.get, options)
@ -652,8 +645,7 @@ const post = {
debug('get: %s', msgId) debug('get: %s', msgId)
const ssb = await cooler.connect() const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami) const myFeedId = ssb.id
const myFeedId = whoami.id
const options = configure({ id: msgId }, customOptions) const options = configure({ id: msgId }, customOptions)
const rawMsg = await cooler.get(ssb.get, options) const rawMsg = await cooler.get(ssb.get, options)
@ -709,8 +701,7 @@ const post = {
inbox: async (customOptions = {}) => { inbox: async (customOptions = {}) => {
const ssb = await cooler.connect() const ssb = await cooler.connect()
const whoami = await cooler.get(ssb.whoami) const myFeedId = ssb.id
const myFeedId = whoami.id
const options = configure({ const options = configure({
type: 'post' type: 'post'