Skip to content

Commit

Permalink
Merge pull request #682 from FuelRats/fix/anope-email-update
Browse files Browse the repository at this point in the history
chore: update babel and deployment workflows
  • Loading branch information
SuperManifolds authored Nov 5, 2024
2 parents 32b9156 + a293d55 commit 849842b
Show file tree
Hide file tree
Showing 7 changed files with 1,179 additions and 796 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
yarn.lock
- name: Publish artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: fr-api
path: fr-api.tar.gz
Expand All @@ -62,7 +62,7 @@ jobs:

steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: fr-api

Expand All @@ -72,7 +72,7 @@ jobs:
rm fr-api.tar.gz
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
name: Lint
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand All @@ -23,7 +23,7 @@ jobs:
run: yarn install --immutable

- name: Lint
uses: wearerequired/lint-action@v1.9.0
uses: wearerequired/lint-action@v2.3.0
with:
github_token: ${{ secrets.github_token }}
eslint: true
Expand All @@ -36,10 +36,10 @@ jobs:
name: Build Test
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand Down
37 changes: 18 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"git-rev-promises": "^1.1.0",
"gulp-cli": "^2.2.0",
"i18next": "^19.0.1",
"join-js": "xlexi/joinjs",
"knex": "~2.4.2",
"koa": "^2.11.0",
"koa-body": "^4.1.1",
Expand Down Expand Up @@ -62,24 +61,24 @@
"node": "16.4.0"
},
"devDependencies": {
"@babel/cli": "7.14.8",
"@babel/core": "^7.14.8",
"@babel/eslint-parser": "^7.14.7",
"@babel/eslint-plugin": "^7.14.5",
"@babel/plugin-external-helpers": "^7.14.5",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-decorators": "^7.14.5",
"@babel/plugin-proposal-export-default-from": "^7.14.5",
"@babel/plugin-proposal-export-namespace-from": "^7.14.5",
"@babel/plugin-proposal-function-bind": "^7.14.5",
"@babel/plugin-proposal-function-sent": "^7.14.5",
"@babel/plugin-proposal-logical-assignment-operators": "^7.14.5",
"@babel/plugin-proposal-numeric-separator": "^7.14.5",
"@babel/plugin-proposal-optional-catch-binding": "^7.14.5",
"@babel/plugin-proposal-throw-expressions": "^7.14.5",
"@babel/plugin-transform-modules-commonjs": "^7.14.5",
"@babel/plugin-transform-strict-mode": "^7.14.5",
"@babel/preset-env": "^7.14.9",
"@babel/cli": "7.25.9",
"@babel/core": "^7.26.0",
"@babel/eslint-parser": "^7.25.9",
"@babel/eslint-plugin": "^7.25.9",
"@babel/plugin-external-helpers": "^7.25.9",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.25.9",
"@babel/plugin-proposal-export-default-from": "^7.25.9",
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
"@babel/plugin-proposal-function-bind": "^7.25.9",
"@babel/plugin-proposal-function-sent": "^7.25.9",
"@babel/plugin-proposal-logical-assignment-operators": "^7.20.7",
"@babel/plugin-proposal-numeric-separator": "^7.18.6",
"@babel/plugin-proposal-optional-catch-binding": "^7.18.6",
"@babel/plugin-proposal-throw-expressions": "^7.25.9",
"@babel/plugin-transform-modules-commonjs": "^7.25.9",
"@babel/plugin-transform-strict-mode": "^7.25.9",
"@babel/preset-env": "^7.26.0",
"@fuelrats/eslint-config": "^2.3.0",
"@fuelrats/eslint-plugin": "^2.3.0",
"@rollup/plugin-babel": "^5.3.0",
Expand Down
2 changes: 1 addition & 1 deletion src/db/Rat.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default class Rat extends Model {
model: models.Ship.scope(undefined),
as: 'ships',
required: false,
}
},
],
}],
}
Expand Down
4 changes: 2 additions & 2 deletions src/routes/Register.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class Register extends API {
})
if (rescue) {
await Announcer.sendModeratorMessage({
message: `[Registration] Rejected signup attempt by CMDR ${name} as they have an active case`
message: `[Registration] Rejected signup attempt by CMDR ${name} as they have an active case`,
})
throw new ForbiddenAPIError({
pointer: '/data/attributes/name',
Expand Down Expand Up @@ -101,7 +101,7 @@ export default class Register extends API {
await Verifications.createVerification(user, transaction)

await Announcer.sendModeratorMessage({
message: `[Registration] User with email ${email} registered. Nickname: ${nickname}.
message: `[Registration] User with email ${email} registered. Nickname: ${nickname}.
CMDR name: ${name} (IP: ${ctx.ip})`,
})
return Sessions.createVerifiedSession(ctx, user, transaction)
Expand Down
14 changes: 8 additions & 6 deletions src/routes/Users.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export default class Users extends APIResource {
@authenticated
@required()
async setEmail (ctx) {
const { email } = getJSONAPIData({ ctx, type: 'email-changes' }).attributes
const { email: newEmail } = getJSONAPIData({ ctx, type: 'email-changes' }).attributes

const user = await User.findOne({
where: {
Expand All @@ -208,12 +208,12 @@ export default class Users extends APIResource {
throw new NotFoundAPIError({ parameter: 'id' })
}

const oldEmail = user.email

this.requireWritePermission({ connection: ctx, entity: user })

await db.transaction(async (transaction) => {
const oldEmail = user.email

user.email = email
user.email = newEmail
await user.save({ transaction })
const verifiedGroup = user.groups.find((group) => {
return group.name === 'verified'
Expand All @@ -223,15 +223,17 @@ export default class Users extends APIResource {
}

await Verifications.createVerification(user, transaction, true)
await mail.send(emailChangeEmail({ email: oldEmail, name: user.preferredRat().name, newEmail: email }))
await mail.send(emailChangeEmail({ email: oldEmail, name: user.preferredRat().name, newEmail }))

await Announcer.sendModeratorMessage({
message: `[Account Change] User with email ${oldEmail} has changed their email to ${email}`,
message: `[Account Change] User with email ${oldEmail} has changed their email to ${newEmail}`,
})

return user
})

await Anope.setEmail(oldEmail, newEmail)

const result = await Anope.mapNickname(user)

Event.broadcast('fuelrats.userupdate', ctx.state.user, user.id, {})
Expand Down
Loading

0 comments on commit 849842b

Please sign in to comment.