Skip to content

Commit 2518a21

Browse files
committed
enhancement: Use legal names in receipts and invoices
1 parent 5c332ad commit 2518a21

File tree

9 files changed

+12
-7
lines changed

9 files changed

+12
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ out
1717
coverage
1818
test/__snapshots__/*.diff.png
1919
test/__snapshots__/*.new.png
20+
test-report.junit.xml
2021

2122
# VSCode
2223
.vscode

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start": "node dist/server/index.js",
1010
"test": "START_SERVER=false vitest --run",
1111
"test:watch": "vitest --watch",
12-
"test:coverage": "vitest --run --coverage --reporter=junit --outputFile=test-report.junit.xml",
12+
"test:coverage": "vitest --run --coverage --reporter=junit --reporter=default --outputFile=test-report.junit.xml",
1313
"test:update": "rm test/__snapshots__/*.png && vitest --run",
1414
"type:check": "tsc --noEmit",
1515
"dev": "tsx watch server/index.ts",

server/components/CollectiveFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const CollectiveFooter = ({ collective }: { collective: Account | GraphQLV1Colle
4949
</View>
5050
)}
5151
<View>
52-
<Text style={styles.collectiveName}>{collective.name}</Text>
52+
<Text style={styles.collectiveName}>{collective.legalName || collective.name || collective.slug}</Text>
5353
<View style={styles.address}>
5454
<LocationParagraph collective={collective} />
5555
</View>

server/components/expenses/ExpenseInvoice.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ const ExpenseInvoice = ({
171171
<Text style={styles.addressTitle}>
172172
<FormattedMessage id="dM+p3/" defaultMessage="From" />
173173
</Text>
174-
<Text style={styles.addressText}>{payee.name || payee.slug}</Text>
174+
<Text style={styles.addressText}>{payee.legalName || payee.name || payee.slug}</Text>
175175
{payeeLocation?.address && <Text style={styles.addressText}>{payeeLocation.address}</Text>}
176176
{payeeLocation?.country && <Text style={styles.addressText}>{payeeLocation.country}</Text>}
177177
</View>
@@ -180,7 +180,9 @@ const ExpenseInvoice = ({
180180
<Text style={styles.addressTitle}>
181181
<FormattedMessage id="gSv0eP" defaultMessage="Bill to" />
182182
</Text>
183-
<Text style={styles.addressText}>{billToAccount.name || billToAccount.slug}</Text>
183+
<Text style={styles.addressText}>
184+
{billToAccount.legalName || billToAccount.name || billToAccount.slug}
185+
</Text>
184186
{billToAccount.location?.address && (
185187
<Text style={styles.addressText}>{billToAccount.location.address}</Text>
186188
)}
@@ -217,7 +219,7 @@ const ExpenseInvoice = ({
217219
<FormattedMessage
218220
id="AJ6aIN"
219221
defaultMessage="Collective: {collectiveName}"
220-
values={{ collectiveName: account.name || account.slug }}
222+
values={{ collectiveName: account.legalName || account.name || account.slug }}
221223
/>
222224
</Text>
223225
<Text style={styles.expenseInfo}>

server/components/receipts/Receipt.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ type Props = {
272272
fromAccountHost?:
273273
| (Pick<Account, 'name' | 'slug' | 'legalName'> & { settings?: { VAT?: { number?: string } } })
274274
| null;
275-
host: Pick<Account, 'name' | 'slug' | 'location'>;
275+
host: Pick<Account, 'name' | 'slug' | 'legalName' | 'location'>;
276276
transactions: Array<
277277
Pick<
278278
Transaction,
@@ -592,7 +592,9 @@ export class Receipt extends React.Component<Props> {
592592
<View style={[styles.flexRow, styles.flexWrap, styles.alignStart]}>
593593
<View style={[styles.flexGrow, styles.mb3]}>
594594
<Link src={`https://opencollective.com/${receipt.host.slug}`} style={styles.link}>
595-
<Text style={styles.accountName}>{receipt.host.name || receipt.host.slug}</Text>
595+
<Text style={styles.accountName}>
596+
{receipt.host.legalName || receipt.host.name || receipt.host.slug}
597+
</Text>
596598
</Link>
597599
<View style={styles.my2}>
598600
<LocationParagraph collective={receipt.host as Account} />
3.43 KB
Loading
3.94 KB
Loading
3.34 KB
Loading
2.59 KB
Loading

0 commit comments

Comments
 (0)