java ee - how to allow user comments editable for a few minutes,after which should be made readable -
just want know logic behind , allowing user comments editable few minutes in site ,after should made readable.i had seen in linkedin site. solution use create session during comments submission , refresh every 3 minutes , check whether session has timed out after 14 minutes through ajax.let me know solutions.
i need know best solution implement.
why not refuse changes after time? when comment made, store 'changesexpire' date (say, 10m in future). when change comment that's past 'changesexpire' date, refuse them.
on ui, can have simple countdown timer. put 'edit' button, fire off timer. when timer goes off, hide button.
if leave page, no big deal, goes away. if come back, create new timer set remaining time in 'changesexpire' value.
no reason keep connections open or here.
Comments
Post a Comment