fix bio
This commit is contained in:
		
							parent
							
								
									fda7b1b140
								
							
						
					
					
						commit
						2e846af737
					
				@ -1097,7 +1097,7 @@ export const updateItem = async (parent, { sub: subName, forward, options, ...it
 | 
				
			|||||||
  return item
 | 
					  return item
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const createItem = async (parent, { forward, options, ...item }, { me, models, lnd, invoiceHash, invoiceHmac }) => {
 | 
					export const createItem = async (parent, { forward, options, ...item }, { me, models, lnd, invoiceHash, invoiceHmac }) => {
 | 
				
			||||||
  let spamInterval = ITEM_SPAM_INTERVAL
 | 
					  let spamInterval = ITEM_SPAM_INTERVAL
 | 
				
			||||||
  const trx = []
 | 
					  const trx = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -2,8 +2,7 @@ import { GraphQLError } from 'graphql'
 | 
				
			|||||||
import { decodeCursor, LIMIT, nextCursorEncoded } from '../../lib/cursor'
 | 
					import { decodeCursor, LIMIT, nextCursorEncoded } from '../../lib/cursor'
 | 
				
			||||||
import { msatsToSats } from '../../lib/format'
 | 
					import { msatsToSats } from '../../lib/format'
 | 
				
			||||||
import { bioSchema, emailSchema, settingsSchema, ssValidate, userSchema } from '../../lib/validate'
 | 
					import { bioSchema, emailSchema, settingsSchema, ssValidate, userSchema } from '../../lib/validate'
 | 
				
			||||||
import { createMentions, getItem, SELECT, updateItem, filterClause } from './item'
 | 
					import { getItem, updateItem, filterClause, createItem } from './item'
 | 
				
			||||||
import serialize from './serial'
 | 
					 | 
				
			||||||
import { datePivot } from '../../lib/time'
 | 
					import { datePivot } from '../../lib/time'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function within (table, within) {
 | 
					export function within (table, within) {
 | 
				
			||||||
@ -498,12 +497,9 @@ export default {
 | 
				
			|||||||
      const user = await models.user.findUnique({ where: { id: me.id } })
 | 
					      const user = await models.user.findUnique({ where: { id: me.id } })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (user.bioId) {
 | 
					      if (user.bioId) {
 | 
				
			||||||
        await updateItem(parent, { id: user.bioId, data: { text: bio, title: `@${user.name}'s bio` } }, { me, models })
 | 
					        await updateItem(parent, { id: user.bioId, text: bio, title: `@${user.name}'s bio` }, { me, models })
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        const [item] = await serialize(models,
 | 
					        await createItem(parent, { bio: true, text: bio, title: `@${user.name}'s bio` }, { me, models })
 | 
				
			||||||
          models.$queryRawUnsafe(`${SELECT} FROM create_bio($1, $2, $3::INTEGER) AS "Item"`,
 | 
					 | 
				
			||||||
            `@${user.name}'s bio`, bio, Number(me.id)))
 | 
					 | 
				
			||||||
        await createMentions(item, models)
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return await models.user.findUnique({ where: { id: me.id } })
 | 
					      return await models.user.findUnique({ where: { id: me.id } })
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user