Skip to content

Commit f0774ed

Browse files
authored
Merge pull request #417 from Sanofi-IADC/bugfix/correct-url-avatar-blog
fix: avatar in blog post page with bad url
2 parents 4d2dbc4 + 3998337 commit f0774ed

File tree

4 files changed

+24
-38
lines changed

4 files changed

+24
-38
lines changed

src/context/context.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ export interface User {
99
displayName: string;
1010
email: string;
1111
profilePicture: string;
12-
}
12+
}

src/context/context.service.ts

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ export class ContextService {
6868
this.setHtmlBody(data.body.view.value, loadAsDocument);
6969
this.setAuthor(data.history.createdBy.displayName);
7070
this.setEmail(data.history.createdBy.email);
71-
this.setAvatar(`${baseHost}${basePath}/${data.history.createdBy.profilePicture.path.replace(/^\/wiki/,'wiki')}`)
71+
this.setAvatar(
72+
`${baseHost}${basePath}/${data.history.createdBy.profilePicture.path.replace(
73+
/^\/wiki/,
74+
'wiki',
75+
)}`,
76+
);
7277
this.setWhen(data.history.createdDate);
7378
this.setLabels(data.metadata.labels.results);
7479

@@ -79,9 +84,9 @@ export class ContextService {
7984
modificationBy: {
8085
displayName: data.history.createdBy.displayName,
8186
email: data.history.createdBy.email,
82-
profilePicture: this.getAvatar()
83-
}
84-
}
87+
profilePicture: this.getAvatar(),
88+
},
89+
};
8590
this.setCreatedVersion(createdBy);
8691

8792
const modifiedBy: Version = {
@@ -91,10 +96,13 @@ export class ContextService {
9196
modificationBy: {
9297
displayName: data.version.by.publicName,
9398
email: data.version.by.email,
94-
profilePicture: `${baseHost}${basePath}/${data.version.by.profilePicture?.path.replace(/^\/wiki/,'wiki')}`,
95-
}
96-
}
97-
this.setlastVersion(modifiedBy);
99+
profilePicture: `${baseHost}${basePath}/${data.version.by.profilePicture?.path.replace(
100+
/^\/wiki/,
101+
'wiki',
102+
)}`,
103+
},
104+
};
105+
this.setLastVersion(modifiedBy);
98106

99107
if (
100108
data.metadata?.properties['content-appearance-published'] &&
@@ -146,14 +154,6 @@ export class ContextService {
146154
this.title = title;
147155
}
148156

149-
// getVersion(): Version {
150-
// return this.version;
151-
// }
152-
153-
// setVersion(version: Version): void {
154-
// this.version = version;
155-
// }
156-
157157
getCreatedVersion(): Version {
158158
return this.createdVersion;
159159
}
@@ -162,30 +162,14 @@ export class ContextService {
162162
this.createdVersion = version;
163163
}
164164

165-
getlastVersion(): Version {
165+
getLastVersion(): Version {
166166
return this.lastVersion;
167167
}
168168

169-
setlastVersion(version: Version): void {
169+
setLastVersion(version: Version): void {
170170
this.lastVersion = version;
171171
}
172172

173-
// getCreatedBy(): Update {
174-
// return this.createdBy;
175-
// }
176-
177-
// setCreatedBy(createdBy: Update): void {
178-
// this.createdBy = createdBy;
179-
// }
180-
181-
// getModifiedBy(): Update {
182-
// return this.modifiedBy;
183-
// }
184-
185-
// setModifiedBy(modifiedBy: Update): void {
186-
// this.modifiedBy = modifiedBy;
187-
// }
188-
189173
getCheerioBody(): cheerio.CheerioAPI {
190174
return this.cheerioBody;
191175
}

src/proxy-page/steps/addHeaderBlog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default (): Step => {
2626
${context.getTitle()}
2727
</div>
2828
<div>
29-
<img class="userLogo logo" src="/cpv${context.getAvatar()}">
29+
<img class="userLogo logo" src="${context.getAvatar()}">
3030
<div class="blog--vCard">
3131
<div class="blog--when">${context.getFriendlyWhen()}${context.getReadTime()} min read</div>
3232
<div>${context.getAuthor()}</div>

src/proxy-page/steps/addLibrariesJS.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ export default (): Step => {
4343
konviwPageId: '${context.getPageId()}',
4444
konviwTitle: '${context.getTitle()}',
4545
konviwExcerpt: '${context.getExcerpt()}',
46-
konviwCreatedVersion: '${JSON.stringify(context.getCreatedVersion())}',
47-
konviwLastVersion: '${JSON.stringify(context.getlastVersion())}',
46+
konviwCreatedVersion: '${JSON.stringify(
47+
context.getCreatedVersion(),
48+
)}',
49+
konviwLastVersion: '${JSON.stringify(context.getLastVersion())}',
4850
labels: '${JSON.stringify(context.getLabels())}',
4951
readTime: '${context.getReadTime()}',
5052
}

0 commit comments

Comments
 (0)