mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed Twitter notifications
New: Twitter notifications now require a Twitter (see settings for details) Closes #1049
This commit is contained in:
@@ -4,14 +4,19 @@ var DeepModel = require('backbone.deepmodel');
|
||||
var Messenger = require('../Shared/Messenger');
|
||||
|
||||
module.exports = DeepModel.extend({
|
||||
connectData : function(action, initialQueryString) {
|
||||
connectData : function(action, initialQueryParams) {
|
||||
var self = this;
|
||||
|
||||
this.trigger('connect:sync');
|
||||
|
||||
var promise = $.Deferred();
|
||||
|
||||
var callAction = function(action) {
|
||||
var callAction = function(action, queryParams) {
|
||||
|
||||
if (queryParams) {
|
||||
action = action + '?' + $.param(queryParams, true);
|
||||
}
|
||||
|
||||
var params = {
|
||||
url : self.collection.url + '/connectData/' + action,
|
||||
contentType : 'application/json',
|
||||
@@ -30,11 +35,20 @@ module.exports = DeepModel.extend({
|
||||
{
|
||||
window.open(response.url);
|
||||
var selfWindow = window;
|
||||
|
||||
selfWindow.onCompleteOauth = function(query, callback) {
|
||||
delete selfWindow.onCompleteOauth;
|
||||
|
||||
if (response.nextStep) {
|
||||
callAction(response.nextStep + query);
|
||||
var queryParams = {};
|
||||
var splitQuery = query.substring(1).split('&');
|
||||
|
||||
_.each(splitQuery, function (param) {
|
||||
var paramSplit = param.split('=');
|
||||
queryParams[paramSplit[0]] = paramSplit[1];
|
||||
});
|
||||
|
||||
callAction(response.nextStep, _.extend(initialQueryParams, queryParams));
|
||||
}
|
||||
else {
|
||||
promise.resolve(response);
|
||||
@@ -59,7 +73,7 @@ module.exports = DeepModel.extend({
|
||||
}
|
||||
}
|
||||
if (response.nextStep) {
|
||||
callAction(response.nextStep);
|
||||
callAction(response.nextStep, initialQueryParams);
|
||||
}
|
||||
else {
|
||||
promise.resolve(response);
|
||||
@@ -67,7 +81,7 @@ module.exports = DeepModel.extend({
|
||||
});
|
||||
};
|
||||
|
||||
callAction(action, initialQueryString);
|
||||
callAction(action, initialQueryParams);
|
||||
|
||||
Messenger.monitor({
|
||||
promise : promise,
|
||||
|
Reference in New Issue
Block a user