Commit 8b44f7b1 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Completely remove comment action types.

Users aren't really able to decide whether they just want to post a
comment or report a problem.  Practice showed that the "problem" action
was used more or less randomly.  So getting rid of it completely.

Removed the whole action-combo and related HTML.  Incorporated some of
the help text into the general commenting help section.

To clean up "action" field from database, run:

    db.comments.update({}, {$unset: {action: 1}}, false, true)
parent 281f2ae1
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -256,7 +256,6 @@ app.post('/auth/:sdk/:version/comments', util.requireLoggedInUser, function(req,
        author: req.session.user.username,
        userId: req.session.user.userid,
        content: req.body.comment,
        action: req.body.action,
        rating: Number(req.body.rating),
        contentHtml: util.markdown(req.body.comment),
        downVotes: [],
@@ -272,7 +271,7 @@ app.post('/auth/:sdk/:version/comments', util.requireLoggedInUser, function(req,
    });

    comment.saveNew(req.session.user, function(err) {
        res.json({ success: true, id: comment._id, action: req.body.action });
        res.json({ success: true, id: comment._id });

        util.sendEmailUpdates(comment);
    });
+0 −1
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@ CommentSchema = new mongoose.Schema({
    sdk:         String,
    version:     String,

    action:      String,
    author:      String,
    userId:      Number,
    content:     String,
+0 −2
Original line number Diff line number Diff line
@@ -204,7 +204,6 @@ Ext.define('Docs.controller.Comments', {
            encodedTarget = Ext.JSON.encode(target),
            textarea = comments.down('textarea').dom,
            comment = textarea.editor.getValue(),
            action = comments.down('.commentAction').getValue(),
            feedbacks = comments.select('[name=feedback]');

        var feedbackRating = null;
@@ -252,7 +251,6 @@ Ext.define('Docs.controller.Comments', {
                target: encodedTarget,
                comment: comment,
                rating: feedbackRating,
                action: action,
                title: title,
                url: "http://" + window.location.host + window.location.pathname + urlPrefix + url
            },
+15 −46
Original line number Diff line number Diff line
@@ -61,9 +61,6 @@ Ext.define('Docs.view.Comments', {
                        '<tpl if="showCls">',
                            '<span class="target"> on {[this.target(values.target)]}</span>',
                        '</tpl>',
                        '<tpl if="action == \'problem\'">',
                            '<span class="problem">problem</span>',
                        '</tpl>',
                    '</div>',
                    '<tpl if="this.isMod()">',
                        '<a href="#" class="readComment <tpl if="read">read</tpl>">Read</a>',
@@ -194,8 +191,20 @@ Ext.define('Docs.view.Comments', {
            '</div>',
            '<div class="commentGuideTxt" style="display: none">',
                '<ul>',
                    '<li>Comments should be an <strong>extension</strong> of the documentation.</li>',
                    '<li>For any <em>questions</em> about code or usage, please use the <a href="http://www.sencha.com/forum" target="_blank">Forum</a>.</li>',
                    '<li>Comments should be an <strong>extension</strong> of the documentation.<br>',
                    ' Inform us about bugs in documentation.',
                    ' Give useful tips to other developers.',
                    ' Warn about bugs and problems that might bite.',
                    '</li>',
                    "<li>Don't post comments for:",
                    '<ul>',
                        '<li><strong>Questions about code or usage</strong>',
                        ' - use the <a href="http://www.sencha.com/forum" target="_blank">Sencha Forum</a>.</li>',
                        '<li><strong>SDK bugs</strong>',
                        ' - use the <a href="http://www.sencha.com/forum" target="_blank">Sencha Forum</a>.</li>',
                        '<li><strong>Docs App bugs</strong>',
                        ' - use the <a href="https://github.com/senchalabs/jsduck/issues" target="_blank">GitHub Issue tracker</a>.</li>',
                    '</ul></li>',
                    '<li>Comments may be edited or deleted at any time by a moderator.</li>',
                    '<li>Avatars can be managed at <a href="http://www.gravatar.com" target="_blank">Gravatar</a> (use your forum email address).</li>',
                    '<li>Comments will be formatted using the Markdown syntax, eg:</li>',
@@ -217,7 +226,7 @@ Ext.define('Docs.view.Comments', {
                        "- Here is an unordered list\n",
                        "- Second unordered list item\n",
                        "\n",
                        "End a line with two spaces\n",
                        "End a line with two spaces&nbsp;&nbsp;\n",
                        "to create a line break\n",
                    '</pre>',
                '</div>',
@@ -247,27 +256,6 @@ Ext.define('Docs.view.Comments', {
        this.loggedInCommentTpl = Ext.create('Ext.XTemplate',
            '<div class="new-comment{[values.hide ? "" : " open"]}">',
                '<form class="newCommentForm">',
                    '<span class="action">',
                        'Action: ',
                        '<select class="commentAction">',
                            '<option value="comment">Post a comment</option>',
                            '<option value="question">Ask a question</option>',
                            '<option value="problem">Report a problem</option>',
                        '</select>',
                    '</span>',
                    '<div class="note question" style="display: none;">',
                        'Please use the <a href="http://www.sencha.com/forum" target="_blank">Sencha Forum</a> ',
                        'to post questions. Questions posted on the Documentation may be deleted.</div>',
                    '<div class="note problem" style="display: none;">',
                        '<p>Please inform us of documentation problems:</p>',
                        '<ul>',
                            '<li>Typos</li>',
                            '<li>Incorrect information</li>',
                            '<li>Errors with examples</li>',
                        '</ul>',
                        '<p>For <b>SDK bugs</b>, please use the <a href="http://www.sencha.com/forum" target="_blank">Sencha Forum</a>.<br />',
                        '   For Docs App bugs, please use the <a href="https://github.com/senchalabs/jsduck/issues" target="_blank">GitHub Issue tracker</a>.</p>',
                    '</div>',
                    '<div class="postCommentWrap">',
                        '<textarea></textarea>',
                        commentMetaAndGuide.join(''),
@@ -476,25 +464,6 @@ Ext.define('Docs.view.Comments', {
            lineWrapping: true,
            indentUnit: 4
        });

        var action = (form && form.down('.commentAction'));
        if (action) {
            action.on('change', function(evt, el) {
                var val = Ext.get(el).getValue();
                form.select('.note').setStyle({display: 'none'});
                if (val === "question") {
                    form.down('.postCommentWrap').setStyle({display: 'none'});
                    form.down('.note.question').setStyle({display: 'block'});
                }
                else if (val === "problem") {
                    form.down('.postCommentWrap').setStyle({display: 'block'});
                    form.down('.note.problem').setStyle({display: 'block'});
                }
                else {
                    form.down('.postCommentWrap').setStyle({display: 'block'});
                }
            });
        }
    },

    showMember: function(cls, member) {
+1 −8
Original line number Diff line number Diff line
@@ -213,14 +213,7 @@
      top: 2px;
      font-size: 14px;
      &.moderator {
        color: #3D7E00; }
      .problem {
        color: #fff;
        @include border-radius(2px);
        font-size: 0.7em;
        margin-left: 10px;
        padding: 0 3px 1px 3px;
        background-color: #aa0000; } }
        color: #3D7E00; } }
    .time {
      position: absolute;
      right: 20px;