Skip to content

Commit 7daaf58

Browse files
authored
Update wording for sharing emails (#4494)
2 parents 1fd2613 + 16fa224 commit 7daaf58

File tree

7 files changed

+460
-386
lines changed

7 files changed

+460
-386
lines changed

assets/locales/en.po

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ msgstr "Shared by"
264264

265265
msgid "Authorize Sharing Description start"
266266
msgstr ""
267-
"%s and you can collaborate by editing the %s. "
267+
"%s and you can collaborate by editing %s. "
268268
"Each change will be sent automatically between your Cozys."
269269

270270
msgid "Authorize Sharing Description end"
@@ -1030,22 +1030,22 @@ msgid "Mail New Registration Revoke text"
10301030
msgstr "Revoke this device"
10311031

10321032
msgid "Mail Sharing Request Subject"
1033-
msgstr "New sharing from %s"
1033+
msgstr "%s has shared %s with you"
10341034

10351035
msgid "Mail Sharing Request Intro"
10361036
msgstr "Hello,"
10371037

10381038
msgid "Mail Sharing Request Description"
1039-
msgstr "%s (%s) invites you to %s the %s **%s** on their personal space, Cozy."
1039+
msgstr "%s (%s) invites you to %s %s **%s** from their personal space, Cozy."
10401040

10411041
msgid "Mail Sharing Request Action Read"
1042-
msgstr "access"
1042+
msgstr "view"
10431043

10441044
msgid "Mail Sharing Request Action Write"
1045-
msgstr "update"
1045+
msgstr "edit"
10461046

10471047
msgid "Mail Sharing Request Button text"
1048-
msgstr "Access to this %s"
1048+
msgstr "View %s"
10491049

10501050
msgid "Mail Sharing Member To Confirm Subject"
10511051
msgstr "Confirmation required to finalize the sharing of your passwords"
@@ -1080,25 +1080,40 @@ msgid "Mail Support Confirmation Signature"
10801080
msgstr "Claude - Customer Service at Cozy Cloud"
10811081

10821082
msgid "Notification Sharing Subject"
1083-
msgstr "A new sharing is available in your Cozy"
1083+
msgstr "%s has shared %s with you"
10841084

10851085
msgid "Notification Sharing Description"
1086-
msgstr "%s invites you to %s the %s %s"
1086+
msgstr "%s invites you to %s the %s **%s**"
10871087

10881088
msgid "Notification Sharing Type Organization"
10891089
msgstr "folder of passwords"
10901090

1091+
msgid "Notification Sharing Title Document"
1092+
msgstr "a document"
1093+
1094+
msgid "Notification Sharing Title Directory"
1095+
msgstr "a directory"
1096+
1097+
msgid "Notification Sharing Title File"
1098+
msgstr "a file"
1099+
1100+
msgid "Notification Sharing Title Note"
1101+
msgstr "a note"
1102+
10911103
msgid "Notification Sharing Type Document"
1092-
msgstr "document"
1104+
msgstr "the document"
10931105

10941106
msgid "Notification Sharing Type Directory"
1095-
msgstr "directory"
1107+
msgstr "the directory"
10961108

10971109
msgid "Notification Sharing Type File"
1098-
msgstr "file"
1110+
msgstr "the file"
1111+
1112+
msgid "Notification Sharing Type Note"
1113+
msgstr "the note"
10991114

11001115
msgid "Notification Sharing Button text"
1101-
msgstr "See the sharing"
1116+
msgstr "See %s"
11021117

11031118
msgid "Sharing Connect to Cozy"
11041119
msgstr "Connect to your Cozy"

assets/locales/fr.po

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ msgstr "Partagé par"
307307

308308
msgid "Authorize Sharing Description start"
309309
msgstr ""
310-
"%s et vous pouvez collaborer en modifiant le %s. Chaque modification sera "
310+
"%s et vous pouvez collaborer en modifiant %s. Chaque modification sera "
311311
"transmise automatiquement entre vos Cozy."
312312

313313
msgid "Authorize Sharing Description end"
@@ -1131,22 +1131,22 @@ msgid "Mail New Registration Revoke text"
11311131
msgstr "Révoquer cet appareil"
11321132

11331133
msgid "Mail Sharing Request Subject"
1134-
msgstr "Accepter le partage de %s ?"
1134+
msgstr "%s a partagé %s avec vous"
11351135

11361136
msgid "Mail Sharing Request Intro"
11371137
msgstr "Bonjour,"
11381138

11391139
msgid "Mail Sharing Request Description"
1140-
msgstr "%s (%s) vous invite à %s le %s **%s** sur son espace personnel, Cozy."
1140+
msgstr "%s (%s) vous invite à %s %s **%s** depuis son espace personnel, Cozy."
11411141

11421142
msgid "Mail Sharing Request Action Read"
1143-
msgstr "consulter"
1143+
msgstr "voir"
11441144

11451145
msgid "Mail Sharing Request Action Write"
11461146
msgstr "modifier"
11471147

11481148
msgid "Mail Sharing Request Button text"
1149-
msgstr "Accéder au %s"
1149+
msgstr "Voir %s"
11501150

11511151
msgid "Mail Sharing Member To Confirm Subject"
11521152
msgstr "Vérification demandée pour finaliser le partage de vos mot de passe"
@@ -1183,25 +1183,40 @@ msgid "Mail Support Confirmation Signature"
11831183
msgstr "Claude - Service Client chez Cozy Cloud"
11841184

11851185
msgid "Notification Sharing Subject"
1186-
msgstr "Vous avez un nouveau partage disponible dans votre Cozy"
1186+
msgstr "%s a partagé %s avec vous"
11871187

11881188
msgid "Notification Sharing Description"
1189-
msgstr "%s vous invite à %s le %s %s"
1189+
msgstr "%s vous invite à %s le %s **%s**"
11901190

11911191
msgid "Notification Sharing Type Organization"
11921192
msgstr "dossier partagé de mots de passe"
11931193

1194+
msgid "Notification Sharing Title Document"
1195+
msgstr "un document"
1196+
1197+
msgid "Notification Sharing Title Directory"
1198+
msgstr "un répertoire"
1199+
1200+
msgid "Notification Sharing Title File"
1201+
msgstr "un fichier"
1202+
1203+
msgid "Notification Sharing Title Note"
1204+
msgstr "une note"
1205+
11941206
msgid "Notification Sharing Type Document"
1195-
msgstr "document"
1207+
msgstr "le document"
11961208

11971209
msgid "Notification Sharing Type Directory"
1198-
msgstr "répertoire"
1210+
msgstr "le répertoire"
11991211

12001212
msgid "Notification Sharing Type File"
1201-
msgstr "fichier"
1213+
msgstr "le fichier"
1214+
1215+
msgid "Notification Sharing Type Note"
1216+
msgstr "la note"
12021217

12031218
msgid "Notification Sharing Button text"
1204-
msgstr "Voir le partage"
1219+
msgstr "Voir %s"
12051220

12061221
msgid "Sharing Connect to Cozy"
12071222
msgstr "Renseignez l'adresse de votre Cozy"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{{define "content"}}
22
<mj-text mj-class="title content-medium">
33
<img src="https://files.cozycloud.cc/email-assets/stack/icon-share.png" width="16" height="16" style="vertical-align:sub;"/>&nbsp;
4-
{{t "Notification Sharing Subject"}}
4+
{{t "Notification Sharing Subject" .SharerPublicName .TargetType}}
55
</mj-text>
66
<mj-text mj-class="content-medium">
7-
{{t "Notification Sharing Description" .SharerPublicName .Action .TargetType .TargetName}}
7+
{{tHTML "Notification Sharing Description" .SharerPublicName .Action .TargetType .TargetName}}
88
</mj-text>
99
<mj-button href="{{.SharingLink}}" align="left" mj-class="primary-button content-xlarge">
10-
{{t "Notification Sharing Button text"}}
10+
{{t "Notification Sharing Button text" .TargetType}}
1111
</mj-button>
1212
{{end}}

assets/mails/sharing_request.mjml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{define "content"}}
22
<mj-text mj-class="title content-medium">
33
<img src="https://files.cozycloud.cc/email-assets/stack/icon-share.png" width="16" height="16" style="vertical-align:sub;"/>&nbsp;
4-
{{t "Mail Sharing Request Subject" .SharerPublicName}}
4+
{{t "Mail Sharing Request Subject" .SharerPublicName .DocType}}
55
</mj-text>
66
<mj-text mj-class="content-medium">
77
{{t "Mail Sharing Request Intro"}}

