ripple-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arzhan Kinzhalin (JIRA)" <j...@apache.org>
Subject [jira] [Created] (RIPPLE-85) notifications: button index is incremented twice
Date Fri, 15 May 2015 04:26:59 GMT
Arzhan Kinzhalin created RIPPLE-85:
--------------------------------------

             Summary: notifications: button index is incremented twice
                 Key: RIPPLE-85
                 URL: https://issues.apache.org/jira/browse/RIPPLE-85
             Project: Apache Ripple
          Issue Type: Bug
            Reporter: Arzhan Kinzhalin


[notifications.js:92|https://github.com/apache/incubator-ripple/blob/master/lib/client/notifications.js#L92]
{code:title=lib/client/notifications.js}
    btnArray.forEach(function(btnLabel,index) {
        var button = {};
        button["text"] = btnLabel;
        button["click"] = function () {
            if(resultCallback !== typeof "undefined")
                resultCallback(index+1);
            jQuery( this ).dialog( "close" );
        };
        buttons.push(button);
    });
{code}
[lib/client/platform/cordova/2.0.0/bridge/notification.js:43|https://github.com/apache/incubator-ripple/blob/master/lib/client/platform/cordova/2.0.0/bridge/notification.js#L43]
{code:title=lib/client/platform/cordova/2.0.0/bridge/notification.js}
        var callback = resultCallback && function(r) {
            resultCallback(++r);
        };

        notifications.confirmNotification(message, callback, title, buttonLabels);
    },
{code}
The latter calls the former and in both cases the index is adjusted to be 1-based instead
of 0-based.

Also, the check {{if(resultCallback !== typeof "undefined")}} does not make any sense: it
ensures {{resultCallback}} is not a string {{"string"}}. Should be just {{typeof resultCalback
!== "undefined"}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message