Skip to content

Commit 068520e

Browse files
committed
fixed lint errors
1 parent 8e5e7ac commit 068520e

4 files changed

Lines changed: 52 additions & 54 deletions

File tree

src/chat/chatLogic.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ export async function originalVersion (message) {
143143
const done = {}
144144
// done[message.ur] = true
145145
while (msg) {
146-
if (done[msg.uri]) {
147-
console.error('originalVersion: verion loop' + message)
148-
return message
149-
}
150-
done[msg.uri] = true
146+
if (done[msg.uri]) {
147+
debug.error('originalVersion: verion loop' + message)
148+
return message
149+
}
150+
done[msg.uri] = true
151151
message = msg
152152
await store.fetcher.load(message)
153153
msg = store.any(null, ns.dct('isReplacedBy'), message, message.doc())
@@ -159,10 +159,10 @@ export async function mostRecentVersion (message) {
159159
let msg = message
160160
const done = {}
161161
while (msg) {
162-
if (done[msg.uri]) {
163-
console.error('mostRecentVersion: verion loop' + message)
164-
return message
165-
}
162+
if (done[msg.uri]) {
163+
debug.error('mostRecentVersion: verion loop' + message)
164+
return message
165+
}
166166
done[msg.uri] = true
167167
message = msg
168168
await store.fetcher.load(message)

src/chat/infinite.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export async function infiniteMessageArea (dom, wasStore, chatChannel, options)
147147
return // ignore deleted messaged -- @@ could also leave a placeholder
148148
}
149149
if (isReplaced(message)) { //
150-
return // this is old version
150+
return // this is old version
151151
}
152152
let thread = store.any(null, ns.sioc('has_member'), message, message.doc())
153153
const id = store.any(message, ns.sioc('id'), null, message.doc())
@@ -191,7 +191,7 @@ export async function infiniteMessageArea (dom, wasStore, chatChannel, options)
191191

192192
// Are we at the top of a thread?
193193
if (backwards && earliest.limit && date <= earliest.limit) {
194-
return true // done
194+
return true // done
195195
}
196196
date = await dateFolder.loadPrevious(date, backwards) // backwards
197197

@@ -306,7 +306,6 @@ export async function infiniteMessageArea (dom, wasStore, chatChannel, options)
306306
}
307307
}
308308

309-
310309
/// ////////////// Scroll up adding more below
311310

312311
async function extendForwards () {
@@ -605,9 +604,9 @@ export async function infiniteMessageArea (dom, wasStore, chatChannel, options)
605604

606605
async function loadInitialContent () {
607606
function yank () {
608-
if (selectedMessageTable && selectedMessageTable.selectedElement) {
609-
selectedMessageTable.selectedElement.scrollIntoView({ block: 'center' })
610-
}
607+
if (selectedMessageTable && selectedMessageTable.selectedElement) {
608+
selectedMessageTable.selectedElement.scrollIntoView({ block: 'center' })
609+
}
611610
}
612611

613612
// During initial load ONLY keep scroll to selected thing or bottom
@@ -623,10 +622,10 @@ export async function infiniteMessageArea (dom, wasStore, chatChannel, options)
623622

624623
let live, selectedDocument, threadRootDocument
625624
if (options.selectedMessage) {
626-
selectedDocument = options.selectedMessage.doc()
625+
selectedDocument = options.selectedMessage.doc()
627626
}
628627
if (threadRootMessage) {
629-
threadRootDocument = threadRootMessage.doc()
628+
threadRootDocument = threadRootMessage.doc()
630629
}
631630
const initialDocment = selectedDocument || threadRootDocument
632631

@@ -680,15 +679,15 @@ export async function infiniteMessageArea (dom, wasStore, chatChannel, options)
680679
const latest = { messageTable: null }
681680

682681
if (options.thread) {
683-
const thread = options.thread
684-
threadRootMessage = store.any(null, ns.sioc('has_reply'), thread, thread.doc())
685-
if (threadRootMessage) {
686-
const threadTime = store.any(threadRootMessage, ns.dct('created'), null, threadRootMessage.doc())
687-
if (threadTime) {
688-
earliest.limit = new Date(threadTime.value)
689-
console.log(' inifinite: thread start at ' + earliest.limit)
690-
}
682+
const thread = options.thread
683+
threadRootMessage = store.any(null, ns.sioc('has_reply'), thread, thread.doc())
684+
if (threadRootMessage) {
685+
const threadTime = store.any(threadRootMessage, ns.dct('created'), null, threadRootMessage.doc())
686+
if (threadTime) {
687+
earliest.limit = new Date(threadTime.value)
688+
debug.log(' inifinite: thread start at ' + earliest.limit)
691689
}
690+
}
692691
}
693692

694693
let lock = false

src/chat/messageTools.js

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -45,41 +45,41 @@ emojiMap[ns.schema('EndorseAction')] = '⭐️'
4545
emojiMap[ns.schema('LikeAction')] = '❤️'
4646

4747
export function emojiFromActionClass (action) {
48-
return emojiMap[action] || null
48+
return emojiMap[action] || null
4949
}
5050

5151
export function ActionClassFromEmoji (emoji) {
52-
for (a in emojiMap) {
53-
if (emojiMap[a] === emoji) {
54-
return $rdf.sym(a.slice(1, -1)) // remove < >
55-
}
52+
for (const a in emojiMap) {
53+
if (emojiMap[a] === emoji) {
54+
return rdf.sym(a.slice(1, -1)) // remove < >
5655
}
57-
return null
56+
}
57+
return null
5858
}
5959

6060
// Allow the qction to give its own emoji as content,
6161
// or get the emoji from the class lof action.
6262
export function emojiFromAction (action) {
63-
const content =store.any(action, ns.sioc('content'), null, action.doc())
64-
if (content) return content
65-
const klass =store.any(action, ns.rdf('type'), null, action.doc())
66-
if (klass) {
67-
const em = emojiFromActionClass(klass);
68-
if (em) return em;
69-
}
70-
return '⬜️'
63+
const content = store.any(action, ns.sioc('content'), null, action.doc())
64+
if (content) return content
65+
const klass = store.any(action, ns.rdf('type'), null, action.doc())
66+
if (klass) {
67+
const em = emojiFromActionClass(klass)
68+
if (em) return em
69+
}
70+
return '⬜️'
7171
}
7272

7373
/**
7474
* Create strip of sentiments expressed
7575
*/
7676
export async function sentimentStrip (target, doc) { // alain seems not used
77-
const versions = await allVersions(target)
78-
console.log('sentimentStrip Versions for ' + target, versions)
79-
const actions = versions.map(version => store.each(null, ns.schema('target'), version, doc)).flat()
80-
console.log('sentimentStrip: Actions for ' + target, actions)
81-
const strings = sentiments.map(action => emojiFromAction(action) || '')
82-
return dom.createTextNode(strings.join(' '))
77+
const versions = await allVersions(target)
78+
debug.log('sentimentStrip Versions for ' + target, versions)
79+
const actions = versions.map(version => store.each(null, ns.schema('target'), version, doc)).flat()
80+
debug.log('sentimentStrip: Actions for ' + target, actions)
81+
const strings = actions.map(action => emojiFromAction(action) || '')
82+
return dom.createTextNode(strings.join(' '))
8383
}
8484
/**
8585
* Create strip of sentiments expressed, with hyperlinks
@@ -93,16 +93,16 @@ export async function sentimentStripLinked (target, doc) {
9393
strip.innerHTML = ''
9494
if (isDeleted(target)) return strip
9595
const versions = await allVersions(target)
96-
console.log('sentimentStripLinked: Versions for ' + target, versions)
96+
debug.log('sentimentStripLinked: Versions for ' + target, versions)
9797
const actions = versions.map(version => store.each(null, ns.schema('target'), version, doc)).flat()
98-
console.log('sentimentStripLinked: Actions for ' + target, actions)
99-
if (actions.length == 0) return strip
98+
debug.log('sentimentStripLinked: Actions for ' + target, actions)
99+
if (actions.length === 0) return strip
100100
const sentiments = actions.map(a => [
101101
store.any(a, ns.rdf('type'), null, doc),
102102
store.any(a, ns.sioc('content'), null, doc),
103103
store.any(a, ns.schema('agent'), null, doc)
104104
])
105-
console.log(' Actions sentiments ', sentiments)
105+
debug.log(' Actions sentiments ', sentiments)
106106
sentiments.sort()
107107
sentiments.forEach(ss => {
108108
const [theClass, content, agent] = ss
@@ -116,10 +116,9 @@ export async function sentimentStripLinked (target, doc) {
116116
res.textContent = content || emojiMap[theClass] || '⬜️'
117117
strip.appendChild(res)
118118
})
119-
console.log(' Actions strip ', strip)
120-
119+
debug.log(' Actions strip ', strip)
121120
}
122-
refresh().then(console.log('sentimentStripLinked: sentimentStripLinked async refreshed'))
121+
refresh().then(debug.log('sentimentStripLinked: sentimentStripLinked async refreshed'))
123122
strip.refresh = refresh
124123
return strip
125124
}

src/preferences.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export function recordSharedPreferences (subject, context) {
4242
const sharedPreferences = kb.any(subject, ns.ui('sharedPreferences'))
4343
if (!sharedPreferences) {
4444
if (!kb.updater.editable(subject.doc())) {
45-
console.log(` Cant make shared preferences, may not change ${subject.doc}`)
46-
resolve(context)
45+
debug.log(` Cant make shared preferences, may not change ${subject.doc}`)
46+
resolve(context)
4747
}
4848
const sp = $rdf.sym(subject.doc().uri + '#SharedPreferences')
4949
const ins = [

0 commit comments

Comments
 (0)