Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
Add cache rewriting for ratings on purchase (bug 838848)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbasta committed Jul 1, 2013
1 parent e986245 commit c40a1ff
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions hearth/media/js/install.js
@@ -1,8 +1,8 @@
// Hey there! I know how to install apps. Buttons are dumb now.

define('install',
['apps', 'cache', 'capabilities', 'defer', 'jquery', 'l10n', 'log', 'login', 'models', 'notification', 'payments/payments', 'requests', 'tracking', 'urls', 'user', 'z'],
function(apps, cache, caps, defer, $, l10n, log, login, models, notification, payments, requests, tracking, urls, user, z) {
['apps', 'cache', 'capabilities', 'defer', 'jquery', 'l10n', 'log', 'login', 'models', 'notification', 'payments/payments', 'requests', 'tracking', 'urls', 'user', 'views', 'z'],
function(apps, cache, caps, defer, $, l10n, log, login, models, notification, payments, requests, tracking, urls, user, views, z) {
'use strict';

var console = log('install');
Expand Down Expand Up @@ -74,6 +74,13 @@ define('install',

// Bust the cache
cache.bust(urls.api.url('installed'));
cache.rewrite(function(key) {
return key === urls.api.params('reviews', {app: product.slug});
}, function(data) {
data.user.can_rate = true;
return data;
});
views.reload();
}

function purchaseError(product, msg) {
Expand Down

0 comments on commit c40a1ff

Please sign in to comment.