-
Notifications
You must be signed in to change notification settings - Fork 54
FIX: grant reply/edit permissions to topic author #151
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
Conversation
| category_id: category.id | ||
| ).first | ||
|
|
||
| expect(user.guardian.send(:wizard_user_can_create_topic_on_category?, topic)).to be_truthy |
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.
@fzngagan We're calling a private method here. Is that what we want to be testing?
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.
The problem here is, the Rspec config in discourse is quite lax so the can_create_topic? and similar methods mostly return true so can't rely on testing them.
extensions/guardian.rb
Outdated
| action['type'] === 'create_topic' | ||
| end | ||
|
|
||
| submission_data = begin |
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.
@fzngagan This should be abstracted into a find_by_id method on CustomWizard::Submission.
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.
Sure, will make that change.
extensions/guardian.rb
Outdated
| wizard.presence | ||
| end | ||
|
|
||
| def wizard_can_create_topic_on_category?(wizard, topic) |
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.
@fzngagan Can't we just check if the topic has a wizard_submission_id and if the user is the author of the post? If a topic has that field it had to have been created by a wizard right? Won't this always return true if that's present?
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.
@angusmcleod
What if the given wizard can no longer create topics?
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.
Or say, what if the user no longer has access to the wizard?
|
New Spec: |
angusmcleod
left a comment
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.
@fzngagan Looks good 👍
No description provided.