Repository navigation
feat: Notifications mailing system #327
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
Open
orronai
wants to merge
10
commits into
master
Choose a base branch
from
notifications-mailing-system
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1ce98cd
feat: Notifications mailing system
orronai 1e9e28c
- Added tests
orronai d3f23df
Added to the config an attribute
orronai 91b4a0e
Fixed a test
orronai 4c475e1
Merged master and fixed conflicts
orronai c7d1fb6
- Changed The mails table and columns
orronai b741e53
- Merged with master branch
orronai 3274ef7
Merge branch 'master' of https://github.com/PythonFreeCourse/lms into…
orronai 9e7dead
Changed the notifications viewed logic of reading
orronai 48d4811
fix merge conflicts
orronai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
- Merged with master branch
- Fixed translations - Added a toast on the bast.html file - Added toast while changing mail subscription
- Loading branch information
commit b741e53f536535e9cd38851d213ca61fb1519268
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -118,17 +118,41 @@ function trackReadAllNotificationsButton(button) { | |
| }); | ||
| } | ||
|
|
||
| function subscriptionToast(toastObject, title, body) { | ||
| const today = new Date().toLocaleString(); | ||
| document.getElementById('toast-strong').innerHTML = title; | ||
| document.getElementById('toast-small').innerHTML = today; | ||
| document.getElementById('toast-body').innerHTML = body; | ||
| const toast = new bootstrap.Toast(toastObject); | ||
| toast.show() | ||
| } | ||
|
|
||
| function trackMailSubscriptionCheckbox() { | ||
| const checkbox = document.getElementById('mail-subscription-checkbox'); | ||
| const toastObject = document.getElementById('toast'); | ||
| if (checkbox === null) { | ||
| return; | ||
| } | ||
|
|
||
| checkbox.addEventListener('change', (e) => { | ||
| const subscription = (e.currentTarget.checked) ? 'subscribe' : 'unsubscribe'; | ||
| const request = new XMLHttpRequest(); | ||
| request.open('PATCH', `/mail/${subscription}`); | ||
| return request.send(); | ||
| const xhr = new XMLHttpRequest(); | ||
| xhr.open('PATCH', `/mail/${subscription}`); | ||
| xhr.setRequestHeader('Content-Type', 'application/json'); | ||
| xhr.responseType = 'json'; | ||
| xhr.onreadystatechange = () => { | ||
| if (xhr.readyState === 4) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's the same as all the other xhr's in the JS files |
||
| if (xhr.status === 200) { | ||
| const title = xhr.response.title; | ||
| const body = xhr.response.body; | ||
| subscriptionToast(toastObject, title, body); | ||
| } else { | ||
| console.log(xhr.status); | ||
| } | ||
| } | ||
| }; | ||
| xhr.send(''); | ||
| return xhr; | ||
| }); | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You are viewing a condensed version of this merge commit. You can view the full changes here.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
move
'subscribe'and'unsubscribe'to enum and replace the usage