Skip to content

Commit 0ffdcee

Browse files
committed
Merge branch 'release/latest'
2 parents fc0a55b + 5e3ebd6 commit 0ffdcee

File tree

5 files changed

+47
-21
lines changed

5 files changed

+47
-21
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/mgt",
3-
"version": "1.2.3",
3+
"version": "1.2.4",
44
"description": "The Microsoft Graph Toolkit",
55
"keywords": [
66
"microsoft graph",

src/components/mgt-get/mgt-get.ts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export class MgtGet extends MgtTemplatedComponent {
140140
* trigger the element to update.
141141
*/
142142
protected render() {
143-
if (this.isLoadingState) {
143+
if (this.isLoadingState && !this.isPolling) {
144144
return this.renderTemplate('loading', null);
145145
} else if (this.error) {
146146
return this.renderTemplate('error', this.error);
@@ -179,8 +179,6 @@ export class MgtGet extends MgtTemplatedComponent {
179179
}
180180
} else if (this.response) {
181181
return this.renderTemplate('default', this.response) || html``;
182-
} else if (this.isLoadingState) {
183-
return this.renderTemplate('loading', null) || html``;
184182
} else {
185183
return html``;
186184
}
@@ -205,12 +203,14 @@ export class MgtGet extends MgtTemplatedComponent {
205203
if (this.resource) {
206204
try {
207205
let uri = this.resource;
208-
let delta = false;
206+
let isDeltaLink = false;
209207

210208
// if we had a response earlier with a delta link, use it instead
211209
if (this.response && this.response['@odata.deltaLink']) {
212210
uri = this.response['@odata.deltaLink'];
213-
delta = true;
211+
isDeltaLink = true;
212+
} else {
213+
isDeltaLink = new URL(uri, 'https://graph.microsoft.com').pathname.endsWith('delta');
214214
}
215215

216216
const graph = provider.graph.forComponent(this);
@@ -220,23 +220,23 @@ export class MgtGet extends MgtTemplatedComponent {
220220
request = request.middlewareOptions(prepScopes(...this.scopes));
221221
}
222222

223-
const response = await request.get();
223+
let response = await request.get();
224224

225-
if (delta && this.response && Array.isArray(this.response.value) && Array.isArray(response.value)) {
225+
if (isDeltaLink && this.response && Array.isArray(this.response.value) && Array.isArray(response.value)) {
226226
response.value = this.response.value.concat(response.value);
227227
}
228228

229-
if (!equals(this.response, response)) {
229+
if (!this.isPolling && !equals(this.response, response)) {
230230
this.response = response;
231231
}
232232

233233
// get more pages if there are available
234-
if (this.response && Array.isArray(this.response.value) && this.response['@odata.nextLink']) {
234+
if (response && Array.isArray(response.value) && response['@odata.nextLink']) {
235235
let pageCount = 1;
236-
let page = this.response;
236+
let page = response;
237237

238238
while (
239-
(pageCount < this.maxPages || this.maxPages <= 0 || this.pollingRate) &&
239+
(pageCount < this.maxPages || this.maxPages <= 0 || (isDeltaLink && this.pollingRate)) &&
240240
page &&
241241
page['@odata.nextLink']
242242
) {
@@ -247,11 +247,18 @@ export class MgtGet extends MgtTemplatedComponent {
247247
.version(this.version)
248248
.get();
249249
if (page && page.value && page.value.length) {
250-
page.value = this.response.value.concat(page.value);
251-
this.response = page;
250+
page.value = response.value.concat(page.value);
251+
response = page;
252+
if (!this.isPolling) {
253+
this.response = response;
254+
}
252255
}
253256
}
254257
}
258+
259+
if (!equals(this.response, response)) {
260+
this.response = response;
261+
}
255262
} catch (e) {
256263
this.error = e;
257264
}

src/components/mgt-person/mgt-person.scss

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,24 @@ mgt-person .user-avatar {
7474
border-radius: 50%;
7575
font-weight: 400;
7676

77-
& .initials-text {
77+
& .initials-text,
78+
& .ms-Icon {
7879
cursor: default;
7980
margin-top: -1px;
8081
font-size: calc(var(--avatar-size, 48px) * 0.4);
8182
}
83+
84+
& .ms-Icon {
85+
display: inline;
86+
}
8287
}
8388

8489
&.small {
8590
width: $avatar-size-s;
8691
height: $avatar-size-s;
8792

88-
& .initials-text {
93+
& .initials-text,
94+
& .ms-Icon {
8995
font-size: calc(var(--avatar-size-s, 24px) * 0.4);
9096
}
9197
}

src/components/mgt-person/mgt-person.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ export class MgtPerson extends MgtTemplatedComponent {
296296
this.personDetails && this.personCardInteraction === PersonCardInteraction.none
297297
? this.personDetails.displayName
298298
: '';
299+
299300
const isLarge = this.showEmail && this.showName;
300301
const imageClasses = {
301302
initials: !imageSrc,
@@ -305,19 +306,31 @@ export class MgtPerson extends MgtTemplatedComponent {
305306
};
306307

307308
let imageHtml: TemplateResult;
309+
308310
if (imageSrc) {
309311
// render the image
310312
imageHtml = html`
311313
<img alt=${title} src=${imageSrc} />
312314
`;
313315
} else if (this.personDetails) {
314-
// render the initials
315-
const initials = this.getInitials(this.personDetails);
316+
// render the initials or person icon
317+
316318
// add avatar background color
317319
imageClasses[this._personAvatarBg] = true;
320+
321+
const initials = this.getInitials(this.personDetails);
322+
const initialsHtml =
323+
initials && initials.length
324+
? html`
325+
${initials}
326+
`
327+
: html`
328+
<i class="ms-Icon ms-Icon--Contact"></i>
329+
`;
330+
318331
imageHtml = html`
319332
<span class="initials-text" aria-label="${initials}">
320-
${initials}
333+
${initialsHtml}
321334
</span>
322335
`;
323336
} else {
@@ -518,7 +531,7 @@ export class MgtPerson extends MgtTemplatedComponent {
518531
if (!initials && person.displayName) {
519532
const name = person.displayName.split(/\s+/);
520533
for (let i = 0; i < 2 && i < name.length; i++) {
521-
if (name[i][0] && name[i][0].match(/[a-z]/i)) {
534+
if (name[i][0] && name[i][0].match(/\p{L}/gu)) {
522535
// check if letter
523536
initials += name[i][0].toUpperCase();
524537
}

src/utils/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
// THIS FILE IS AUTO GENERATED
99
// ANY CHANGES WILL BE LOST DURING BUILD
1010

11-
export const PACKAGE_VERSION = '1.2.3';
11+
export const PACKAGE_VERSION = '1.2.4';

0 commit comments

Comments
 (0)