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

Subscription request returns null #788

Closed
SystemKeeper opened this issue Jan 27, 2020 · 6 comments
Closed

Subscription request returns null #788

SystemKeeper opened this issue Jan 27, 2020 · 6 comments

Comments

@SystemKeeper
Copy link

After setting the notification checkbox on the poll site, the notification is correctly saved, but after a reload, the checkbox is gone again (though notifications are still working!). I've seen that a call to subscription/get returns null:
image

Here's output of oc_polls_notif:

mysql> Select * FROM oc_polls_notif;
+----+---------+------------------+
| id | poll_id | user_id          |
+----+---------+------------------+
|  1 |       5 | user1            |
|  2 |       5 | user2            |
|  3 |       5 | user2            |
+----+---------+------------------+
3 rows in set (0,00 sec)

In this case I am user2. I had a quick look through the code, but didn't see anything obvious to me.

@dartcafe
Copy link
Collaborator

null is correct. Returncode 200 says, subscription set, 404 says not set.

@SystemKeeper
Copy link
Author

Ah I see. Will have a look why the checkbox sometimes indicates a wrong state.
Other than that, shouldn't (poll_id, user_id) be unique in the db?

@SystemKeeper
Copy link
Author

@dartcafe I've tested a bit around (still on 1.1.5, sorry) and it looks like the request to subscription/get/ is not made, when a poll is selected on the left side (only when I reload the page). I guess (not tested) it's because the dispatch is only made in the mounted event, not in a watch event as seen in the comments:

watch: {
$route() {
this.loadPoll()
}
},

?

@SystemKeeper
Copy link
Author

Ok, I'm still figuering things out here... Sorry not too familiar with Vue.

Have a look at the following:

/polls/src/js$ grep -R "loadPoll(" *
store/modules/votes.js: loadPoll(context, payload) {
store/modules/comments.js:      loadPoll(context, payload) {
store/modules/options.js:       loadPoll(context, payload) {
store/modules/shares.js:        loadPoll(context, payload) {
views/PublicVote.vue:                   this.loadPoll()
views/PublicVote.vue:           this.loadPoll()
views/PublicVote.vue:           loadPoll() {
views/Vote.vue:                 this.loadPoll()
views/Vote.vue:         this.loadPoll()
views/Vote.vue:         loadPoll() {

I guess when a poll is selected the loadPoll action in all modules is called. But as you can see, there's no loadPoll option for subscription. Is that's what's missing here?

@dartcafe
Copy link
Collaborator

The subscription is loaded on mounting the component. But there has to be a watcher on route changes.

@dartcafe
Copy link
Collaborator

fixed in beta3

@dartcafe dartcafe mentioned this issue Jan 28, 2020
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

No branches or pull requests

2 participants