{"action":"created","issue":{"url":"https://api.github.com/repos/DoSomething/gambit-conversations/issues/448","repository_url":"https://api.github.com/repos/DoSomething/gambit-conversations","labels_url":"https://api.github.com/repos/DoSomething/gambit-conversations/issues/448/labels{/name}","comments_url":"https://api.github.com/repos/DoSomething/gambit-conversations/issues/448/comments","events_url":"https://api.github.com/repos/DoSomething/gambit-conversations/issues/448/events","html_url":"https://github.com/DoSomething/gambit-conversations/pull/448","id":385498035,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0NDU2NDEx","number":448,"title":"Conditionally include why_participated when creating photo posts","user":{"login":"aaronschachter","id":1236811,"node_id":"MDQ6VXNlcjEyMzY4MTE=","avatar_url":"https://avatars2.githubusercontent.com/u/1236811?v=4","gravatar_id":"","url":"https://api.github.com/users/aaronschachter","html_url":"https://github.com/aaronschachter","followers_url":"https://api.github.com/users/aaronschachter/followers","following_url":"https://api.github.com/users/aaronschachter/following{/other_user}","gists_url":"https://api.github.com/users/aaronschachter/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronschachter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronschachter/subscriptions","organizations_url":"https://api.github.com/users/aaronschachter/orgs","repos_url":"https://api.github.com/users/aaronschachter/repos","events_url":"https://api.github.com/users/aaronschachter/events{/privacy}","received_events_url":"https://api.github.com/users/aaronschachter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-11-28T23:14:17Z","updated_at":"2018-11-29T18:01:44Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/DoSomething/gambit-conversations/pulls/448","html_url":"https://github.com/DoSomething/gambit-conversations/pull/448","diff_url":"https://github.com/DoSomething/gambit-conversations/pull/448.diff","patch_url":"https://github.com/DoSomething/gambit-conversations/pull/448.patch"},"body":"#### What's this PR do?\r\n\r\nModifies the under-construction `topics/posts/photo` middleware to only ask user for their signup` why_participated` if it currently doesn't exist in Rogue, completing feature parity for creating photo posts via the [Gambit Campaigns `/POST campaignActivity` endpoint](https://github.com/DoSomething/gambit-campaigns/tree/master/lib/middleware/campaignActivity/photo)\r\n\r\n* Adds request helpers for getting and saving draftSubmission values\r\n\r\n* Modifies user signup helpers to pass specific `campaign`, `signupSource`, and `signupSourceDetails` arguments instead of a single `args` argument\r\n\r\n* Modifies user post helpers to pass specific `campaign`, `postSource`, and post value params arguments instead of a single `args` argument\r\n\r\n* Adds middleware comments to detail multiple question flow per https://github.com/DoSomething/gambit-conversations/pull/445/files#r235509064\r\n\r\n* Validates input for caption and whyParticipated with `helpers.util.isValidTextFieldValue` (renaming `helpers.util.isValidTextPost`)\r\n\r\n\r\n#### How should this be reviewed?\r\n\r\n* Verify signups are created via keyword (delete signup if exists already to confirm)\r\n* Verify signup is fetched via keyword if signup exists already\r\n* Verify that you're asked for why participated when creating your 1st photo post for the signup\r\n* Verify that you are NOT asked for why participated when creating your 2nd photo post for the signup\r\n* Verify caption and why participated are only accepted when message text has letters and is more than 2 characters (e.g. messages with only emoji, or just a photo should return an invalid response reply)\r\n\r\n#### Any background context you want to provide?\r\n\r\nThis should be tested on staging, as we're looking to set the `DS_GAMBIT_CONVERSATIONS_DRAFT_SUBMISSIONS_ENABLED` config to `true` to go live.\r\n\r\nWill need to investigate how many open draft submissions there are currently before this goes live to assess whether this can go live as is (or without an import to backfill existing draft submissions into our `draftSubmissions` collection.\r\n\r\n#### Relevant tickets\r\n\r\nhttps://www.pivotaltracker.com/story/show/161494958\r\n\r\n#### Checklist\r\n- [x] Documentation added for new features/changed endpoints.\r\n- [x] Tests added/updated for new features/bug fixes.\r\n- [x] Tested on staging.\r\n- [ ] Pinged a PM if this is a larger PR that would benefit from some additional testing love.\r\n"},"comment":{"url":"https://api.github.com/repos/DoSomething/gambit-conversations/issues/comments/442932918","html_url":"https://github.com/DoSomething/gambit-conversations/pull/448#issuecomment-442932918","issue_url":"https://api.github.com/repos/DoSomething/gambit-conversations/issues/448","id":442932918,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MjkzMjkxOA==","user":{"login":"aaronschachter","id":1236811,"node_id":"MDQ6VXNlcjEyMzY4MTE=","avatar_url":"https://avatars2.githubusercontent.com/u/1236811?v=4","gravatar_id":"","url":"https://api.github.com/users/aaronschachter","html_url":"https://github.com/aaronschachter","followers_url":"https://api.github.com/users/aaronschachter/followers","following_url":"https://api.github.com/users/aaronschachter/following{/other_user}","gists_url":"https://api.github.com/users/aaronschachter/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronschachter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronschachter/subscriptions","organizations_url":"https://api.github.com/users/aaronschachter/orgs","repos_url":"https://api.github.com/users/aaronschachter/repos","events_url":"https://api.github.com/users/aaronschachter/events{/privacy}","received_events_url":"https://api.github.com/users/aaronschachter/received_events","type":"User","site_admin":false},"created_at":"2018-11-29T18:01:44Z","updated_at":"2018-11-29T18:01:44Z","author_association":"MEMBER","body":"Querying the production campaigns DB with this query to find drafts over the past 60 days that have a photo, but were never submitted via this query (referencing [this thread](https://dba.stackexchange.com/questions/112179/date-range-query-for-past-24-hour-in-mongo-shell) for the date range)\r\n\r\n```\r\ndb.getCollection('reportback_submissions').count({ \r\n  \"submitted_at\": { $exists: false }, \r\n  \"photo\": { $exists: true }, \r\n  \"created_at\" : { \r\n    $lt: new Date(), \r\n    $gte: new Date(new Date().setDate(new Date().getDate()-60))\r\n  }   \r\n})\r\n```\r\nDate range:\r\n\r\nDays | Count\r\n-----|-----\r\n60 | 633\r\n30 | 631\r\n20 | 18\r\n15 | 17\r\n\r\nGoing to dive into try to break this down into counts by campaign... but I'm leaning towards discarding these drafts for the sake of a simpler launch. Otherwise we have 2 options for getting these gambit-campaigns drafts over:\r\n\r\n- Run a one-time script to find create new `draftSubmissions` documents in this app with the corresponding `reportback_submissions` documents in gambit-campaigns\r\n- Create an endpoint in gambit-campaigns to lookup a `reportback_submission` by user and campaign, and check to see if a record exists before creating a new `draftSubmission` in this app\r\n\r\nThe 1st option would be less overhead, and could be something we could run after launch. Treat Yo Friends is a photo post campaign launching this weekend, so ideally looking to enable the `draftSubmission` document before the launch, as then we'd need to execute option 1 or 2 before we can enable the feature."}}
{"actor":{"display_login":"aaronschachter"}}