Merge branch 'master' into colored-badges

This commit is contained in:
Keyan 2024-11-01 19:12:34 -05:00 committed by GitHub
commit 2b136715a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 176 additions and 84 deletions

View File

@ -1,35 +0,0 @@
---
name: Bug report
about: Report a problem
title: ''
labels: bug
assignees: ''
---
*Note: this template is meant to help you report the bug so that we can fix it faster, ie not all of these sections are required*
**Description**
A clear and concise description of what the bug is.
**Steps to Reproduce**
A clear and concise way we might be able to reproduce the bug.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Logs**
If applicable, add your browsers console logs.
**Environment:**
If you only experience the issue on certain devices or browsers, provide that info.
- Device: [e.g. iPhone6]
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

65
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@ -0,0 +1,65 @@
name: 🐞 Bug report
description: Create a bug report to help us fix it
title: "bug report"
labels: [bug]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is. Include images if relevant.
placeholder: I accidentally deleted the internet. Here's my story ...
validations:
required: true
- type: textarea
attributes:
label: Screenshots
description: |
Add screenshots to help explain your problem. You can also add a video here.
Tip: You can attach images or video files by clicking this area to highlight it and then dragging files in.
validations:
required: false
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the bug.
placeholder: |
1. Go to '...'
2. Click on '...'
3. Scroll to '...'
4. See error
validations:
required: true
- type: textarea
attributes:
label: Expected behavior
description: A clear and concise description of what you expected to happen
validations:
required: true
- type: textarea
attributes:
label: Logs
description: If applicable, add your browser's console logs here
- type: textarea
attributes:
label: Device information
placeholder: |
- OS: [e.g. Windows]
- Browser: [e.g. chrome, safari, firefox]
- Browser Version: [e.g. 22]
validations:
required: false
- type: textarea
attributes:
label: Additional context
description: |
Do you have links to discussions about this on SN or other references?
validations:
required: false

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Questions
url: https://stacker.news/~meta
about: If you simply have a question, you can ask it in ~meta or the saloon.

View File

@ -1,20 +0,0 @@
---
name: Feature request
about: Suggest a feature
title: ''
labels: feature
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -0,0 +1,32 @@
name: ✨ Feature request
description: Request a feature you'd like to see in SN!
title: "feature request"
labels: [feature]
body:
- type: markdown
attributes:
value: |
We're always looking for suggestions on how we could improve SN!
- type: textarea
attributes:
label: Describe the problem you're trying to solve
description: |
Is your feature request related to a problem? Add a clear and concise description of what the problem is.
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered
description: |
A clear and concise description of any alternative solutions or features you have considered.
- type: textarea
attributes:
label: Additional context
description: |
Add any other additional context or screenshots about the feature request here.

View File

@ -1,45 +1,22 @@
## Description
<!--
A clear and concise description of what you changed and why.
Don't forget to mention which tickets this closes (if any).
Use following syntax to close them automatically on merge: closes #<number>
-->
_A clear and concise description of what you changed and why._
## Screenshots
<!--
If your changes are user facing, please add screenshots of the new UI.
You can also create a video to showcase your changes (useful to show UX).
-->
## Additional Context
<!--
You can mention here anything that you think is relevant for this PR. Some examples:
* You encountered something that you didn't understand while working on this PR
* You were not sure about something you did but did not find a better way
* You initially had a different approach but went with a different approach for some reason
-->
_Was anything unclear during your work on this PR? Anything we should definitely take a closer look at?_
## Checklist
**Are your changes backwards compatible? Please answer below:**
<!-- put your answer about backwards compatibility here -->
<!--
If your PR is not ready for review yet, please mark your PR as a draft.
If changes were requested, request a new review when you incorporated the feedback.
-->
**On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:**
<!-- put your answer about QA here -->
**For frontend changes: Tested on mobile? Please answer below:**
<!-- put your answer about mobile QA here -->
**Did you introduce any new environment variables? If so, call them out explicitly here:**
<!-- put your answer about env vars here -->

