Browse Source

fix favorites -> relayt list when favorites are selected before opening editor

hotfix/display-issues
dskvr 2 years ago
parent
commit
526089eaee
  1. 3
      src/components/relays/blocks/RelaysResultTable.vue
  2. 37
      src/components/relays/partials/NostrSync.vue
  3. 5
      src/shared/relays-lib.js

3
src/components/relays/blocks/RelaysResultTable.vue

@ -217,7 +217,8 @@
</div>
</div>
<div class="text-xl block min-w-full align-middle py-8 light:bg-slate-100 rounded-lg" v-if="!store.relays.getFavorites.length && subsection == 'favorite'">
You have not selected any favorites. To select a favorite, click the heart emoji next to any relay in a relays list.
You have not selected any favorites. To select a favorite, click the heart emoji next to any relay in a relays list.
Alternatively, sign-in to sync your relays list. If you do not see a sign-in, download a NIP-04 compatible extension like nos2x or Alby
</div>
</div>
</div>

37
src/components/relays/partials/NostrSync.vue

@ -120,24 +120,25 @@ export default defineComponent({
methods: Object.assign(RelaysLib, {
toggleEditor: async function(){
this.store.layout.toggleEditor()
if(this.store.layout.editorExpanded)
this.queueJob(
'user/relay/list',
async () => {
await this.store.user.setKind3()
.then( () => {
Object.keys(this.store.user.kind3).forEach( key => {
this.store.relays.setFavorite(key)
})
this.store.tasks.completeJob()
})
.catch( err => {
console.error('error!', err)
this.store.tasks.completeJob()
})
},
true
)
this.queueKind3('user/relay/list')
// if(this.store.layout.editorExpanded)
// this.queueJob(
// 'user/relay/list',
// async () => {
// await this.store.user.setKind3()
// .then( () => {
// Object.keys(this.store.user.kind3).forEach( key => {
// this.store.relays.setFavorite(key)
// })
// this.store.tasks.completeJob()
// })
// .catch( err => {
// console.error('error!', err)
// this.store.tasks.completeJob()
// })
// },
// true
// )
},
persistChanges: async function(){
const event = {

5
src/shared/relays-lib.js

@ -8,6 +8,11 @@ export default {
async () => {
await this.store.user.setKind3()
.then( () => {
this.store.relays.getFavorites.forEach( relay => {
if(this.store.user?.kind3?.[relay])
return
this.store.user.kind3[relay] = { read: false, write: false }
})
Object.keys(this.store.user.kind3).forEach( key => {
this.store.relays.setFavorite(key)
})

Loading…
Cancel
Save