cozy-sharing 30.3.0 → 30.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [30.3.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@30.3.0...cozy-sharing@30.3.1) (2026-04-24)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **cozy-sharing:** Flatten contact name object in formatRecipients ([c804f59](https://github.com/cozy/cozy-libs/commit/c804f59d87d40cc8a6bfc5e96e88d88a13cbaadb))
11
+
6
12
  # [30.3.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@30.2.2...cozy-sharing@30.3.0) (2026-04-23)
7
13
 
8
14
  ### Features
@@ -68,7 +68,7 @@ export var formatRecipients = function formatRecipients(sharedDriveRecipients) {
68
68
  recipients.push({
69
69
  index: "".concat(RECIPIENT_INDEX_PREFIX).concat(r._id),
70
70
  email: ContactModel.getPrimaryEmail(r),
71
- public_name: r.displayName || r.name,
71
+ public_name: ContactModel.getDisplayName(r),
72
72
  memberIndex: r._id,
73
73
  type: 'two-way',
74
74
  members: r.members
@@ -78,7 +78,7 @@ export var formatRecipients = function formatRecipients(sharedDriveRecipients) {
78
78
  recipients.push({
79
79
  index: "".concat(RECIPIENT_INDEX_PREFIX).concat(r._id),
80
80
  email: ContactModel.getPrimaryEmail(r),
81
- public_name: r.displayName || r.name,
81
+ public_name: ContactModel.getDisplayName(r),
82
82
  memberIndex: r._id,
83
83
  type: 'one-way',
84
84
  members: r.members
@@ -182,6 +182,25 @@ describe('formatRecipients', function () {
182
182
  public_name: 'Bob'
183
183
  });
184
184
  });
185
+ it('should flatten an object-shaped contact name into a string public_name', function () {
186
+ var input = {
187
+ recipients: [{
188
+ _id: '3',
189
+ name: {
190
+ givenName: 'Arya',
191
+ familyName: 'Stark'
192
+ },
193
+ email: [{
194
+ address: 'arya@example.com',
195
+ primary: true
196
+ }]
197
+ }],
198
+ readOnlyRecipients: []
199
+ };
200
+ var result = formatRecipients(input);
201
+ expect(typeof result[0].public_name).toBe('string');
202
+ expect(result[0].public_name).toBe('Arya Stark');
203
+ });
185
204
  it('should sort recipients by public_name', function () {
186
205
  var input = {
187
206
  recipients: [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "30.3.0",
3
+ "version": "30.3.1",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -84,5 +84,5 @@
84
84
  "sideEffects": [
85
85
  "*.css"
86
86
  ],
87
- "gitHead": "8b1c0aece9584d82862592b6ab6e5579fa30be19"
87
+ "gitHead": "8248557488c88af8242923be0f395fb252a57883"
88
88
  }
@@ -73,7 +73,7 @@ export const formatRecipients = sharedDriveRecipients => {
73
73
  recipients.push({
74
74
  index: `${RECIPIENT_INDEX_PREFIX}${r._id}`,
75
75
  email: ContactModel.getPrimaryEmail(r),
76
- public_name: r.displayName || r.name,
76
+ public_name: ContactModel.getDisplayName(r),
77
77
  memberIndex: r._id,
78
78
  type: 'two-way',
79
79
  members: r.members
@@ -84,7 +84,7 @@ export const formatRecipients = sharedDriveRecipients => {
84
84
  recipients.push({
85
85
  index: `${RECIPIENT_INDEX_PREFIX}${r._id}`,
86
86
  email: ContactModel.getPrimaryEmail(r),
87
- public_name: r.displayName || r.name,
87
+ public_name: ContactModel.getDisplayName(r),
88
88
  memberIndex: r._id,
89
89
  type: 'one-way',
90
90
  members: r.members
@@ -138,6 +138,22 @@ describe('formatRecipients', () => {
138
138
  })
139
139
  })
140
140
 
141
+ it('should flatten an object-shaped contact name into a string public_name', () => {
142
+ const input = {
143
+ recipients: [
144
+ {
145
+ _id: '3',
146
+ name: { givenName: 'Arya', familyName: 'Stark' },
147
+ email: [{ address: 'arya@example.com', primary: true }]
148
+ }
149
+ ],
150
+ readOnlyRecipients: []
151
+ }
152
+ const result = formatRecipients(input)
153
+ expect(typeof result[0].public_name).toBe('string')
154
+ expect(result[0].public_name).toBe('Arya Stark')
155
+ })
156
+
141
157
  it('should sort recipients by public_name', () => {
142
158
  const input = {
143
159
  recipients: [