Canned replies should require titles to be unique

An update on my progress:

The API now only adds the reply if the title isn’t already in use.
https://github.com/nsuchy/discourse-canned-replies/commit/6fe13c5b868e94d273c3abda1d6b3d006c0a7efd

I’m not exactly sure where to start with the UI and displaying an error. Currently (this can be easily changed), the API returns {error: 'Title already in use!'} but the UI doesn’t react to it and the status code is still 200. While debugging a few times I got status code 500s and the UI did react to that as expected how can I go about sending a specific status code then changing the error message? Any guidance on that would be appreciated.

@jtbayly I’ll look into the actual migration steps and implementation soon :slight_smile: