mirror of
https://github.com/plankanban/planka.git
synced 2025-12-24 09:15:01 +03:00
fix: Set detected language on first login, remove auto-detect language option
This commit is contained in:
@@ -21,7 +21,8 @@ SECRET_KEY=notsecretkey
|
||||
# Configure knex to accept SSL certificates
|
||||
# KNEX_REJECT_UNAUTHORIZED_SSL_CERTIFICATE=false
|
||||
|
||||
# Used for per-board notifications
|
||||
# The default application language used as a fallback when a user's language is not set.
|
||||
# This language is also used for per-board notifications.
|
||||
# DEFAULT_LANGUAGE=en-US
|
||||
|
||||
# Do not comment out DEFAULT_ADMIN_EMAIL if you want to prevent this user from being edited/deleted
|
||||
|
||||
@@ -33,6 +33,12 @@
|
||||
* maxLength: 64
|
||||
* description: Terms signature hash based on user role
|
||||
* example: 940226c4c41f51afe3980ceb63704e752636526f4c52a4ea579e85b247493d94
|
||||
* initialLanguage:
|
||||
* type: string
|
||||
* enum: [ar-YE, bg-BG, cs-CZ, da-DK, de-DE, el-GR, en-GB, en-US, es-ES, et-EE, fa-IR, fi-FI, fr-FR, hu-HU, id-ID, it-IT, ja-JP, ko-KR, nl-NL, pl-PL, pt-BR, pt-PT, ro-RO, ru-RU, sk-SK, sr-Cyrl-RS, sr-Latn-RS, sv-SE, tr-TR, uk-UA, uz-UZ, zh-CN, zh-TW]
|
||||
* nullable: true
|
||||
* description: Preferred language for user interface and notifications (used only if user language is not set)
|
||||
* example: en-US
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Terms accepted successfully
|
||||
@@ -120,6 +126,11 @@ module.exports = {
|
||||
maxLength: 64,
|
||||
required: true,
|
||||
},
|
||||
initialLanguage: {
|
||||
type: 'string',
|
||||
isIn: User.LANGUAGES,
|
||||
allowNull: true,
|
||||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
@@ -179,10 +190,16 @@ module.exports = {
|
||||
throw Errors.INVALID_SIGNATURE;
|
||||
}
|
||||
|
||||
({ user } = await User.qm.updateOne(user.id, {
|
||||
const values = {
|
||||
termsSignature,
|
||||
termsAcceptedAt: new Date().toISOString(),
|
||||
}));
|
||||
};
|
||||
|
||||
if (!user.language && inputs.initialLanguage) {
|
||||
values.language = inputs.initialLanguage;
|
||||
}
|
||||
|
||||
({ user } = await User.qm.updateOne(user.id, values));
|
||||
}
|
||||
|
||||
const config = await Config.qm.getOneMain();
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
* type: string
|
||||
* enum: [ar-YE, bg-BG, cs-CZ, da-DK, de-DE, el-GR, en-GB, en-US, es-ES, et-EE, fa-IR, fi-FI, fr-FR, hu-HU, id-ID, it-IT, ja-JP, ko-KR, nl-NL, pl-PL, pt-BR, pt-PT, ro-RO, ru-RU, sk-SK, sr-Cyrl-RS, sr-Latn-RS, sv-SE, tr-TR, uk-UA, uz-UZ, zh-CN, zh-TW]
|
||||
* nullable: true
|
||||
* description: Preferred language for user interface and notifications
|
||||
* description: Preferred language for user interface and notifications (if null - will be set automatically on the first login)
|
||||
* example: en-US
|
||||
* subscribeToOwnCards:
|
||||
* type: boolean
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
* language:
|
||||
* type: string
|
||||
* enum: [ar-YE, bg-BG, cs-CZ, da-DK, de-DE, el-GR, en-GB, en-US, es-ES, et-EE, fa-IR, fi-FI, fr-FR, hu-HU, id-ID, it-IT, ja-JP, ko-KR, nl-NL, pl-PL, pt-BR, pt-PT, ro-RO, ru-RU, sk-SK, sr-Cyrl-RS, sr-Latn-RS, sv-SE, tr-TR, uk-UA, uz-UZ, zh-CN, zh-TW]
|
||||
* nullable: true
|
||||
* description: Preferred language for user interface and notifications
|
||||
* example: en-US
|
||||
* subscribeToOwnCards:
|
||||
@@ -167,7 +166,6 @@ module.exports = {
|
||||
language: {
|
||||
type: 'string',
|
||||
isIn: User.LANGUAGES,
|
||||
allowNull: true,
|
||||
},
|
||||
subscribeToOwnCards: {
|
||||
type: 'boolean',
|
||||
|
||||
@@ -33,6 +33,7 @@ module.exports = {
|
||||
cover180: `${fileManager.buildUrl(`${sails.config.custom.userAvatarsPathSegment}/${inputs.record.avatar.uploadedFileId}/cover-180.${inputs.record.avatar.extension}`)}`,
|
||||
},
|
||||
},
|
||||
language: inputs.record.language || sails.config.i18n.defaultLocale,
|
||||
termsType: sails.hooks.terms.getTypeByUserRole(inputs.record.role),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user