Merge "Allow the Subscribe directive to work without a list of subscriptions"
This commit is contained in:
commit
b61fbb908b
@ -21,8 +21,7 @@ angular.module('sb.story').controller('StoryDetailController',
|
||||
function ($log, $rootScope, $scope, $state, $stateParams, $modal, Session,
|
||||
Preference, TimelineEvent, Comment, TimelineEventTypes, story,
|
||||
Story, creator, tasks, Task, DSCacheFactory, User, $q,
|
||||
storyboardApiBase, SubscriptionList, CurrentUser,
|
||||
SessionModalService, moment, $document) {
|
||||
storyboardApiBase, SessionModalService, moment, $document) {
|
||||
'use strict';
|
||||
|
||||
var pageSize = Preference.get('story_detail_page_size');
|
||||
@ -510,12 +509,4 @@ angular.module('sb.story').controller('StoryDetailController',
|
||||
},
|
||||
handleServiceError);
|
||||
};
|
||||
|
||||
//GET subscriptions
|
||||
var cuPromise = CurrentUser.resolve();
|
||||
|
||||
cuPromise.then(function(user){
|
||||
$scope.storySubscriptions = SubscriptionList.subsList(
|
||||
'story', user);
|
||||
});
|
||||
});
|
||||
|
@ -56,8 +56,7 @@
|
||||
<i class="fa fa-pencil"></i>
|
||||
</a>
|
||||
<subscribe resource="story"
|
||||
resource-id="story.id"
|
||||
subscriptions="storySubscriptions">
|
||||
resource-id="story.id">
|
||||
</subscribe>
|
||||
<button type="button"
|
||||
class="btn btn-link"
|
||||
|
@ -188,23 +188,22 @@ angular.module('sb.util').directive('subscribe',
|
||||
|
||||
$scope.resolving = true;
|
||||
|
||||
cuPromise.then(
|
||||
function () {
|
||||
angular.forEach($scope.subscriptions,
|
||||
function(subscription) {
|
||||
if ($scope.resourceId ===
|
||||
subscription.target_id) {
|
||||
setSubscription(subscription);
|
||||
}
|
||||
}
|
||||
);
|
||||
$scope.resolving = false;
|
||||
}
|
||||
);
|
||||
cuPromise.then(function () {
|
||||
angular.forEach($scope.subscriptions, function(sub) {
|
||||
if ($scope.resourceId === sub.target_id) {
|
||||
setSubscription(sub);
|
||||
}
|
||||
});
|
||||
$scope.resolving = false;
|
||||
});
|
||||
}
|
||||
|
||||
// On initialization, resolve.
|
||||
$scope.subscriptions.$promise.then(resolveSubsList);
|
||||
if (!!$scope.subscriptions) {
|
||||
$scope.subscriptions.$promise.then(resolveSubsList);
|
||||
} else {
|
||||
resolveSubscription();
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user