Skip to content

Commit

Permalink
fix: Use right strings in disk quota notification (#4071)
Browse files Browse the repository at this point in the history
Based on a misunderstanding, we were sending a push notification when
reaching 90% of the disk quota (i.e. the `capsize`) with a message
intended for a fully reached quota.

However, there are 2 things to note:
1. there are no notifications when reaching 100% of the disk quota (so
the term "exceeded" in the existing notification refers to the capsize
or 90% of the disk quota)
2. because the disk quota can never be reached from below since
`cozy-stack` will refuse the upload if it would mean reaching the quota

Therefore, we can completely remove strings related to an hypothetical
reached disk quota notification and always use those of the reached
capsize.
  • Loading branch information
taratatach authored Jul 27, 2023
2 parents 6ed49a5 + f3b6e9f commit 08d15ee
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 44 deletions.
6 changes: 0 additions & 6 deletions assets/locales/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -847,12 +847,6 @@ msgstr "You've reached 90% of your storage"
msgid "Notifications Disk Quota Close Message"
msgstr "You are using over 90% of your storage. Please delete files, or upgrade your offer to get more space."

msgid "Notifications Disk Quota Reached Title"
msgstr "Your Cozy is full"

msgid "Notifications Disk Quota Reached Message"
msgstr "You've reached the limit of your storage. Please delete files, or upgrade your offer to get more space."

msgid "Notifications Disk Quota Subject"
msgstr "Du hast mitterweile 90% deines Speicherplatzes gefüllt. "

Expand Down
6 changes: 0 additions & 6 deletions assets/locales/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -1126,12 +1126,6 @@ msgstr "You've reached 90% of your storage"
msgid "Notifications Disk Quota Close Message"
msgstr "You are using over 90% of your storage. Please delete files, or upgrade your offer to get more space."

msgid "Notifications Disk Quota Reached Title"
msgstr "Your Cozy is full"

msgid "Notifications Disk Quota Reached Message"
msgstr "You've reached the limit of your storage. Please delete files, or upgrade your offer to get more space."

msgid "Notifications Disk Quota Subject"
msgstr "You have currently reached 90% of your space."

Expand Down
6 changes: 0 additions & 6 deletions assets/locales/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -861,12 +861,6 @@ msgstr "You've reached 90% of your storage"
msgid "Notifications Disk Quota Close Message"
msgstr "You are using over 90% of your storage. Please delete files, or upgrade your offer to get more space."

msgid "Notifications Disk Quota Reached Title"
msgstr "Your Cozy is full"

msgid "Notifications Disk Quota Reached Message"
msgstr "You've reached the limit of your storage. Please delete files, or upgrade your offer to get more space."

msgid "Notifications Disk Quota Subject"
msgstr "Usted ha alcanzado el 90% de su espacio Cozy."

Expand Down
6 changes: 0 additions & 6 deletions assets/locales/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -1231,12 +1231,6 @@ msgstr "Quota de stockage supérieur à 90%"
msgid "Notifications Disk Quota Close Message"
msgstr "Supprimez des fichiers ou changez d'offre pour obtenir plus d'espace de stockage."

msgid "Notifications Disk Quota Reached Title"
msgstr "Le stockage de votre Cozy est plein"

msgid "Notifications Disk Quota Reached Message"
msgstr "Supprimez des fichiers ou changez d'offre pour obtenir plus d'espace de stockage."

msgid "Notifications Disk Quota Subject"
msgstr "Vous avez atteint 90% de votre espace de stockage."

Expand Down
6 changes: 0 additions & 6 deletions assets/locales/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -669,12 +669,6 @@ msgstr "You've reached 90% of your storage"
msgid "Notifications Disk Quota Close Message"
msgstr "You are using over 90% of your storage. Please delete files, or upgrade your offer to get more space."

msgid "Notifications Disk Quota Reached Title"
msgstr "Your Cozy is full"

msgid "Notifications Disk Quota Reached Message"
msgstr "You've reached the limit of your storage. Please delete files, or upgrade your offer to get more space."

msgid "Notifications Disk Quota Subject"
msgstr "現在、容量が 90% に達しています。"

Expand Down
6 changes: 0 additions & 6 deletions assets/locales/nl_NL.po
Original file line number Diff line number Diff line change
Expand Up @@ -1045,12 +1045,6 @@ msgstr "You've reached 90% of your storage"
msgid "Notifications Disk Quota Close Message"
msgstr "You are using over 90% of your storage. Please delete files, or upgrade your offer to get more space."

msgid "Notifications Disk Quota Reached Title"
msgstr "Your Cozy is full"

msgid "Notifications Disk Quota Reached Message"
msgstr "You've reached the limit of your storage. Please delete files, or upgrade your offer to get more space."

msgid "Notifications Disk Quota Subject"
msgstr "Je hebt momenteel 90% van je beschikbare opslagruimte verbruikt."

Expand Down
10 changes: 2 additions & 8 deletions model/notification/center/notification_center.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,26 @@ var (
)

func init() {
vfs.RegisterDiskQuotaAlertCallback(func(domain string, exceeded bool) {
vfs.RegisterDiskQuotaAlertCallback(func(domain string, capsizeExceeded bool) {
i, err := lifecycle.GetInstance(domain)
if err != nil {
return
}

title := i.Translate("Notifications Disk Quota Close Title")
message := i.Translate("Notifications Disk Quota Close Message")
if exceeded {
title = i.Translate("Notifications Disk Quota Reached Title")
message = i.Translate("Notifications Disk Quota Reached Message")
}

offersLink, err := i.ManagerURL(instance.ManagerPremiumURL)
if err != nil {
return
}
cozyDriveLink := i.SubDomain(consts.DriveSlug)

redirectLink := consts.SettingsSlug + "/#/storage"

n := &notification.Notification{
Title: title,
Message: message,
Slug: consts.SettingsSlug,
State: exceeded,
State: capsizeExceeded,
Data: map[string]interface{}{
// For email notification
"OffersLink": offersLink,
Expand Down

0 comments on commit 08d15ee

Please sign in to comment.