Gitter migration: Setup redirects (rollout pt. 3)
[gitter.git] / modules / gitlab / lib / issuable-state-service.js
blob4b557bbf6f7b982fb9901d3012008b38fbf95dcf
1 'use strict';
3 var cacheWrapper = require('gitter-web-cache-wrapper');
4 var IssuableService = require('./issuable-service');
5 var getGitlabAccessTokenFromUser = require('./get-gitlab-access-token-from-user');
7 function GitLabIssuableStateService(user, type) {
8 this.type = type || 'issues';
9 this.issuableService = new IssuableService(user, this.type);
10 this.getAccessTokenPromise = getGitlabAccessTokenFromUser(user);
13 GitLabIssuableStateService.prototype.getIssueState = function(project, iid) {
14 return this.issuableService.getIssue(project, iid).then(function(issuable) {
15 return issuable.state;
16 });
19 module.exports = cacheWrapper('GitLabIssuableStateService', GitLabIssuableStateService, {
20 getInstanceId: function(gitLabIssuableStateService) {
21 return gitLabIssuableStateService.getAccessTokenPromise;
23 });