Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable29] fix(settings): Fix mail server settings form #50183

Merged
merged 2 commits into from
Jan 26, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(settings): Fix mail server settings form
Signed-off-by: provokateurin <kate@provokateurin.de>
provokateurin authored and AndyScherzinger committed Jan 26, 2025

Verified

This commit was signed with the committer’s verified signature.
AndyScherzinger Andy Scherzinger
commit e0accb5d5162e3e62c751d0f022fef41ff5a12c9
48 changes: 19 additions & 29 deletions apps/settings/src/admin.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { generateUrl } from '@nextcloud/router'
import $ from 'jquery'
import axios from '@nextcloud/axios'

window.addEventListener('DOMContentLoaded', () => {
$('#loglevel').change(function() {
$.post(OC.generateUrl('/settings/admin/log/level'), { level: $(this).val() }, () => {
@@ -40,17 +44,12 @@ window.addEventListener('DOMContentLoaded', () => {
}

OC.msg.startSaving('#mail_settings_msg')
$.ajax({
url: OC.generateUrl('/settings/admin/mailsettings'),
type: 'POST',
data: $('#mail_general_settings_form').serialize(),
success: () => {
axios.post(generateUrl('/settings/admin/mailsettings'), $('#mail_general_settings_form').serialize())
.then(() => {
OC.msg.finishedSuccess('#mail_settings_msg', t('settings', 'Saved'))
},
error: (xhr) => {
OC.msg.finishedError('#mail_settings_msg', xhr.responseJSON)
},
})
}).catch((error) => {
OC.msg.finishedError('#mail_settings_msg', error)
})
}

const toggleEmailCredentials = function() {
@@ -60,17 +59,12 @@ window.addEventListener('DOMContentLoaded', () => {
}

OC.msg.startSaving('#mail_settings_msg')
$.ajax({
url: OC.generateUrl('/settings/admin/mailsettings/credentials'),
type: 'POST',
data: $('#mail_credentials_settings').serialize(),
success: () => {
axios.post(generateUrl('/settings/admin/mailsettings/credentials'), $('#mail_credentials_settings').serialize())
.then(() => {
OC.msg.finishedSuccess('#mail_settings_msg', t('settings', 'Saved'))
},
error: (xhr) => {
OC.msg.finishedError('#mail_settings_msg', xhr.responseJSON)
},
})
}).catch((error) => {
OC.msg.finishedError('#mail_settings_msg', error)
})
}

$('#mail_general_settings_form').change(changeEmailSettings)
@@ -86,16 +80,12 @@ window.addEventListener('DOMContentLoaded', () => {
event.preventDefault()
OC.msg.startAction('#sendtestmail_msg', t('settings', 'Sending…'))

$.ajax({
url: OC.generateUrl('/settings/admin/mailtest'),
type: 'POST',
success: () => {
axios.post(generateUrl('/settings/admin/mailtest'))
.then(() => {
OC.msg.finishedSuccess('#sendtestmail_msg', t('settings', 'Email sent'))
},
error: (xhr) => {
OC.msg.finishedError('#sendtestmail_msg', xhr.responseJSON)
},
})
}).catch((error) => {
OC.msg.finishedError('#sendtestmail_msg', error)
})
})

const setupChecks = () => {

Unchanged files with check annotations Beta

* @deprecated 26.0.0 use `register` from https://www.npmjs.com/package/@nextcloud/l10
*
* @param {string} appName name of the app
* @param {Object<string, string>} bundle bundle

Check warning on line 65 in core/src/OC/l10n.js

GitHub Actions / NPM lint

Use object shorthand or index signatures instead of `Object`, e.g., `{[key: string]: string}`
*/
register,
/**
* Shows a given element as menu
*
* @param {object} [$toggle=null] menu toggle

Check warning on line 126 in core/src/OC/menu.js

GitHub Actions / NPM lint

Defaults are not permitted on @param
* @param {object} $menuEl menu element
* @param {Function} complete callback when the showing animation is done
*/
* @param {string} html Message to display
* @param {object} [options] options
* @param {string} [options.type] notification type
* @param {number} [options.timeout=0] timeout value, defaults to 0 (permanent)

Check warning on line 101 in core/src/OC/notification.js

GitHub Actions / NPM lint

Defaults are not permitted on @param
* @return {jQuery} jQuery element for notification row
* @deprecated 17.0.0 use the `@nextcloud/dialogs` package
*/
* @param {string} text Message to display
* @param {object} [options] options
* @param {string} [options.type] notification type
* @param {number} [options.timeout=0] timeout value, defaults to 0 (permanent)

Check warning on line 120 in core/src/OC/notification.js

GitHub Actions / NPM lint

Defaults are not permitted on @param
* @return {jQuery} jQuery element for notification row
* @deprecated 17.0.0 use the `@nextcloud/dialogs` package
*/
*
* @param {string} text Message to show
* @param {Array} [options] options array
* @param {number} [options.timeout=7] timeout in seconds, if this is 0 it will show the message permanently

Check warning on line 163 in core/src/OC/notification.js

GitHub Actions / NPM lint

Defaults are not permitted on @param
* @param {boolean} [options.isHTML=false] an indicator for HTML notifications (true) or text (false)

Check warning on line 164 in core/src/OC/notification.js

GitHub Actions / NPM lint

Defaults are not permitted on @param
* @param {string} [options.type] notification type
* @return {JQuery} the toast element

Check warning on line 166 in core/src/OC/notification.js

GitHub Actions / NPM lint

The type 'JQuery' is undefined
* @deprecated 17.0.0 use the `@nextcloud/dialogs` package
*/
showTemporary(text, options) {
* Parses a URL query string into a JS map
*
* @param {string} queryString query string in the format param1=1234&param2=abcde&param3=xyz
* @return {Object<string, string>} map containing key/values matching the URL parameters

Check warning on line 31 in core/src/OC/query-string.js

GitHub Actions / NPM lint

Use object shorthand or index signatures instead of `Object`, e.g., `{[key: string]: string}`
*/
export const parse = queryString => {
let pos
/**
* Builds a URL query from a JS map.
*
* @param {Object<string, string>} params map containing key/values matching the URL parameters

Check warning on line 80 in core/src/OC/query-string.js

GitHub Actions / NPM lint

Use object shorthand or index signatures instead of `Object`, e.g., `{[key: string]: string}`
* @return {string} String containing a URL query (without question) mark
*/
export const build = params => {
* or a map
* @param {string} [url] URL to be used, otherwise the current URL will be used,
* using the params as query string
* @param {boolean} [replace=false] whether to replace instead of pushing

Check warning on line 48 in core/src/OC/util-history.js

GitHub Actions / NPM lint

Defaults are not permitted on @param
*/
_pushState(params, url, replace) {
let strParams