-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Deprecate drupal user model #2857
Deprecate drupal user model #2857
Conversation
To start what I'm doing is going through the pages of search results from https://github.com/publiclab/plots2/search?p=2&q=drupaluser&type=&utf8=%E2%9C%93 |
I've now refractored |
OK, we've had a lot of changes merged in the past couple days. It looks like you may need to resolve a few conflicts here before moving forward. I'll keep an eye out to help you with the tests! |
Hmm, looks stalled! I'll try to restart it. |
Hey sorry I haven’t been able to work on this the last couple days |
No problem!
…On Sat, Jun 23, 2018, 3:26 PM Andrew Neidley ***@***.***> wrote:
Hey sorry I haven’t been able to work on this the last couple days
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#2857 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJzy9tnJR2AoB_SAdBfOXMhK3NYADks5t_pZFgaJpZM4Utxjq>
.
|
Hi, just checking if you've gotten stuck on this at all, or if I could help in any way? Thanks! |
Thank you for your patience!
|
Although these look like errors, they don't seem to have stopped the app from running, that I can see. What do you see in your browser when you go to http://0.0.0.0:3000/ after starting this? Awesome! I wanted to note that perhaps @Souravirus would be able to advise you on this as he's tackled some really big changes over the past few weeks and is an expert in this sort of thing. If he has time he may be a good person to ask for help! |
Gonna try to tackle this again... |
@Souravirus, if you're out there and have time to look at this. Here's what I'm seeing when I start the server: and here's what I'm getting this when I run
Will try to get what I can working now that I have more free time 👍 I promise! |
Hi @Neidley , I guess you need to rebase your PR. Thanks! |
First if you can then please resolve the conflicts. That would be great thank you. |
Yeah like @Gauravano try rebasing your PR. Sorry for being late here. I have not seen that I was mentioned here. |
Hi, @Neidley - there's some guidance on rebasing here: you may be able to skip step 2 if your master is still in sync with publiclab's master: https://publiclab.org/wiki/contributing-to-public-lab-software#Rewinding+the+master+branch Thanks! |
9fbadb9
to
e1a9d87
Compare
@Gauravano @Souravirus |
hmm now you can continue. Great work |
But there is an error with rake db:setup command. Please see to it |
app/models/user.rb
Outdated
self.id = drupal_user.uid | ||
if user.nil? | ||
user = User.new(name: username, | ||
pass: rand(100_000_000_000_000_000_000), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess here is the error with pass
that is coming in the tests. I guess pass is an unknown attribute with User model. So adding pass attribute to User model might do the work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah my app/models/user.rb looks like that.
I ran rake db:setup
and rake db:migrate
which now shows me this error on localhost:
couldn't find file 'noty/lib/noty.css' with type 'text/css'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! This corresponds to this section, where a matching drupal_user is created:
Lines 53 to 81 in bce1f1f
def create_drupal_user | |
self.bio ||= '' | |
if drupal_user.nil? | |
drupal_user = DrupalUser.new(name: username, | |
pass: rand(100_000_000_000_000_000_000), | |
mail: email, | |
mode: 0, | |
sort: 0, | |
threshold: 0, | |
theme: '', | |
signature: '', | |
signature_format: 0, | |
created: DateTime.now.to_i, | |
access: DateTime.now.to_i, | |
login: DateTime.now.to_i, | |
status: 1, | |
timezone: nil, | |
language: '', | |
picture: '', | |
init: '', | |
data: nil, | |
timezone_id: 0, | |
timezone_name: '') | |
drupal_user.save! | |
self.id = drupal_user.uid | |
else | |
self.id = DrupalUser.find_by(name: username).uid | |
end | |
end |
But since we're deprecating drupal_user, we can delete that whole section -- we don't need to do it anymore. We can also remove the hook which triggers it:
Line 44 in bce1f1f
def self.search(query) |
Make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, let me delete those and see what happens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I need to make changes locally, or are we able to make changes within this PR and see if it works from here?
(Still new to the capabilities/complexities of PRs) and if changes can be made by you guys here how do I pull them back to my local branch to run code locally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should do the changes locally and push it here and if there is any conflicts shown up in the PR. Then this means you have to rebase it as you have done today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I'm deleting the create_user
function from plots2/app/models/user.rb? (that was previously create_drupal_user function) and see what happens? Don't users need to still be created?
so in this we previously had 2 types of users, which we kept in sync -
users and drupal users. Now we are cutting that back to just one, users. So
this was one of the various functions that had been creating a matching
drupal_user record for each user record. No longer needed!
…On Mon, Jul 23, 2018 at 6:08 PM Andrew Neidley ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In app/models/user.rb
<#2857 (comment)>:
> - created: DateTime.now.to_i,
- access: DateTime.now.to_i,
- login: DateTime.now.to_i,
- status: 1,
- timezone: nil,
- language: '',
- picture: '',
- init: '',
- data: nil,
- timezone_id: 0,
- timezone_name: '')
- drupal_user.save!
- self.id = drupal_user.uid
+ if user.nil?
+ user = User.new(name: username,
+ pass: rand(100_000_000_000_000_000_000),
So I'm deleting the create_user function from plots2/app/models/user.rb?
(that was previously create_drupal_user function) and see what happens?
Don't users need to still be created?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2857 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABfJyPG7l-ah_wsNMDJSdkczxeHJFaHks5uJkkugaJpZM4Utxjq>
.
|
Cool, I've removed that |
app/models/user.rb
Outdated
@@ -41,45 +41,11 @@ class User < ActiveRecord::Base | |||
before_save :set_token | |||
after_destroy :destroy_user | |||
|
|||
def self.search(query) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this one we still needed, though. But the other deletion looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotcha, adding it back now.
I guess I also should remove
before_create :create_user
, now that create_user
is gone, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right if create_user
used to be create_drupal_user
, which i think is right. Thanks!!!
@jywarren I'm Looking at these remaining code climate errors...
|
@jywarren And looking at the continuous-integration/travis-ci |
This profile is created 2 months ago - https://unstable.publiclab.org/profile/iragersh and is working properly. And, Liz's profile is also throwing 500 - https://unstable.publiclab.org/profile/liz. So, problem coming with old profiles |
I booted it locally but can't find the issue. Need to check logs on unstable. Hang on! |
OK:
|
Weird because you'd think that'd be caught by tests? |
Do we need to add a like to a user in fixtures, before testing the profile page? |
OK, was able to reproduce locally. |
pushing to unstable again |
https://unstable.publiclab.org/profile/liz working now! |
Hmm, login modal from https://unstable.publiclab.org/profile/stevie doesn't work... but maybe it doesn't on stable either? That's right: https://stable.publiclab.org/profile/stevie also. |
The site generally seems to work! I think we can merge this! |
Issue is already reported and being worked upon #4462. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍 🎉
🎉 🎉 🎉 this is complete!!! Thanks @Neidley for getting it started, this was a long journey!!! |
Awesome. Thanks @Neidley for helping Jeff in making our codebase better.
…On Fri, Jan 4, 2019, 1:00 AM Jeffrey Warren ***@***.*** wrote:
🎉 🎉 🎉 this is complete!!! Thanks @Neidley <https://github.com/Neidley>
for getting it started, this was a long journey!!!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2857 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AUACQxu69Ogk8xaNxvD6xuIYHJcqZ_Jsks5u_lpsgaJpZM4Utxjq>
.
|
Follow-up to #2857 once we confirm we have a backup and all is running smoothly.
* Drop DrupalUsers "users" table Follow-up to #2857 once we confirm we have a backup and all is running smoothly. * Update schema.rb.example
* Drop DrupalUsers "users" table Follow-up to publiclab#2857 once we confirm we have a backup and all is running smoothly. * Update schema.rb.example
* initial local repo commit * all model files refactored DrupalUser to User * all controllers files refactored DrupalUser to User * updated .gitignore, refractored DrupalUser to User in all doc/app/ html files and test/* files * refractored drupal_user to user in numerous files * trying to ignore changes from unneccessary files * remove create function and hook from models/user.rb * fix some code climate errors * Lots and lots of refactoring * Update _likes.html.erb * Update users_controller.rb * cleanup profile_user * more user.rb cleanup * Update _comment.html.erb
* Drop DrupalUsers "users" table Follow-up to publiclab#2857 once we confirm we have a backup and all is running smoothly. * Update schema.rb.example
No description provided.