FEATURE: Topic slow mode. (PR #10904)

indentation is wrong

can’t we use false here ? instead of “false” ?

indentation is wrong

indentation is wrong

also does pull-right something we use ?

please avoid direct styling on html elements

xxx ?

Generally speaking I find the word “interval” incorrect, and I think “duration” would be more correct.

    const topic = composer.topic;

moment js has a lot of helpers to deal with duration, maybe you should have a look at it ?

I’m not a huge fan of magic number for sizes :stuck_out_tongue:

Thanks for the thorough review, @jjaffeux! I addressed all your comments.

I’m curious why we check this on the client side, when the server is returning the error (and that should be displayed.) ?

Excellent work. This is going to be great.

          if Time.zone.now < threshold

We prefer this in our codebase.

      it "creates the topic if the user's last post is older than the slow mode interval" do

Since we already know that the post can be submitted, I chose to show the error earlier. I’m fine with displaying the error from the backend, do you prefer that instead?

Hi! This message slipped: current: "Current duration is %{hours} hours, %{minutes} minutes, and %{seconds} seconds."

It can’t be translated properly as it doesn’t support any plural forms. Perhaps it can use message format and allow things like: Current duration is 5 hours. Current duration is 30 minutes. Current duration is 5 hours and 15 minutes. etc?

Good catch. I’ll try to replace it with the moment.js duration helper.