Skip to content

Commit

Permalink
fix for bug when Team has no stripeSubscription, VS editor settings
Browse files Browse the repository at this point in the history
  • Loading branch information
tima101 committed Aug 10, 2018
1 parent a4e14bb commit be26e29
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 35 deletions.
3 changes: 3 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
printWidth: 100
};
30 changes: 10 additions & 20 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
{
"files.watcherExclude": {
"**/.next/**": true,
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true
},
"search.exclude": {
"**/.next": true,
"**/yarn.lock": true,
"**/dist": true,
"**/node_modules": true,
"**/.meteor": true,
"**/bower_components": true
},
"window.zoomLevel": 0,
"files.autoSave": "afterDelay",
"git.enableSmartCommit": true,
"git.autofetch": true,
"editor.formatOnSave": true,
"prettier.eslintIntegration": true,
"editor.minimap.enabled": false,
"editor.wordWrap": "on",
"typescript.experimental.syntaxFolding": false,
"editor.detectIndentation": false,
"editor.tabSize": 2,
"git.enableSmartCommit": true,
"git.autofetch": true
"eslint.autoFixOnSave": true,
"prettier.eslintIntegration": true,
"typescript.updateImportsOnFileMove.enabled": "never",
"tslint.enable": true,
"tslint.autoFixOnSave": true,
"prettier.tslintIntegration": true,
}
2 changes: 2 additions & 0 deletions api/server/api/team-leader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ router.post('/subscribe-team', async (req, res, next) => {
teamId,
});

await User.getListOfInvoicesForCustomer({ userId: req.user.id });

res.json({ isSubscriptionActive, stripeSubscription });
} catch (err) {
next(err);
Expand Down
2 changes: 0 additions & 2 deletions api/server/models/Team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ class TeamClass extends mongoose.Model {
teamLeaderId,
});

await User.getListOfInvoicesForCustomer({ userId: teamLeaderId });

return this.findByIdAndUpdate(
teamId,
{
Expand Down
2 changes: 2 additions & 0 deletions api/server/models/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ class UserClass extends mongoose.Model {
'slug',
'isGithubConnected',
'defaultTeamSlug',
'hasCardInformation',
'stripeCustomer',
'stripeCard',
'stripeListOfInvoices',
];
Expand Down
18 changes: 5 additions & 13 deletions app/pages/settings/your-profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const styleGrid = {
};

type MyProps = { store: Store; isTL: boolean; error?: string };
type MyState = { newName: string; newAvatarUrl: string; disabled: boolean; showInvoices: boolean; };
type MyState = { newName: string; newAvatarUrl: string; disabled: boolean; showInvoices: boolean };

class YourProfile extends React.Component<MyProps, MyState> {
public static getInitialProps({ query }) {
Expand Down Expand Up @@ -176,11 +176,7 @@ class YourProfile extends React.Component<MyProps, MyState> {
<p />
<br />
<h4>Payment history</h4>
<Button
variant="outlined"
color="primary"
onClick={this.showListOfInvoicesOnClick}
>
<Button variant="outlined" color="primary" onClick={this.showListOfInvoicesOnClick}>
Show payment history
</Button>
{this.renderInvoices()}
Expand Down Expand Up @@ -225,13 +221,9 @@ class YourProfile extends React.Component<MyProps, MyState> {
<p>Your history of payments:</p>
<li key={i}>
${invoice.amount_paid / 100} was paid on{' '}
{moment(invoice.date * 1000).format('MMM Do YYYY')}{' '}
for Team '{invoice.teamName}' -{' '}
<a
href={invoice.hosted_invoice_url}
target="_blank"
rel="noopener noreferrer"
>
{moment(invoice.date * 1000).format('MMM Do YYYY')} for Team '{invoice.teamName}'
-{' '}
<a href={invoice.hosted_invoice_url} target="_blank" rel="noopener noreferrer">
See invoice
</a>
</li>
Expand Down

0 comments on commit be26e29

Please sign in to comment.