3da395a792
* multiple forwards on a post first phase of the multi-forward support * update the graphql mutation for discussion posts to accept and validate multiple forwards * update the discussion form to allow multiple forwards in the UI * start working on db schema changes * uncomment db schema, add migration to create the new model, and update create_item, update_item stored procedures * Propagate updates from discussion to poll, link, and bounty forms Update the create, update poll sql functions for multi forward support * Update gql, typedefs, and resolver to return forwarded users in items responses * UI changes to show multiple forward recipients, and conditional upvote logic changes * Update notification text to reflect multiple forwards upon vote action * Disallow duplicate stacker entries * reduce duplication in populating adv-post-form initial values * Update item_act sql function to implement multi-way forwarding * Update referral functions to scale referral bonuses for forwarded users * Update notification text to reflect non-100% forwarded sats cases * Update wallet history sql queries to accommodate multi-forward use cases * Block zaps for posts you are forwarded zaps at the API layer, in addition to in the UI * Delete fwdUserId column from Item table as part of migration * Fix how we calculate stacked sats after partial forwards in wallet history * Exclude entries from wallet history that are 0 stacked sats from posts with 100% forwarded to other users * Fix wallet history query for forwarded stacked sats to be scaled by the fwd pct * Reduce duplication in adv post form, and do some style tweaks for better layout * Use MAX_FORWARDS constants * Address various PR feedback * first enhancement pass * enhancement pass too --------- Co-authored-by: keyan <keyan.kousha+huumn@gmail.com> Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
161 lines
2.5 KiB
JavaScript
161 lines
2.5 KiB
JavaScript
import { gql } from '@apollo/client'
|
|
import { COMMENTS } from './comments'
|
|
|
|
export const ITEM_FIELDS = gql`
|
|
fragment ItemFields on Item {
|
|
id
|
|
parentId
|
|
createdAt
|
|
deletedAt
|
|
title
|
|
url
|
|
user {
|
|
name
|
|
streak
|
|
hideCowboyHat
|
|
id
|
|
}
|
|
otsHash
|
|
position
|
|
sats
|
|
meAnonSats @client
|
|
boost
|
|
bounty
|
|
bountyPaidTo
|
|
path
|
|
upvotes
|
|
meSats
|
|
meDontLike
|
|
meBookmark
|
|
meSubscription
|
|
outlawed
|
|
freebie
|
|
ncomments
|
|
commentSats
|
|
lastCommentAt
|
|
maxBid
|
|
isJob
|
|
company
|
|
location
|
|
remote
|
|
subName
|
|
pollCost
|
|
status
|
|
uploadId
|
|
mine
|
|
}`
|
|
|
|
export const ITEM_FULL_FIELDS = gql`
|
|
${ITEM_FIELDS}
|
|
fragment ItemFullFields on Item {
|
|
...ItemFields
|
|
text
|
|
root {
|
|
id
|
|
title
|
|
bounty
|
|
bountyPaidTo
|
|
subName
|
|
user {
|
|
name
|
|
streak
|
|
hideCowboyHat
|
|
id
|
|
}
|
|
}
|
|
forwards {
|
|
userId
|
|
pct
|
|
user {
|
|
name
|
|
}
|
|
}
|
|
}`
|
|
|
|
export const ITEM_OTS_FIELDS = gql`
|
|
fragment ItemOtsFields on Item {
|
|
id
|
|
title
|
|
text
|
|
url
|
|
parentOtsHash
|
|
otsHash
|
|
deletedAt
|
|
}`
|
|
|
|
export const ITEM_OTS = gql`
|
|
${ITEM_OTS_FIELDS}
|
|
|
|
query Item($id: ID!) {
|
|
item(id: $id) {
|
|
...ItemOtsFields
|
|
}
|
|
}`
|
|
|
|
export const POLL_FIELDS = gql`
|
|
fragment PollFields on Item {
|
|
poll {
|
|
meVoted
|
|
count
|
|
options {
|
|
id
|
|
option
|
|
count
|
|
meVoted
|
|
}
|
|
}
|
|
}`
|
|
|
|
export const ITEM = gql`
|
|
${ITEM_FULL_FIELDS}
|
|
${POLL_FIELDS}
|
|
|
|
query Item($id: ID!) {
|
|
item(id: $id) {
|
|
...ItemFullFields
|
|
...PollFields
|
|
}
|
|
}`
|
|
|
|
export const ITEM_FULL = gql`
|
|
${ITEM_FULL_FIELDS}
|
|
${POLL_FIELDS}
|
|
${COMMENTS}
|
|
query Item($id: ID!, $sort: String) {
|
|
item(id: $id) {
|
|
...ItemFullFields
|
|
prior
|
|
...PollFields
|
|
comments(sort: $sort) {
|
|
...CommentsRecursive
|
|
}
|
|
}
|
|
}`
|
|
|
|
export const RELATED_ITEMS = gql`
|
|
${ITEM_FIELDS}
|
|
query Related($title: String, $id: ID, $cursor: String, $limit: Int) {
|
|
related(title: $title, id: $id, cursor: $cursor, limit: $limit) {
|
|
cursor
|
|
items {
|
|
...ItemFields
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const RELATED_ITEMS_WITH_ITEM = gql`
|
|
${ITEM_FIELDS}
|
|
query Related($title: String, $id: ID, $cursor: String, $limit: Int) {
|
|
item(id: $id) {
|
|
...ItemFields
|
|
}
|
|
related(title: $title, id: $id, cursor: $cursor, limit: $limit) {
|
|
cursor
|
|
items {
|
|
...ItemFields
|
|
}
|
|
}
|
|
}
|
|
`
|