mozillabrasil / sumo_live_helper

Helper Add-on for SUMO forum contributors
https://addons.mozilla.org/firefox/addon/sumo-live-helper-/
Mozilla Public License 2.0
7 stars 8 forks source link

Hungarian queue has stopped working #198

Open meskobalazs opened 3 months ago

meskobalazs commented 3 months ago

Description

I'm no longer receiving notifications for the Hungarian queue. English still works perfectly fine.

Steps to Reproduce

  1. Open the settings
  2. Select all products and Hungarian for language
  3. Refresh

Expected behavior:

I should receive notifications for the new threads.

Actual behavior:

There are no notifications for the queue.

System information

jhonatasrm commented 3 months ago

image

Hello @meskobalazs,

Today we requested questions from the forum that have not been answered, and in this case, none meet the criteria. In the future, we may add an option that does not include this parameter of 0 community contribution interactions.

I believe could be a good addition, what do you think @WesleyBranton and @dannycolin ?

dannycolin commented 3 months ago

I believe could be a good addition, what do you think

I'm fine with offering this option if someone wants to contribute a patch.

jhonatasrm commented 3 months ago

Yes, it looks good to me. I think a good addition would be an option to filter for open questions (not set as resolved) with or without interactions from the community.

meskobalazs commented 3 months ago

What I find puzzling is that this request yields results currently: https://support.mozilla.org/api/2/question/?format=json&ordering=-id&is_solved=false&is_spam=false&is_locked=false&is_archived=false&locale=hu&num_answers=0.

Even filtering for product is working. But still, the extension does not show anything.

Edit: I managed to open it in the debugger. One potential problem I found was the product name is apparently wrong in the queries. product=Firefox and product=Thunderbird yields no results, but if I make them lowercase, they do.

jhonatasrm commented 3 months ago

Currently, we notice that when we send the product name using the Upper Camel Case pattern (Firefox, Thunderbird...), it impacts the display of the expected result, constituting a bug. We must also analyze the handling of other product names in this regard.

We need to pass the product name using Lower Camel Case (firefox, thunderbird...).

Current querying by product:

Firefox: https://support.mozilla.org/api/2/question/?format=json&ordering=-id&is_solved=false&is_spam=false&is_locked=false&product=Firefox&is_taken=false&is_archived=false&locale=hu&num_answers=0 Thunderbird: https://support.mozilla.org/api/2/question/?format=json&ordering=-id&is_solved=false&is_spam=false&is_locked=false&product=Thunderbird&is_taken=false&is_archived=false&locale=hu&num_answers=0

Desired querying:

Firefox: https://support.mozilla.org/api/2/question/?format=json&ordering=-id&is_solved=false&is_spam=false&is_locked=false&product=firefox&is_taken=false&is_archived=false&locale=hu&num_answers=0 Thunderbird: https://support.mozilla.org/api/2/question/?format=json&ordering=-id&is_solved=false&is_spam=false&is_locked=false&product=thunderbird&is_taken=false&is_archived=false&locale=hu&num_answers=0

Additionally, we have another function that checks the creation time of the question to determine if it should be displayed within a certain deadline.

function isWithinTimeRange(timeString) {
    const timeLimit = 24;     // In hours
    let currentTime = new Date();
    const timezone = currentTime.getTimezoneOffset() * 60 * 1000;     // Must manually remove the timezone offset
    currentTime = new Date(currentTime - timezone);                   // because SUMO API displays a local timestamp, but labels it UTC
    const minimumTime = currentTime.getTime() - (timeLimit * 3600000);
    const questionTime = new Date(timeString).getTime();

    return questionTime >= minimumTime;
}

P.S. It appears that this issue is only present in Hungarian. However, we must also examine other languages to verify how the request to the product on the API is sent, whether it's in Lower Camel Case or Upper Camel Case.

jhonatasrm commented 3 months ago

I'll be addressing this bug. Additionally, I've created an enhancement issue directly linked to the bug of this filter for Hungarian. It is: