const getIsNoteLiked = ( notesState, note ) => { const noteLikes = notesState.noteLikes; if ( noteLikes.hasOwnProperty( note.id ) ) { return noteLikes[ note.id ]; } const actionMeta = getActions( note ); const likeProperty = note.meta.ids.comment ? 'like-comment' : 'like-post'; return actionMeta[ likeProperty ]; }
event.dispatcher.on(event.step.comment, (step) => { reporter.startStep(step.toString()); currentStep = step; reporter.endStep('passed'); currentStep = null; });
const setApproveStatus = function ( noteId, siteId, commentId, isApproved, type ) { const comment = wpcom().site( siteId ).comment( commentId ); reduxStore.dispatch( actions.notes.approveNote( noteId, isApproved ) ); bumpStat( isApproved ? 'unapprove-comment' : 'approve-comment' ); recordTracksEvent( 'calypso_notification_note_' + ( isApproved ? 'approve' : 'unapprove' ), { note_type: type, } ); comment.update( { status: isApproved ? 'approved' : 'unapproved' }, updateNote( noteId ) ); }
function checkValidComment(db, slug, user_id, comment, replyTo, callback) { if (comment.trim() === '') return callback(new Error("the comment can't be empty")); // check duplicate comment db.get(queries.get_last_comment, [slug], (err, row) => { if (err) return callback(err); if (row && row.comment.trim() === comment && row.user_id === user_id) { return callback(new Error('the exact comment has been entered before')); } // @todo: check for cyclic replies callback(null); }); }
before( ( done ) => { site .addPost( fixture.post ) .then( ( data ) => { testing_post = site.post( data.ID ); // Add comment to post return site.post( data.ID ).comment().add( fixture.post_comment ); } ) .then( ( data_comment ) => { testing_comment = testing_post.comment( data_comment.ID ); done(); } ) .catch( done ); } );
export function comment(this: string) { return MarkdownTheme.handlebars.helpers.comment.call(this); }
it('should have the correct metadata', async function() { const { recordingId, recordingName, persister } = this.polly; this.polly.record(); await this.fetchRecord(); await persister.persist(); const har = await persister.find(recordingId); const { _recordingName, creator, entries } = har.log; const entry = entries[0]; expect(_recordingName).to.equal(recordingName); expect(creator.name).to.equal('Polly.JS'); expect(creator.version).to.equal(Polly.VERSION); expect(creator.comment).to.equal( `${persister.constructor.type}:${persister.constructor.id}` ); expect(entry).to.be.an('object'); expect(entry._id).to.a('string'); expect(entry._order).to.equal(0); });
onEndResolve(context: Context) { const reflections = Object.values(context.project.reflections); reflections.forEach((reflection) => { reflection.comment && LinkPlugin.replaceAnnotations(reflection.comment, reflections); if (reflection instanceof DeclarationReflection) { reflection.signatures?.forEach((sig) => { sig.comment && LinkPlugin.replaceAnnotations(sig.comment, reflections); }); } if (reflection instanceof SignatureReflection) { reflection.parameters?.forEach((param) => { param.comment && LinkPlugin.replaceAnnotations(param.comment, reflections); }); } }); }
function createEmailBody(config, event) { const postUrl = config.get('page_url').replace('%SLUG%', event.slug); const user = event.user.display_name || event.user.name; const body = ` To: Schnack Admin <${notify.sendmail.to}> From: ${user} <${notify.sendmail.from}> Subject: New comment on your post ${postUrl} New comment on your post ${postUrl} Author: ${user} ${event.comment} You can see all comments on this post here: ${postUrl}#comments Permalink: ${postUrl}#comment-${event.id} ` .split(/\n/) .join('\r\n') .trim(); return body; }
recorder.add(`say ${msg}`, () => { event.emit(event.step.comment, msg); output.say(msg, `${color}`); })
const setLikeStatus = function ( noteId, siteId, postId, commentId, isLiked ) { const type = commentId ? 'comment' : 'post'; const target = 'comment' === type ? wpcom().site( siteId ).comment( commentId ) : wpcom().site( siteId ).post( postId ); reduxStore.dispatch( actions.notes.likeNote( noteId, isLiked ) ); bumpStat( `${ isLiked ? 'unlike' : 'like' }-${ type }` ); recordTracksEvent( 'calypso_notification_note_' + ( isLiked ? 'like' : 'unlike' ), { note_type: type, } ); return isLiked ? target.like().add( updateNote( noteId ) ) : target.like().del( updateNote( noteId ) ); }
async create(ctx) { try { let fields = ctx.request.body || {}; const formObj = { comment: fields.comment, title: fields.title, subTitle: fields.subTitle, content: fields.content, type: fields.type, createTime: new Date() } ctx.validate(mailTemplateRule(ctx), formObj); await ctx.service.mailTemplate.create(formObj); ctx.helper.renderSuccess(ctx); } catch (err) { ctx.helper.renderFail(ctx, { message: err }); } }
async function saveComments(posts) { for (let post of posts) { const newComment = await saveComment(post); post.new_id = newComment; } for (let post of posts) { const replies = posts.filter(p => p.comment[3] === post.id); // replies to current post if (replies) { for (let reply of replies) { const { id, new_id } = post; await db.run(`UPDATE comment SET reply_to = ? WHERE reply_to = ?`, [new_id, id]); } } } }