aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEv Bogue <ev@evbogue.com>2019-11-22 12:37:02 -0600
committerEv Bogue <ev@evbogue.com>2019-11-22 12:37:02 -0600
commit5b4deca9a50c4bdc880eb8d6649e9ab74d759fd8 (patch)
tree5cd8e503db56748d1a39cdde2c46e46727a74d13
parent2a8e4ab57aa420727b439f983d8a37d729a2c893 (diff)
make it so you sync yourself without having to subscribe to yourself, remove subscribe button from own view
-rw-r--r--views.js69
1 files changed, 32 insertions, 37 deletions
diff --git a/views.js b/views.js
index 5fd4f31..fcab7dc 100644
--- a/views.js
+++ b/views.js
@@ -48,27 +48,28 @@ function profilePage (src, keys) {
profile.appendChild(identify(src, profile, keys))
profile.appendChild(mentionsButton)
-
profile.appendChild(respond)
- 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']))
- }
- })
-
+ 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 () {
@@ -106,29 +107,23 @@ function searchPage (src, keys) {
}
function publicPage (keys) {
-
localforage.getItem('subscriptions').then(function (subs) {
- if (subs) {
- var interval = 1000
- timer = function() {
- if ('' === window.location.hash.substring(1)) {
- if (interval < 10000) { interval = interval + 1000 }
- sync(subs, keys)
- setTimeout(timer, interval)
- }
+ var interval = 1000
+ timer = function() {
+ if ('' === window.location.hash.substring(1)) {
+ if (interval < 10000) { interval = interval + 1000 }
+ sync(subs, keys)
+ setTimeout(timer, interval)
}
+ }
+
+ if (subs) {
+ subs.push(keys.publicKey)
timer()
} else {
- var subs = [keys.publicKey]
+ var subs = []
localforage.setItem('subscriptions', subs)
- var interval = 1000
- timer = function() {
- if ('' === window.location.hash.substring(1)) {
- if (interval < 10000) { interval = interval + 1000 }
- sync(subs, keys)
- setTimeout(timer, interval)
- }
- }
+ subs.push(keys.publicKey)
timer()
}
})