Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
Merge pull request #492 from 3box/release/v1.9.0
Browse files Browse the repository at this point in the history
Release/v1.9.0
  • Loading branch information
zachferland authored Jun 11, 2019
2 parents 807be32 + b810483 commit 1e464d2
Show file tree
Hide file tree
Showing 33 changed files with 6,525 additions and 4,021 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
- dependencies-cache-{{ checksum "package.json" }}

- run:
name: install-serverless-and dependencies
name: install dependencies
command: |
sudo npm i -g codecov node-gyp
sudo npm i -g codecov node-gyp
npm i
- run:
Expand Down
243 changes: 214 additions & 29 deletions README.md

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Release Notes

## v1.9.0 - 2019-06-11
* feat: add support for moderated and members threads
* feat: update to latest orbitdb and ipfs
* feat: add 3ID

Along with support for moderated and members threads, this replaces experimental threads seen in prior releases. Look for API changes to use new version of threads.

Also with the upgrade of OrbitDB, an upgrade of this library is required for everything to continue working as expected. More details here - https://medium.com/3box/3box-js-1-9-soft-fork-upgrade-bcd79bb5f29c

## v1.8.5 - 2019-05-30
* Fix: Return promise in public set/remove methods of spaces

Expand Down
29 changes: 27 additions & 2 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,33 @@ <h5 style="padding: 20px 0px 10px 0px" id="spacePriv"> </h5>
</p>

<h3> Threads: </h3>
<input type="text" id="threadName" placeholder="Join thread by name">
<button id="joinThread" type="button" class="btn btn btn-primary" >Join thread</button>
<input type="text" id="threadName" placeholder="Name or Address"></br>
<input type="text" id="threadfirstModerator" placeholder="Thread Root Moderator"></br>
<span > Members Only Thread </span>
<input type="radio" name="members" id='members' value="true"> </br>
<button id="joinThread" type="button" class="btn btn btn-primary" >Join thread</button> </br></br>

<div id="threadModeration" style="display: none;">
<input type="text" id="threadMod" placeholder="Thread Moderator">
<button id="addThreadMod" type="button" class="btn btn btn-primary" >Add Thread Moderator</button></br>
<h5> Moderators: </h5>
<p>
<span id="threadModeratorList"></span>
</p>
</div>
<div id="threadMembers" style="display: none;">
<input type="text" id="threadMember" placeholder="Thread Member">
<button id="addThreadMember" type="button" class="btn btn btn-primary" >Add Thread Member</button></br>
<h5> Members: </h5>
<p>
<span id="threadMemberList"></span>
</p>
</div></br>

<p>
<span id="threadACError"></span>
</p>

<div id="posts" style="display: none;">
<h4> Posts: </h4>
<p>
Expand Down
65 changes: 58 additions & 7 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ bopen.addEventListener('click', event => {

openSpace.addEventListener('click', () => {
const name = spaceName.value
window.currentSpace = name
const opts = {
onSyncDone: () => {
console.log('sync done in space', name)
updateSpaceData()
}
}
box.openSpace(name, opts).then(() => {
window.currentSpace = name
spacePub.innerHTML = `Public data in ${name}:`
spacePriv.innerHTML = `Private data in ${name}:`
spaceCtrl.style.display = 'block'
Expand Down Expand Up @@ -93,27 +93,78 @@ bopen.addEventListener('click', event => {

joinThread.addEventListener('click', () => {
const name = threadName.value
const firstModerator = threadfirstModerator.value
const membersBool = members.checked
posts.style.display = 'block'
box.spaces[window.currentSpace].joinThread(name).then(thread => {
threadModeration.style.display = 'block'
if (members.checked) threadMembers.style.display = 'block'
box.spaces[window.currentSpace].joinThread(name, {firstModerator, members: membersBool}).then(thread => {
window.currentThread = thread
thread.onNewPost(post => {
threadData.innerHTML += post.author + ': <br />' + post.message + '<br /><br />'
thread.onUpdate(() => {
updateThreadData()
})
thread.onNewCapabilities(() => {
updateThreadCapabilities()
})
updateThreadData()
})
updateThreadCapabilities()
}).catch(updateThreadError)
})

addThreadMod.addEventListener('click', () => {
const id = threadMod.value
window.currentThread.addModerator(id).then(res => {
updateThreadCapabilities()
}).catch(updateThreadError)
})

addThreadMember.addEventListener('click', () => {
const id = threadMember.value
window.currentThread.addMember(id).then(res => {
updateThreadCapabilities()
}).catch(updateThreadError)
})

window.deletePost = (el) => {
window.currentThread.deletePost(el.id).then(res => {
updateThreadData()
}).catch(updateThreadError)
}

const updateThreadError = (e = '') => {
threadACError.innerHTML = e
}

const updateThreadData = () => {
threadData.innerHTML = ''
updateThreadError()
window.currentThread.getPosts().then(posts => {
posts.map(post => {
threadData.innerHTML += post.author + ': <br />' + post.message + '<br /><br />'
threadData.innerHTML += post.author + ': <br />' + post.message + '<br /><br />'
threadData.innerHTML += `<button id="` + post.postId + `"onClick="window.deletePost(` + post.postId + `)" type="button" class="btn btn btn-primary" >Delete</button>` + '<br /><br />'
})
})
}

const updateThreadCapabilities = () => {
threadMemberList.innerHTML = ''
if (window.currentThread._members) {
window.currentThread.listMembers().then(members => {
members.map(member => {
threadMemberList.innerHTML += member + '<br />'
})
})
}
threadModeratorList.innerHTML = ''
window.currentThread.listModerators().then(moderators => {
moderators.map(moderator => {
threadModeratorList.innerHTML += moderator + '<br />'
})
})
}

postThread.addEventListener('click', () => {
window.currentThread.post(postMsg.value)
window.currentThread.post(postMsg.value).catch(updateThreadError)
})

bclose.addEventListener('click', () => {
Expand Down
Loading

0 comments on commit 1e464d2

Please sign in to comment.