arkency / find-open-source-mentor

A platform to connect junior developers with open source projects
35 stars 11 forks source link

Add GitHub repos #15

Closed oxanayoxana closed 5 years ago

oxanayoxana commented 5 years ago

When both are merged, the next step could be to create a fill-in-form for Project. Opensource mentor gets redirected to this fill-in-form after you press button "Add this repo". In this form opensource mentor adds his name, and description to the repo he is adding. Will create issue for this.

andrzejkrzywda commented 5 years ago

Looks good to me. @oxanayoxana - my understanding is that it shouldn't conflict with @hkopij PR and I can merge both, you agree?

andrzejkrzywda commented 5 years ago

There seem to be some empty, generated files - can we remove them if they are not used?

oxanayoxana commented 5 years ago

Looks good to me. @oxanayoxana - my understanding is that it shouldn't conflict with @hkopij PR and I can merge both, you agree?

Yes, I think they won't conflict and both can be merged!

oxanayoxana commented 5 years ago

Today I experienced problems retrieving the repos. The same error Octokit::Unauthorized. So I tried to sign out and check again, but couldn't sign in anymore. For some unknown reasons it started to give me rollbacks:

  ↳ app/models/user.rb:9
   (0.4ms)  BEGIN
  ↳ app/models/user.rb:9
  User Exists (1.1ms)  SELECT  1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2  [["email", "oksana.oleshchenko@gmail.com"], ["LIMIT", 1]]
  ↳ app/models/user.rb:9
   (0.4ms)  ROLLBACK
  ↳ app/models/user.rb:9
Redirected to http://localhost:3000/
Completed 302 Found in 494ms (ActiveRecord: 115.1ms)

I found this solution https://github.com/omniauth/omniauth/issues/816#issuecomment-293420970 and changed def self.from_omniauth(auth) in User Model to this one:

  def self.from_omniauth(auth)
    where(email: auth.info.email).first_or_initialize.tap do |user|
      user.uid = auth.info.nickname
      user.email = auth.info.email
      user.password = Devise.friendly_token[0,20]
      user.save!
    end
  end 

Locally it started to work. Both sign in works and repos get fetched. If I delete user.save! it gives me Completed 200 OK in logs but does not log in.

Don't know if I'm the only one experiencing this. I haven't commited nor pushed anything yet, we can wait and see if anyone has the same problem.

alexneisc commented 5 years ago

I had a similar problem but I didn’t understand the reasons. Great problem analysis!

andrzejkrzywda commented 5 years ago

@oxanayoxana - after merging other PRs there seems to be a conflict on Gemfile.lock now, could you look at it - I'd be happy to merge

andrzejkrzywda commented 5 years ago

Thank you!