Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

tusharnain
Copy link
Contributor

…e disabled

Added a UX condition to display comment notification settings, only if the user has enabled the comment notifications.

…e disabled

Added a UX condition to display comment notification settings, only if the user has enabled the comment notifications.
@ssddanbrown
Copy link
Member

Thanks for offering this @tusharnain4578,

Please could you remove the changes from 718adf3 from this PR?
They appear unrelated and cause many changes to show, I'd want this PR to be focused on the single issue (Plus I would not accept a PR at this time to change default credentials).

Also, would you be willing to add a test case to cover this functionality? Just something to add to our existing UserPreference tests.

@tusharnain
Copy link
Contributor Author

tusharnain commented Sep 16, 2023

@ssddanbrown Sorry for your troubles, i have removed the unnecessary commit from the PR, but i couldn't get what you mean by 'add a testcase', could you please elaborate more, sir?
And also i am sorry for any inconvinience and stupidity from my side, i am very new to open source, git and all.

@ssddanbrown
Copy link
Member

@tusharnain4578 No problem, no need to apologise, everyone is new to things at one point, and a lot of things kind of thing can be project specific.

but i couldn't get what you mean by 'add a testcase', could you please elaborate more, sir?

We have a big set of automated tests that specific things, which is ran via phpunit.
For each bit of functionality we fix/change (at least for back-end code), I like to try to cover it with a test to prevent the issue coming back in the future.
Here's an example of a single test:

public function test_notification_preferences_show_watches()
{
$editor = $this->users->editor();
$book = $this->entities->book();
$options = new UserEntityWatchOptions($editor, $book);
$options->updateLevelByValue(WatchLevels::COMMENTS);
$resp = $this->actingAs($editor)->get('/preferences/notifications');
$resp->assertSee($book->name);
$resp->assertSee('All Page Updates & Comments');
$options->updateLevelByValue(WatchLevels::DEFAULT);
$resp = $this->actingAs($editor)->get('/preferences/notifications');
$resp->assertDontSee($book->name);
$resp->assertDontSee('All Page Updates & Comments');
}

This loads the `/preferences/notifications' view, then checks the response to ensure it has the content we expect (In that case, a book we're watching).
For this, I'd like something similar which checks that the options are not shown if comments are disabled.

There's a bit of guidance on this in our devdocs here although I've just noticed it's not very well documented and under the wrong heading, I'll look to address that at some point.

If it's too much to learn/understand/get-involved-with just let me know and I can instead add the testing myself during review and merge.

Added Testcases for preferences menu of Comment Notifications visibility when comments are enabled/disabled.
@tusharnain
Copy link
Contributor Author

I have added 2 test cases in UserPreferencesTest.php for this functionality, please review, sir.

ssddanbrown added a commit that referenced this pull request Sep 17, 2023
Combined testcases, updated to use actual text strings, and set comments
setting via correct method.

Made during review of #4552
@ssddanbrown ssddanbrown merged commit baa957d into BookStackApp:development Sep 17, 2023
@ssddanbrown
Copy link
Member

Thanks @tusharnain4578, now merged into development to be part of the next feature release.
I followed this up with c42cd29 during review, just to make some tweaks to the test.

@ssddanbrown
Copy link
Member

Following on from my comment yesterday, regarding our bad documentation for PHP tests, I've now updated and expanded the document for this into it's own document:

https://github.com/BookStackApp/BookStack/blob/development/dev/docs/php-testing.md

@igoresz
Copy link

igoresz commented Oct 31, 2023

Sorry guys for maybe abuse asking... Notifications in emails by new comments on WATCHed pages - is it in perspective roadmap?
Many thanks in advance. Good project, by the way! We use it, it helps us much.

@Man-in-Black
Copy link
Contributor

when you click on the watching setting, is that what you're searching for?
image
here you can simply change the level of notification to also include mails on comments.

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

Successfully merging this pull request may close these issues.

4 participants