Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submit Page Basic Implementation #10

Closed
seport opened this issue Jan 25, 2018 · 3 comments
Closed

Submit Page Basic Implementation #10

seport opened this issue Jan 25, 2018 · 3 comments
Labels
Milestone

Comments

@seport
Copy link
Owner

seport commented Jan 25, 2018

As a user

I want to submit links to protest event pages

So that they are visible on the app

Given a user

When I submit a valid facebook link

Then that link should appear in the admin panel for approval

Notes:

  • This page was already implemented in PHP. We want to rewrite it in rails.
  • The link should be validated on the model:
    • To check that it is a valid facebook event link
    • To validate against the facebook API to make sure it is a valid event
    • that the event does not exist in the database already
  • Events should be saved to an Event table with the following fields:
    • fb_id (the facebook event id, should be unique)
    • default rails fields (id, created_at, etc)
    • status: :unpublished

Resources:

Design:

screen shot 2018-01-24 at 7 06 48 pm

@ThuyNT13
Copy link

ThuyNT13 commented Feb 23, 2018

@Reltre @seport

  • should we delete the test directory as we're not using MiniTest?
  • re: "link should appear in the admin panel for approval", why does there need to be admin approval if link has been verified by API? Are people submitting "inappropriate" links?

Specs to run

Model - Event

  • test validates_format_of URL input

    • valid input returns true, parse_fb_id ({ expect(fb_id).to exist } would this this work for this purpose?)
    • else invalid input, expect { [invalid input] }.to raise_error
  • test parse_fb_id from URL inputted

    • returns fb_id, service_call
    • else is there an exception here?

API Service logic (helper method / separate class / keep as method within Event?)

  • test service_call to test validity of event:
    • success and returns true; if fb_id is not currently in database && passes admin approval:
      • create Event, (test assert_difference 'Event.count', 1)
      • else if currently in database (test assert_no_difference 'Event.count')
    • else raise an exception

Write validations in Model - Event

  • validates :fb_id, presence: true; uniqueness: true
  • validates :status, presence: true

@Reltre
Copy link

Reltre commented Mar 8, 2018

Next steps:

  • CSS for submit page
  • Cache API Key
  • Add an integration test (please do this)
  • Validate uniqueness on the event id, and not the URL

@seport
Copy link
Owner Author

seport commented Mar 20, 2018

Resolved by #32

@seport seport closed this as completed Mar 20, 2018
@seport seport added this to the v1.0.0 milestone Mar 20, 2018
@seport seport added the v1.0.0 label Mar 20, 2018
@seport seport reopened this Mar 20, 2018
@seport seport closed this as completed Mar 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants