Lock account #5564#5643
Conversation
There was a problem hiding this comment.
Line is too long. [109/80]
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
There was a problem hiding this comment.
@houndci Shall I change the single-quotes here into double-quotes ?
|
@aka001 We use houndci to check our javascript code. Apparently it also checks the ruby code. We were trying to disable checks for ruby but weren't successful so far. As long as those comments don't inform you about obvious errors you can just ignore them. We aren't enforcing a ruby code style right now. |
b3a696e to
4afd3e1
Compare
|
@svbergerem Okay. I have updated the pr and squashed the commits. Thanks. |
There was a problem hiding this comment.
I didn't get the use of "admin_close_account_path" which messed up the "lock account" option.
I used the command in main repository to figured out the use of the same:
grep -r "admin_close_account_path" .
but didn't get any result which details the same.
Please help me in figuring it out.
There was a problem hiding this comment.
You might want to give http://guides.rubyonrails.org/routing.html a read then.
There was a problem hiding this comment.
@jhass Thank you for the link. It helped a lot. I have taken the liberty to add the unlock feature.
When admin closes an user account it's "locked_at" field doesn't change, which results in "lock account"/"unlock account" option to be visible in admin's page.
Should we change the design to: "lock account/ unlock account" shouldn't be visible if the user account is locked?
I have attached the screenshot which reflects the same. The users "aka" and "aka_002" 's accounts are closed still the "Unlock Account" option is visible.

There was a problem hiding this comment.
f307ee0 to
ea83d91
Compare
|
@aka001 Looks like the rebase went a bit wrong. Let's try this: git remote add upstream git:://github.com/diaspora/diaspora.git
git fetch upstream
git checkout 5564_lock_account
git rebase -i upstream/develop
# Drop the line with my commit
# Choose squash for the now second line
# Save & quit
# You'll be in some conflicts, git status shows them, once you cleaned them out use git add to mark them resolved, once all are resolved, use git rebase --continue, that might be needed more than one time
git push -f origin 5564_lock_account
# Later, you can edit the last commit with
git commit --amend
git push -f origin 5564_lock_accountPlease also add at least one controller test per new route. |
There was a problem hiding this comment.
I think using else here would be clearer
|
Updated |
There was a problem hiding this comment.
here is an unresolved conflict
|
There's still a bogus commit in here and this is really fine in one commit, no need for 12. See #5643 (comment) |
e1eab1b to
1d4c0d1
Compare
|
I have squashed the commits. |
There was a problem hiding this comment.
Uh, I should have payed closer attention to this earlier, sorry. This doesn't reflect what the method does and neither what the spec tests for. It does not queue a job, it executes that action directly (which is fine, since it's a single UPDATE query). So please update the wording here, something like "it locks the given account" should be fine.
Remember that you can edit your commit with git commit --amend.
96e5527 to
0faaa4a
Compare
There was a problem hiding this comment.
@jhass
This line:
other_user.expect(other_user.reload.access_locked?).to be_truthy
returns the error "undefined method `expect' "
Is this the expected behavior? Kindly explain.
There was a problem hiding this comment.
Yes it is. expect is not monkey patched onto all objects, it's only available inside the it block. Just drop the other_user. before it, I'm not following what that should express anyway ;)
19daaf5 to
87fd9dc
Compare
There was a problem hiding this comment.
It's not about replacing this call.
2fd4d40 to
2e18818
Compare
There was a problem hiding this comment.
@jhass Shall I change the "other_user" to "user" ?
There was a problem hiding this comment.
I used user over other_user in my example because I found the other_ rather redundant, I didn't get what it would relate to. But I don't care too much either way.
31f9bf3 to
53126fb
Compare
There was a problem hiding this comment.
I have first locked the account -> tested it -> unlocked it -> tested it. I think this will cover the test case.
There was a problem hiding this comment.
The
post :lock_account, id: other_user.id
expect(other_user.reload.access_locked?).to be_truthyis kind of redundant with the other test, I think a simple other_user.lock_access! is enough.
There was a problem hiding this comment.
I have updated the pr.
72f21bf to
a8267ba
Compare
There was a problem hiding this comment.
Just drop this line, that expectation is not part of the scope of this test.
There was a problem hiding this comment.
True that. I have updated the pr.
f306723 to
2c47ecd
Compare
There was a problem hiding this comment.
Please drop the method below, we made it obsolete earlier.
617188f to
e968dd6
Compare
There was a problem hiding this comment.
No need for the stray private either.
a3701e9 to
3bb5e78
Compare
|
Thank you! |
|
Nice work @aka001 thank you! |
|
:) |
No description provided.