Merge pull request #4828 from wideserg/patch-1

Update PageCommentsWebPart.ts
This commit is contained in:
Hugo Bernier 2024-03-11 10:46:26 -04:00 committed by GitHub
commit 0336f9671e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 4 deletions

View File

@ -0,0 +1 @@
v16.13.0

View File

@ -72,8 +72,9 @@ None
## Contributors ## Contributors
* [Sudharsan K.](https://github.com/sudharsank)
* [Aimery Thomas](https://github.com/a1mery) * [Aimery Thomas](https://github.com/a1mery)
* [Sergey Shiroky](https://github.com/wideserg)
* [Sudharsan K.](https://github.com/sudharsank)
## Version history ## Version history
@ -83,6 +84,7 @@ Version|Date|Comments
1.1.0.0|Oct 06, 2022|Upgraded to 1.15.2 1.1.0.0|Oct 06, 2022|Upgraded to 1.15.2
1.2.0.0|March 09, 2023|Upgraded to 1.16.1 1.2.0.0|March 09, 2023|Upgraded to 1.16.1
1.3.0.0|June 10, 2023|Upgraded to 1.17.0 1.3.0.0|June 10, 2023|Upgraded to 1.17.0
1.3.0.1|March 11, 2024|`this.pageurl` must be initialized before building `this.pastAtachmentPath`
## Minimal Path to Awesome ## Minimal Path to Awesome
@ -102,7 +104,6 @@ Version|Date|Comments
* Used [jquery-comments](https://viima.github.io/jquery-comments/) for comments control with some customization. * Used [jquery-comments](https://viima.github.io/jquery-comments/) for comments control with some customization.
* Used [Moment.js](https://momentjs.com/) for datetime formatting. * Used [Moment.js](https://momentjs.com/) for datetime formatting.
## Video ## Video
[![Building an enhanced commenting web part with SPFx](./assets/video-thumbnail.jpg)](https://www.youtube.com/watch?v=ndHMdfFscsk "Building an enhanced commenting web part with SPFx") [![Building an enhanced commenting web part with SPFx](./assets/video-thumbnail.jpg)](https://www.youtube.com/watch?v=ndHMdfFscsk "Building an enhanced commenting web part with SPFx")

View File

@ -9,7 +9,7 @@
"This component is developed for the advanced usage of commenting the page or article etc. Page Comments lists will be created to store the comments." "This component is developed for the advanced usage of commenting the page or article etc. Page Comments lists will be created to store the comments."
], ],
"creationDateTime": "2020-02-05", "creationDateTime": "2020-02-05",
"updateDateTime": "2023-06-09", "updateDateTime": "2024-03-11",
"products": [ "products": [
"SharePoint" "SharePoint"
], ],
@ -53,6 +53,11 @@
"gitHubAccount": "a1mery", "gitHubAccount": "a1mery",
"name": "Aimery Thomas", "name": "Aimery Thomas",
"pictureUrl": "https://github.com/a1mery.png" "pictureUrl": "https://github.com/a1mery.png"
},
{
"gitHubAccount": "wideserg",
"name": "Sergey Shiroky",
"pictureUrl": "https://github.com/wideserg.png"
} }
], ],
"references": [ "references": [

View File

@ -93,12 +93,12 @@ export default class PageCommentsWebPart extends BaseClientSideWebPart<IPageComm
</div> </div>
</div>`; </div>`;
var self = this; var self = this;
this.pageurl = this.context.pageContext.legacyPageContext.serverRequestPath;
if (this.properties.enableAttachments) { if (this.properties.enableAttachments) {
await this.helper.getDocLibInfo(); await this.helper.getDocLibInfo();
this.postAttachmentPath = await this.helper.getPostAttachmentFilePath(this.pageurl); this.postAttachmentPath = await this.helper.getPostAttachmentFilePath(this.pageurl);
this.pageFolderExists = await this.helper.checkForPageFolder(this.postAttachmentPath); this.pageFolderExists = await this.helper.checkForPageFolder(this.postAttachmentPath);
} }
this.pageurl = this.context.pageContext.legacyPageContext.serverRequestPath;
this.currentUserInfo = await this.helper.getCurrentUserInfo(); this.currentUserInfo = await this.helper.getCurrentUserInfo();
this.siteUsers = await this.helper.getSiteUsers(self.currentUserInfo.ID); this.siteUsers = await this.helper.getSiteUsers(self.currentUserInfo.ID);
require(['jquery', './js/jquery-comments.min'], (jQuery, comments) => { require(['jquery', './js/jquery-comments.min'], (jQuery, comments) => {