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

Feat/questions optional #687

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

rahat1994
Copy link

issue #630.

"Currently, the questions feature is not optional, but some people, like me, may not want to use it, since Pinkary's initial proposal - I think, was for bio links."

@rahat1994
Copy link
Author

@MrPunyapal do you think I need to do anything else? If so please let me know.

@MrPunyapal
Copy link
Collaborator

Tests are missing

And also a validation in a questions/create component

@xiCO2k
Copy link
Contributor

xiCO2k commented Oct 4, 2024

I would call it can_receive_questions.

@MrPunyapal MrPunyapal marked this pull request as draft October 5, 2024 17:31
@rahat1994
Copy link
Author

Things I changed

  1. Added a select for choosing prefers question.
  2. Added necessary validation rules.
  3. Even if they don't want to receive questions when they visit their own profile they can share an update.
  4. before storing a question It is checked if the user accepts question.
  5. Added tests to see if the users accepts test.

@rahat1994 rahat1994 marked this pull request as ready for review October 23, 2024 16:25
@rahat1994 rahat1994 requested a review from MrPunyapal October 24, 2024 15:21
name="prefers_questions"
class="mt-1 block w-full"
class="mt-1 block w-full"
:options="[true => __('People can ask me questions'), false => __('I do not want to receive questions')]"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep it simple "yes" and "no"

@@ -206,6 +205,13 @@ public function store(Request $request): void

$user = type($request->user())->as(User::class);

$toUser = User::findOrFail($this->toId);

if (!$toUser->prefers_questions) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please run Pint

$toUser = User::findOrFail($this->toId);

if (!$toUser->prefers_questions) {
$this->addError('content', __('This user does not accept questions.'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better we refresh the page with a notification so it resets the page and removes the component from the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants