Skip to content
This repository has been archived by the owner on Jan 29, 2021. It is now read-only.

Remove ability to write or query campaign_run_id. #798

Merged
merged 5 commits into from
Dec 6, 2018
Merged

Conversation

DFurnes
Copy link
Contributor

@DFurnes DFurnes commented Dec 6, 2018

What's this PR do?

This pull request removes the ability to create new posts or signups with campaign_run_id values or to filter on existing values (so ?filter[campaign_run_id], for example, is a no-op). We can make a follow-up pull request in a few sprints to remove the campaign_run_id field from the database and transformers once and for all.

How should this be reviewed?

I started by removing assertions that depended on campaign_run_id, then removed the ability to read or write that value from the application. Rather than add some short-lived tests to ensure we can't write this value anymore, let's just have a quick testing party after we deploy this.

Any background context you want to provide?

The plan is to deploy this once we've run the script to remove campaign_run_id values in production, so that even if Ashes, Phoenix, and Gambit aren't immediately updated to stop querying or writing this value, we can safely ignore it here.

Relevant tickets

References DoSomething/infrastructure#61.

How to deploy

https://github.com/DoSomething/rogue/blob/master/docs/development/deployments.md

@DFurnes
Copy link
Contributor Author

DFurnes commented Dec 6, 2018

@katiecrane @chloealee This is ready for review! We can safely deploy this to QA to test as well, since we've updated the database there. We can then have a little testing party to make sure there aren't any edge cases we're not thinking of for this once it hits production.

$rejectedPosts = factory(Post::class, 'rejected', 3)->create();
$userId = $this->faker->unique()->northstar_id;
factory(Post::class, 2)->create(['northstar_id' => $userId]);
factory(Post::class, 'rejected', 1)->create(['northstar_id' => $userId]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was flaky since we'd sometimes randomly generate the same owner and non-owner Northstar IDs. I've updated the test to generate two separate IDs and use them for each batch of posts so it consistently passes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes thank you for fixing this!!

campaign.campaign_runs.current,
signup.campaign_run_id,
)}
Campaign Run Start Date: {campaign.start_date}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want this to just rad "Campaign Start Date"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We sure do! Updated that in 5b408d3.

@chloealee
Copy link
Contributor

I LOVE THIS PR SO MUCH!!!!!

Copy link
Contributor

@chloealee chloealee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one tiny edit, otherwise good by me! 🔪 💣 👋

*
* GET /activity?filter[]=
* @return void
*/
public function testActivityIndexWithNorthstarIdAndCampaignRunIdFilters()
{
$signup = factory(Signup::class)->create(['northstar_id' => 17, 'campaign_run_id' => 143]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should change the title of this test to testActivityIndexWithNorthstarIdAndCampaignIdFilters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, of course! Updated in 4227bd7.

$response = $this->withAccessToken($northstarId)->getJson('api/v3/posts');
$response->assertStatus(200);
$response->assertJsonCount(2, 'data');
// Owners should only see their own pending/accepted posts, and not
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be more clear to say "Owners should be able to see their own posts of any status, but not pending or rejected posts from other users" since we are showing this user their own post which has been rejected

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That reads a lot better! Updated in 4227bd7. 👍

Copy link
Contributor

@katiecrane katiecrane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rules!! Just a couple of minor comments from me

@katiecrane
Copy link
Contributor

@DFurnes this is amazing!!!!

@DFurnes DFurnes merged commit c42f59f into master Dec 6, 2018
@DFurnes DFurnes deleted the no-more-runs branch December 6, 2018 22:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants