Skip to content

Commit 6da83e8

Browse files
committed
DOC-3174: Remove usage of uid in suggestededits
1 parent da9ae91 commit 6da83e8

File tree

3 files changed

+32
-24
lines changed

3 files changed

+32
-24
lines changed

modules/ROOT/examples/live-demos/suggestededits-access/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
/** Fake user database */
22
const userinfos = {
33
adamhenderson: {
4-
uid: 'adamhenderson',
4+
id: 'adamhenderson',
55
name: 'Adam Henderson',
66
avatar: `https://randomuser.me/api/portraits/men/1.jpg`,
77
},
88
michaelcook: {
9-
uid: 'michaelcook',
9+
id: 'michaelcook',
1010
name: 'Michael Cook',
1111
avatar: `https://randomuser.me/api/portraits/men/2.jpg`,
1212
},
1313
kalebwilson: {
14-
uid: 'kalebwilson',
14+
id: 'kalebwilson',
1515
name: 'Kaleb Wilson',
1616
avatar: `https://randomuser.me/api/portraits/men/3.jpg`,
1717
},
1818
kyleeinstein: {
19-
uid: 'kyleeinstein',
19+
id: 'kyleeinstein',
2020
name: 'Kyle Einstein',
2121
avatar: `https://randomuser.me/api/portraits/men/4.jpg`,
2222
},
Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,46 @@
11
/** Fake user database */
22
const userinfos = {
33
adamhenderson: {
4-
uid: 'adamhenderson',
4+
id: 'adamhenderson',
55
name: 'Adam Henderson',
66
avatar: `https://randomuser.me/api/portraits/men/1.jpg`,
77
},
88
michaelcook: {
9-
uid: 'michaelcook',
9+
id: 'michaelcook',
1010
name: 'Michael Cook',
1111
avatar: `https://randomuser.me/api/portraits/men/2.jpg`,
1212
},
1313
kalebwilson: {
14-
uid: 'kalebwilson',
14+
id: 'kalebwilson',
1515
name: 'Kaleb Wilson',
1616
avatar: `https://randomuser.me/api/portraits/men/3.jpg`,
1717
},
1818
kyleeinstein: {
19-
uid: 'kyleeinstein',
19+
id: 'kyleeinstein',
2020
name: 'Kyle Einstein',
2121
avatar: `https://randomuser.me/api/portraits/men/4.jpg`,
2222
},
2323
};
2424

25-
const trackchanges_user_lookup = (uid) => new Promise((resolve, reject) =>
26-
setTimeout(() => userinfos[uid] ? resolve(userinfos[uid]) : reject(), 1000));
25+
const fetch_users = (ids) => {
26+
return new Promise((resolve, reject) => {
27+
const users = ids.map(id => userinfos[id]);
28+
if (users.length > 0) {
29+
resolve(users);
30+
} else {
31+
reject(new Error('No users found'));
32+
}
33+
});
34+
}
2735

2836
tinymce.init({
29-
selector: 'textarea#trackchanges_suggestions',
37+
selector: 'textarea#suggestededits_suggestions',
3038
height: 500,
31-
plugins: 'trackchanges',
32-
toolbar: 'trackchanges',
39+
plugins: 'suggestededits',
40+
toolbar: 'suggestededits',
3341
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }',
34-
trackchanges_uid: 'adamhenderson',
35-
trackchanges_access: 'suggest', //change this value to set permission to the Suggested Edits view
42+
user_id: 'adamhenderson',
43+
suggestededits_access: 'feedback', //change this value to set permission to the Suggested Edits view
3644
readonly: false, //set to true to restrict a user's editing permission
37-
trackchanges_user_lookup
45+
fetch_users
3846
});

modules/ROOT/examples/live-demos/suggestededits/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const model = {
5656
"_opData": {
5757
"id": 1,
5858
"type": "insert",
59-
"uid": "adamhenderson",
59+
"id": "adamhenderson",
6060
"timestamp": 1749214950000
6161
}
6262
},
@@ -79,7 +79,7 @@ const model = {
7979
"_opData": {
8080
"id": 3,
8181
"type": "insert",
82-
"uid": "adamhenderson",
82+
"id": "adamhenderson",
8383
"timestamp": 1749215051000
8484
}
8585
},
@@ -88,7 +88,7 @@ const model = {
8888
"_opData": {
8989
"id": 2,
9090
"type": "remove",
91-
"uid": "adamhenderson",
91+
"id": "adamhenderson",
9292
"timestamp": 1749215053000
9393
}
9494
},
@@ -100,7 +100,7 @@ const model = {
100100
"_opData": {
101101
"id": 4,
102102
"type": "remove",
103-
"uid": "adamhenderson",
103+
"id": "adamhenderson",
104104
"timestamp": 1749215055000
105105
}
106106
},
@@ -109,7 +109,7 @@ const model = {
109109
"_opData": {
110110
"id": 4,
111111
"type": "insert",
112-
"uid": "adamhenderson",
112+
"id": "adamhenderson",
113113
"timestamp": 1749215055000
114114
}
115115
},
@@ -121,7 +121,7 @@ const model = {
121121
"_opData": {
122122
"id": 5,
123123
"type": "insert",
124-
"uid": "adamhenderson",
124+
"id": "adamhenderson",
125125
"timestamp": 1749215056000
126126
}
127127
},
@@ -133,7 +133,7 @@ const model = {
133133
"_opData": {
134134
"id": 6,
135135
"type": "remove",
136-
"uid": "adamhenderson",
136+
"id": "adamhenderson",
137137
"timestamp": 1749215060000
138138
}
139139
},
@@ -145,7 +145,7 @@ const model = {
145145
"_opData": {
146146
"id": 7,
147147
"type": "insert",
148-
"uid": "adamhenderson",
148+
"id": "adamhenderson",
149149
"timestamp": 1749215064000
150150
}
151151
},

0 commit comments

Comments
 (0)