Parcourir la source

fix #1544

PerstentStatusMandatory should display as "enabled", not "mandatory",
in the context where it refers to a user-chosen setting.
tags/v2.6.0-rc1
Shivaram Lingamneni il y a 3 ans
Parent
révision
5c4984f45f
1 fichiers modifiés avec 11 ajouts et 2 suppressions
  1. 11
    2
      irc/nickserv.go

+ 11
- 2
irc/nickserv.go Voir le fichier

@@ -425,7 +425,7 @@ func displaySetting(service *ircService, settingName string, settings AccountSet
425 425
 	case "always-on":
426 426
 		stored := settings.AlwaysOn
427 427
 		actual := persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, stored)
428
-		service.Notice(rb, fmt.Sprintf(client.t("Your stored always-on setting is: %s"), persistentStatusToString(stored)))
428
+		service.Notice(rb, fmt.Sprintf(client.t("Your stored always-on setting is: %s"), userPersistentStatusToString(stored)))
429 429
 		if actual {
430 430
 			service.Notice(rb, client.t("Given current server settings, your client is always-on"))
431 431
 		} else {
@@ -447,7 +447,7 @@ func displaySetting(service *ircService, settingName string, settings AccountSet
447 447
 		stored := settings.AutoAway
448 448
 		alwaysOn := persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, settings.AlwaysOn)
449 449
 		actual := persistenceEnabled(config.Accounts.Multiclient.AutoAway, settings.AutoAway)
450
-		service.Notice(rb, fmt.Sprintf(client.t("Your stored auto-away setting is: %s"), persistentStatusToString(stored)))
450
+		service.Notice(rb, fmt.Sprintf(client.t("Your stored auto-away setting is: %s"), userPersistentStatusToString(stored)))
451 451
 		if actual && alwaysOn {
452 452
 			service.Notice(rb, client.t("Given current server settings, auto-away is enabled for your client"))
453 453
 		} else if actual && !alwaysOn {
@@ -465,6 +465,15 @@ func displaySetting(service *ircService, settingName string, settings AccountSet
465 465
 	}
466 466
 }
467 467
 
468
+func userPersistentStatusToString(status PersistentStatus) string {
469
+	// #1544: "mandatory" as a user setting should display as "enabled"
470
+	result := persistentStatusToString(status)
471
+	if result == "mandatory" {
472
+		result = "enabled"
473
+	}
474
+	return result
475
+}
476
+
468 477
 func nsSetHandler(service *ircService, server *Server, client *Client, command string, params []string, rb *ResponseBuffer) {
469 478
 	var account string
470 479
 	if command == "saset" {

Chargement…
Annuler
Enregistrer