model/sharing/invitation.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"net/url"
77
"runtime/debug"
8+
"strings"
89
"time"
910

1011
"github.com/cozy/cozy-stack/model/instance"
@@ -189,12 +190,14 @@ func (m *Member) SendMail(inst *instance.Instance, s *Sharing, sharer, descripti
189190
} else {
190191
action = inst.Translate("Mail Sharing Request Action Write")
191192
}
193+
titleType := getDocumentTitleType(inst, s)
192194
docType := getDocumentType(inst, s)
193195
mailValues := map[string]interface{}{
194196
"SharerPublicName": sharer,
195197
"SharerEmail": sharerMail,
196198
"Action": action,
197199
"Description": description,
200+
"TitleType": titleType,
198201
"DocType": docType,
199202
"SharingLink": link,
200203
}
@@ -216,6 +219,24 @@ func (m *Member) SendMail(inst *instance.Instance, s *Sharing, sharer, descripti
216219
return err
217220
}
218221

222+
func getDocumentTitleType(inst *instance.Instance, s *Sharing) string {
223+
rule := s.FirstFilesRule()
224+
if rule == nil {
225+
if len(s.Rules) > 0 && s.Rules[0].DocType == consts.BitwardenOrganizations {
226+
return inst.Translate("Notification Sharing Title Organization")
227+
}
228+
return inst.Translate("Notification Sharing Title Document")
229+
}
230+
_, err := inst.VFS().FileByID(rule.Values[0])
231+
if err != nil {
232+
return inst.Translate("Notification Sharing Title Directory")
233+
}
234+
if strings.HasSuffix(s.Description, ".cozy-note") {
235+
return inst.Translate("Notification Sharing Title Note")
236+
}
237+
return inst.Translate("Notification Sharing Title File")
238+
}
239+
219240
func getDocumentType(inst *instance.Instance, s *Sharing) string {
220241
rule := s.FirstFilesRule()
221242
if rule == nil {
@@ -228,6 +249,9 @@ func getDocumentType(inst *instance.Instance, s *Sharing) string {
228249
if err != nil {
229250
return inst.Translate("Notification Sharing Type Directory")
230251
}
252+
if strings.HasSuffix(s.Description, ".cozy-note") {
253+
return inst.Translate("Notification Sharing Type Note")
254+
}
231255
return inst.Translate("Notification Sharing Type File")
232256
}
233257

@@ -342,10 +366,12 @@ func (s *Sharing) SendShortcutMail(inst *instance.Instance, fileDoc *vfs.FileDoc
342366
} else {
343367
action = inst.Translate("Mail Sharing Request Action Write")
344368
}
369+
titleType := getTargetTitleType(inst, fileDoc.Metadata)
345370
targetType := getTargetType(inst, fileDoc.Metadata)
346371
mailValues := map[string]interface{}{
347372
"SharerPublicName": sharerName,
348373
"Action": action,
374+
"TitleType": titleType,
349375
"TargetType": targetType,
350376
"TargetName": s.Description,
351377
"SharingLink": previewURL,
@@ -366,11 +392,28 @@ func (s *Sharing) SendShortcutMail(inst *instance.Instance, fileDoc *vfs.FileDoc
366392
return err
367393
}
368394

395+
func getTargetTitleType(inst *instance.Instance, metadata map[string]interface{}) string {
396+
target, _ := metadata["target"].(map[string]interface{})
397+
if target["_type"] != consts.Files {
398+
return inst.Translate("Notification Sharing Title Document")
399+
}
400+
if target["mime"] == consts.NoteMimeType {
401+
return inst.Translate("Notification Sharing Title Note")
402+
}
403+
if target["mime"] == nil || target["mime"] == "" {
404+
return inst.Translate("Notification Sharing Title Directory")
405+
}
406+
return inst.Translate("Notification Sharing Title File")
407+
}
408+
369409
func getTargetType(inst *instance.Instance, metadata map[string]interface{}) string {
370410
target, _ := metadata["target"].(map[string]interface{})
371411
if target["_type"] != consts.Files {
372412
return inst.Translate("Notification Sharing Type Document")
373413
}
414+
if target["mime"] == consts.NoteMimeType {
415+
return inst.Translate("Notification Sharing Type Note")
416+
}
374417
if target["mime"] == nil || target["mime"] == "" {
375418
return inst.Translate("Notification Sharing Type Directory")
376419
}

0 commit comments

Comments
 (0)