@@ -205,12 +205,14 @@ function updateModNotesBadge ($badge, note) {
205
205
* @param {object } data Data associated with the popup
206
206
* @param {string } data.user Name of the relevant user
207
207
* @param {string } data.subreddit Name of the relevant subreddit
208
+ * @param {string } [data.contextID] Fullname of the item the popup was opened from, used to write note context
208
209
* @param {object[] } [data.notes] Note objects for the user, or null/undefined
209
210
* @returns {jQuery } The created popup
210
211
*/
211
212
function createModNotesPopup ( {
212
213
user,
213
214
subreddit,
215
+ contextID,
214
216
notes,
215
217
defaultTabName,
216
218
defaultNoteLabel,
@@ -274,6 +276,7 @@ function createModNotesPopup ({
274
276
} ) ;
275
277
$popup . attr ( 'data-user' , user ) ;
276
278
$popup . attr ( 'data-subreddit' , subreddit ) ;
279
+ $popup . attr ( 'data-context-id' , contextID ) ;
277
280
278
281
updateModNotesPopup ( $popup , {
279
282
notes,
@@ -462,6 +465,7 @@ export default new Module({
462
465
TBListener . on ( 'author' , async e => {
463
466
const subreddit = e . detail . data . subreddit . name ;
464
467
const author = e . detail . data . author ;
468
+ const contextID = e . detail . data . comment ?. id || e . detail . data . post ?. id ;
465
469
466
470
// Deleted users can't have notes
467
471
if ( author === '[deleted]' ) {
@@ -509,6 +513,7 @@ export default new Module({
509
513
user : author ,
510
514
subreddit,
511
515
notes,
516
+ contextID,
512
517
defaultTabName,
513
518
defaultNoteLabel,
514
519
} )
@@ -551,6 +556,7 @@ export default new Module({
551
556
subreddit : $popup . attr ( 'data-subreddit' ) ,
552
557
note : $textInput . val ( ) ,
553
558
label : $labelSelect . val ( ) || undefined ,
559
+ redditID : $popup . attr ( 'data-context-id' ) ,
554
560
} ) ;
555
561
$textInput . val ( '' ) ;
556
562
textFeedback ( 'Note saved' , FEEDBACK_POSITIVE ) ;
0 commit comments