Blake Erickson 35e17ce115
FIX: Email Send post has already been taken error (#16992)
* FIX: Email Send post has already been taken error

Adding a failing test first before coming up with a good solution.

Related: 357011eb3b4e9c5fb860a34ecbb2f5cb89e89a7a

The above commit changed

```
PostReplyKey.find_or_create_by_safe!
```

to

```
PostReplyKey.create_or_find_by!
```

But I don't think it is working as a 1-1 replacement because of the
`Validation failed: Post has already been taken` error we are receiving
with this change. Also we need to make sure we don't re-introduce any
concurrency issues.

Reported: https://meta.discourse.org/t/224706/13

* Remove rails unique constraint and rely on db index

I believe this is what is causing `create_or_find_by!` to fail. Because
we have a unique constraint in the db I think we can remove this rails
unique constraint?

* clean up spec wording
2022-06-06 13:13:26 -06:00
..
2020-04-28 15:59:39 +05:30
2019-11-29 15:49:08 +00:00
2022-04-14 11:53:57 +02:00
2019-10-21 12:08:20 +01:00
2020-05-05 13:46:57 +10:00
2021-12-02 22:41:55 +05:30
2022-04-28 11:51:03 +02:00
2022-04-06 10:07:14 +02:00
2022-02-28 10:20:58 +08:00
2022-05-05 12:22:17 +10:00
2019-10-17 16:58:22 +11:00
2022-05-27 13:15:14 +04:00