View File

@ -17,6 +17,7 @@ import ItemPopover from './item-popover'
import classNames from 'classnames'
import { CarouselProvider, useCarousel } from './carousel'
import rehypeSN from '@/lib/rehype-sn'
import remarkUnicode from '@/lib/remark-unicode'
import Embed from './embed'
import remarkMath from 'remark-math'
import rehypeMathjax from 'rehype-mathjax'
@ -33,7 +34,7 @@ const rehypeSNStyled = () => rehypeSN({
}]
})
const remarkPlugins = [gfm, [remarkMath, { singleDollarTextMath: false }]]
const remarkPlugins = [gfm, remarkUnicode, [remarkMath, { singleDollarTextMath: false }]]
const rehypePlugins = [rehypeSNStyled, rehypeMathjax]
export function SearchText ({ text }) {

31
lib/remark-unicode.js Normal file
View File

@ -0,0 +1,31 @@
import { visit } from 'unist-util-visit'
export default function remarkFilterUnicode () {
return (tree) => {
try {
visit(tree, 'paragraph', (node) => {
node.children = node.children.map(child => {
if (child.type !== 'inlineMath') return child
// if inline math contains currency symbols, rehypeMathjax will throw
// see https://github.com/stackernews/stacker.news/issues/1525
// and https://github.com/stackernews/stacker.news/pull/1526
let { hChildren } = child.data
hChildren = hChildren.map(child2 => {
return { ...child2, value: filterUnicode(child2.value) }
})
child.data.hChildren = hChildren
return { ...child, value: filterUnicode(child.value) }
})
})
} catch (err) {
console.error(err)
}
}
}
function filterUnicode (text) {
return text.replace(/\p{Sc}/u, '')
}

View File

@ -27,6 +27,7 @@ function InviteForm () {
fields: {
invites (existingInviteRefs = []) {
const newInviteRef = cache.writeFragment({
fragmentName: 'InviteFields',
data: createInvite,
fragment: INVITE_FIELDS
})

View File

@ -0,0 +1,28 @@
-- fix revenue for users who have multiple revenue entries for the same day
WITH revenue_days AS (
SELECT coalesce(sum(msats), 0) as revenue_msats, "userId", created_at
FROM "SubAct"
WHERE type = 'REVENUE'
GROUP BY "userId", created_at
HAVING COUNT(*) > 1
),
revenue_total AS (
SELECT coalesce(sum(revenue_msats), 0) as revenue_msats, "userId"
FROM revenue_days
GROUP BY "userId"
)
UPDATE users SET msats = users.msats + revenue_total.revenue_msats
FROM revenue_total
WHERE users.id = revenue_total."userId";
-- fix stacked msats for users who have territory revenue
-- prior to this, we were not updating stacked msats for territory revenue
WITH territory_revenue AS (
SELECT coalesce(sum(msats), 0) as revenue_msats, "userId"
FROM "SubAct"
WHERE type = 'REVENUE'
GROUP BY "userId"
)
UPDATE users SET "stackedMsats" = users."stackedMsats" + territory_revenue.revenue_msats
FROM territory_revenue
WHERE users.id = territory_revenue."userId";

View File

@ -72,10 +72,17 @@ export async function territoryRevenue ({ models }) {
FROM revenue
WHERE revenue > 1000
RETURNING *
),
"SubActResultTotal" AS (
SELECT coalesce(sum(msats), 0) as total_msats, "userId"
FROM "SubActResult"
GROUP BY "userId"
)
UPDATE users SET msats = users.msats + "SubActResult".msats
FROM "SubActResult"
WHERE users.id = "SubActResult"."userId"`,
UPDATE users
SET msats = users.msats + "SubActResultTotal".total_msats,
"stackedMsats" = users."stackedMsats" + "SubActResultTotal".total_msats
FROM "SubActResultTotal"
WHERE users.id = "SubActResultTotal"."userId"`,
{ models }
)
}