1 | import { _ClientsidePage } from "../clientside-pages/types.js";
|
2 | import { Item } from "../items/index.js";
|
3 | import { spPost } from "../operations.js";
|
4 | import { SPQueryable } from "../spqueryable.js";
|
5 | _ClientsidePage.prototype.addComment = async function (info) {
|
6 | const item = await this.getItem();
|
7 | return item.comments.add(info);
|
8 | };
|
9 | _ClientsidePage.prototype.getCommentById = async function (id) {
|
10 | const item = await this.getItem();
|
11 | const data = await item.comments.getById(id)();
|
12 | return Object.assign(item.comments.getById(id), data);
|
13 | };
|
14 | _ClientsidePage.prototype.clearComments = async function () {
|
15 | const item = await this.getItem();
|
16 | return item.comments.clear();
|
17 | };
|
18 | _ClientsidePage.prototype.getComments = async function () {
|
19 | const item = await this.getItem();
|
20 | return item.comments();
|
21 | };
|
22 | _ClientsidePage.prototype.like = async function () {
|
23 | const item = await this.getItem("ID");
|
24 | return spPost(SPQueryable(item, "like"));
|
25 | };
|
26 | _ClientsidePage.prototype.unlike = async function () {
|
27 | const item = await this.getItem("ID");
|
28 | return spPost(SPQueryable(item, "unlike"));
|
29 | };
|
30 | _ClientsidePage.prototype.getLikedByInformation = async function () {
|
31 | const item = await this.getItem("ID");
|
32 | return item.getLikedByInformation();
|
33 | };
|
34 | _ClientsidePage.prototype.enableComments = async function () {
|
35 | return this.setCommentsOn(true).then(r => {
|
36 | this.commentsDisabled = false;
|
37 | return r;
|
38 | });
|
39 | };
|
40 | _ClientsidePage.prototype.disableComments = async function () {
|
41 | return this.setCommentsOn(false).then(r => {
|
42 | this.commentsDisabled = true;
|
43 | return r;
|
44 | });
|
45 | };
|
46 | _ClientsidePage.prototype.setCommentsOn = async function (on) {
|
47 | const item = await this.getItem();
|
48 | return Item(item, `SetCommentsDisabled(${!on})`).update({});
|
49 | };
|
50 |
|
\ | No newline at end of file |