Add support for more like emojis

This commit is contained in:
Jonathan Staab 2023-01-03 16:42:10 -08:00
parent dbee0d6f8a
commit e06c4e6c1b
5 changed files with 10 additions and 7 deletions

View File

@ -17,6 +17,7 @@ If you like Coracle and want to support its development, you can donate sats via
- [x] Link previews - [x] Link previews
- [x] Add notes, follows, likes tab to profile - [x] Add notes, follows, likes tab to profile
- [x] Mentions - [x] Mentions
- [ ] Persist and load relay list
- [ ] Add followers/follows lists on profile page - [ ] Add followers/follows lists on profile page
- [ ] Image uploads - [ ] Image uploads
- [ ] Server discovery and relay publishing - https://github.com/nostr-protocol/nips/pull/32/files - [ ] Server discovery and relay publishing - https://github.com/nostr-protocol/nips/pull/32/files
@ -25,12 +26,12 @@ If you like Coracle and want to support its development, you can donate sats via
- [ ] Lightning tips - [ ] Lightning tips
- [ ] Direct messages - [ ] Direct messages
- [ ] Rooms/groups - [ ] Rooms/groups
- [ ] Custom feeds
# Bugs # Bugs
- [ ] Reduce reflow on feeds from new stuff coming in - [ ] Reduce reflow on feeds from new stuff coming in
- [ ] Follow fiatjaf's vision of clients being smart and connecting to recommended relays to fetch content - [ ] Follow fiatjaf's vision of clients being smart and connecting to recommended relays to fetch content
- [ ] Add alerts for replies to posts the user liked
- [ ] Stack views so scroll position isn't lost on navigation - [ ] Stack views so scroll position isn't lost on navigation
- [ ] Add notification for slow relays, suggest relays based on network - [ ] Add notification for slow relays, suggest relays based on network
- [ ] Separating events table into notes/reactions/etc would effectively give us a second index on kind. - [ ] Separating events table into notes/reactions/etc would effectively give us a second index on kind.

View File

@ -10,7 +10,7 @@
import {Router, Route, links, navigate} from "svelte-routing" import {Router, Route, links, navigate} from "svelte-routing"
import {globalHistory} from "svelte-routing/src/history" import {globalHistory} from "svelte-routing/src/history"
import {hasParent} from 'src/util/html' import {hasParent} from 'src/util/html'
import {displayPerson} from 'src/util/nostr' import {displayPerson, isLike} from 'src/util/nostr'
import {timedelta, now} from 'src/util/misc' import {timedelta, now} from 'src/util/misc'
import {store as toast} from "src/state/toast" import {store as toast} from "src/state/toast"
import {modal, settings, alerts} from "src/state/app" import {modal, settings, alerts} from "src/state/app"
@ -70,7 +70,7 @@
} }
// Only notify users about positive reactions // Only notify users about positive reactions
if (e.kind === 7 && !['', '+'].includes(e.content)) { if (e.kind === 7 && !isLike(e.content)) {
return return
} }

View File

@ -6,7 +6,7 @@
import {navigate} from 'svelte-routing' import {navigate} from 'svelte-routing'
import {quantify} from 'hurdak/lib/hurdak' import {quantify} from 'hurdak/lib/hurdak'
import {hasParent} from 'src/util/html' import {hasParent} from 'src/util/html'
import {findReply} from "src/util/nostr" import {findReply, isLike} from "src/util/nostr"
import Preview from 'src/partials/Preview.svelte' import Preview from 'src/partials/Preview.svelte'
import Anchor from 'src/partials/Anchor.svelte' import Anchor from 'src/partials/Anchor.svelte'
import {settings, modal} from "src/state/app" import {settings, modal} from "src/state/app"
@ -31,7 +31,7 @@
let likes, flags, like, flag let likes, flags, like, flag
$: { $: {
likes = note.reactions.filter(n => ['', '+'].includes(n.content)) likes = note.reactions.filter(n => isLike(n.content))
flags = note.reactions.filter(whereEq({content: '-'})) flags = note.reactions.filter(whereEq({content: '-'}))
} }

View File

@ -3,7 +3,7 @@
import {onMount} from 'svelte' import {onMount} from 'svelte'
import {fly} from 'svelte/transition' import {fly} from 'svelte/transition'
import {alerts} from 'src/state/app' import {alerts} from 'src/state/app'
import {findReply} from 'src/util/nostr' import {findReply, isLike} from 'src/util/nostr'
import relay, {people, user} from 'src/relay' import relay, {people, user} from 'src/relay'
import {now, timedelta, createScroller, Cursor} from 'src/util/misc' import {now, timedelta, createScroller, Cursor} from 'src/util/misc'
import Spinner from "src/partials/Spinner.svelte" import Spinner from "src/partials/Spinner.svelte"
@ -46,7 +46,7 @@
} }
// Only notify users about positive reactions // Only notify users about positive reactions
if (e.kind === 7 && !['', '+'].includes(e.content)) { if (e.kind === 7 && !isLike(e.content)) {
return false return false
} }

View File

@ -55,3 +55,5 @@ export const displayPerson = p => {
return hexToBech32('npub', p.pubkey).slice(4, 12) return hexToBech32('npub', p.pubkey).slice(4, 12)
} }
export const isLike = content => ['', '+', '🤙', '👍', '❤️'].includes(content)