politics-rewired / Spoke

Politics Rewired's fork of Spoke
GNU General Public License v3.0
34 stars 16 forks source link

fix(copy campaign): copy display order for canned responses #1643

Closed ajohn25 closed 11 months ago

ajohn25 commented 11 months ago

Description

This alters the SQL for copying canned responses, to add the display_order field when canned responses are copied to a new campaign.

Motivation and Context

The changes in #1551 require us to pass this field to avoid violating the unique constraint on display_order. This error was seen on a beta instance.

Postgres error: 
          insert into canned_response (campaign_id, title, text)
          select
            $1 as campaign_id,
            title,
            text
          from canned_response
          where campaign_id = $2
         - duplicate key value violates unique constraint "canned_response_campaign_id_display_order_unique"

How Has This Been Tested?

This has been tested locally

Screenshots (if appropriate):

Documentation Changes

Checklist: