Fixed anonymous user not adding activity on play

This commit is contained in:
Fergal Moran
2013-06-15 20:00:07 +01:00
parent 0c98410bf3
commit 7601c53d73
6 changed files with 30 additions and 34 deletions

View File

@@ -141,6 +141,9 @@ class Mix(_BaseModel):
try:
if user.is_authenticated():
ActivityPlay(user=user.get_profile(), mix=self).save()
else:
ActivityPlay(user=None, mix=self).save()
except Exception, e:
self.logger.exception("Unable to add mix play: %s" % e.message)

View File

@@ -1,18 +1,18 @@
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.3.3
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
define(['app', 'marionette', 'vent'], function(App, Marionette, vent) {
var AudioController, _ref;
var AudioController;
AudioController = (function(_super) {
__extends(AudioController, _super);
function AudioController() {
this.mixInit = __bind(this.mixInit, this); _ref = AudioController.__super__.constructor.apply(this, arguments);
return _ref;
this.mixInit = __bind(this.mixInit, this);
return AudioController.__super__.constructor.apply(this, arguments);
}
AudioController.prototype.initialize = function(options) {
@@ -25,7 +25,6 @@
AudioController.prototype.mixInit = function(model) {
var id,
_this = this;
console.log("AudioController: mixInit");
id = model.get('id');
return $.getJSON("/ajax/mix_stream_url/" + id + "/", function(data) {

View File

@@ -1,22 +1,26 @@
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.3.3
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
define(['moment', 'app', 'vent', 'marionette', 'models/comment/commentCollection', 'views/comment/commentListView', 'text!/tpl/MixListItemView'], function(moment, App, vent, Marionette, CommentsCollection, CommentsListView, Template) {
var MixItemView, _ref;
var MixItemView;
MixItemView = (function(_super) {
__extends(MixItemView, _super);
function MixItemView() {
this.doStart = __bind(this.doStart, this);
this.renderComments = __bind(this.renderComments, this);
this.renderGenres = __bind(this.renderGenres, this);
this.onRender = __bind(this.onRender, this);
this.initialize = __bind(this.initialize, this); _ref = MixItemView.__super__.constructor.apply(this, arguments);
return _ref;
this.initialize = __bind(this.initialize, this);
return MixItemView.__super__.constructor.apply(this, arguments);
}
MixItemView.prototype.template = _.template(Template);
@@ -50,7 +54,6 @@
MixItemView.prototype.onRender = function() {
var id, totalDuration, totalDurationText;
id = this.model.get('id');
if (this.model.get('duration')) {
totalDuration = moment.duration(this.model.get('duration'), "seconds");
@@ -65,7 +68,6 @@
MixItemView.prototype.renderGenres = function() {
var el;
el = this.el;
$.each(this.model.get("genre-list"), function(data) {
$("#genre-list", el).append('<a href="/mixes/' + this.slug + '" class="dss-tag-button">' + this.text + '</a>');
@@ -76,7 +78,6 @@
MixItemView.prototype.renderComments = function() {
var comments;
comments = new CommentsCollection();
comments.url = this.model.get("resource_uri") + "comments/";
comments.mix_id = this.model.id;
@@ -84,7 +85,6 @@
comments.fetch({
success: function(data) {
var content;
console.log(data);
content = new CommentsListView({
collection: comments
@@ -128,7 +128,6 @@
MixItemView.prototype.mixFavourite = function() {
var app;
console.log("MixItemView: favouriteMix");
app = require('app');
app.vent.trigger("mix:favourite", this.model);
@@ -137,7 +136,6 @@
MixItemView.prototype.mixLike = function() {
var app;
console.log("MixItemView: likeMix");
app = require('app');
app.vent.trigger("mix:like", this.model);
@@ -146,7 +144,6 @@
MixItemView.prototype.mixShare = function(e) {
var app, mode;
console.log("MixItemView: shareMix");
mode = $(e.currentTarget).data("mode");
console.log("MixItemView: " + mode);

View File

@@ -1,19 +1,17 @@
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.3.3
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
define(['marionette', 'vent', 'models/mix/mixCollection', 'views/mix/mixItemView', 'text!/tpl/MixListView'], function(Marionette, vent, MixCollection, MixItemView, Template) {
var MixListView, _ref;
var MixListView;
MixListView = (function(_super) {
var currentMix;
__extends(MixListView, _super);
function MixListView() {
_ref = MixListView.__super__.constructor.apply(this, arguments);
return _ref;
return MixListView.__super__.constructor.apply(this, arguments);
}
MixListView.prototype.template = _.template(Template);
@@ -28,7 +26,6 @@
MixListView.prototype.initialize = function() {
var _this = this;
console.log("MixListView: initialize");
this.collection = new MixCollection();
this.collection.fetch({
@@ -45,6 +42,7 @@
MixListView.prototype.mixPlay = function(model) {
console.log("MixListView: mixPlay");
"if currentMix != -1\n v = @children.findByModelCid(currentMix)\n v.mixPause()";
currentMix = model.cid;
};

View File

@@ -1,17 +1,16 @@
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.3.3
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
define(['underscore', 'backbone', 'marionette', 'vent', 'views/activity/activityListView', 'views/widgets/nowPlayingView', 'text!/tpl/SidebarView'], function(_, Backbone, Marionette, vent, ActivityListView, NowPlayingView, Template) {
var SidebarView, _ref;
var SidebarView;
SidebarView = (function(_super) {
__extends(SidebarView, _super);
function SidebarView() {
_ref = SidebarView.__super__.constructor.apply(this, arguments);
return _ref;
return SidebarView.__super__.constructor.apply(this, arguments);
}
SidebarView.prototype.template = _.template(Template);
@@ -37,6 +36,7 @@
this.streamRegion.show(new ActivityListView());
$(this.topRegion.el).hide();
"@topRegion.show(\n new NowPlayingView(\n model: new Backbone.Model({\n item_url: \"fdskjfhdsk\", title: \"Argle bargle\", user_profile_url: \"/\", user_name: \"Foo Ferra\"\n })\n ))";
};
SidebarView.prototype.mixInit = function(model) {

View File

@@ -1,17 +1,16 @@
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.3.3
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
define(['marionette', 'vent', 'text!/tpl/NowPlayingView'], function(Marionette, vent, Template) {
var NowPlayingView, _ref;
var NowPlayingView;
NowPlayingView = (function(_super) {
__extends(NowPlayingView, _super);
function NowPlayingView() {
_ref = NowPlayingView.__super__.constructor.apply(this, arguments);
return _ref;
return NowPlayingView.__super__.constructor.apply(this, arguments);
}
NowPlayingView.prototype.template = _.template(Template);