aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--views.js72
1 files changed, 35 insertions, 37 deletions
diff --git a/views.js b/views.js
index 1758e63..de61501 100644
--- a/views.js
+++ b/views.js
@@ -33,54 +33,52 @@ function profilePage (src, keys) {
profile.appendChild(h('br'))
- var mentionsButton = h('button', {
- onclick: function () {
- location.href = '#?' + src
- }
- }, ['Mentions'])
-
quickName(src).then(name => {
- console.log(name)
+ var mentionsButton = h('button', {
+ onclick: function () {
+ location.href = '#?' + src
+ }
+ }, [name + '\'s Mentions'])
+ profile.appendChild(mentionsButton)
var respond = h('button', {
onclick: function () {
scroller.insertBefore(composer(keys, msg, name), scroller.childNodes[1])
}
}, ['Reply to ' + name])
profile.appendChild(respond)
- })
- profile.appendChild(identify(src, profile, keys))
- profile.appendChild(mentionsButton)
+ if (src != keys.publicKey) {
+ localforage.getItem('subscriptions').then(function (subs) {
+ if (subs.includes(src)) {
+ profile.appendChild(h('button', {
+ onclick: function () {
+ subs = subs.filter(a => a !== src)
+ localforage.setItem('subscriptions', subs).then(function () { location.reload() })
+ }
+ }, ['Unsubscribe from ' + name]))
+ } else {
+ profile.appendChild(h('button', {
+ onclick: function () {
+ subs.push(src)
+ localforage.setItem('subscriptions', subs).then(function () { location.reload() })
+ }
+ }, ['Subscribe to ' + name]))
+ }
+ })
+ }
- if (src != keys.publicKey) {
- localforage.getItem('subscriptions').then(function (subs) {
- if (subs.includes(src)) {
- profile.appendChild(h('button', {
- onclick: function () {
- subs = subs.filter(a => a !== src)
- localforage.setItem('subscriptions', subs).then(function () { location.reload() })
- }
- }, ['Unsubscribe']))
- } else {
- profile.appendChild(h('button', {
- onclick: function () {
- subs.push(src)
- localforage.setItem('subscriptions', subs).then(function () { location.reload() })
- }
- }, ['Subscribe']))
+ profile.appendChild(h('button', {
+ onclick: function () {
+ localforage.removeItem(src).then(function () {
+ var home = true
+ regenerate(home)
+ })
}
- })
- }
+ }, ['Delete ' + name + '\'s feed']))
+ })
+
+ profile.appendChild(identify(src, profile, keys))
- profile.appendChild(h('button', {
- onclick: function () {
- localforage.removeItem(src).then(function () {
- var home = true
- regenerate(home)
- })
- }
- }, ['Delete feed']))
-
async function addPosts (posts, keys) {
posts.forEach(function (msg) {
if (msg.author === src) {