Esempio n. 1
0
        async public Task <bool> IsApprovalStatusSupported()
        {
            if (_isApprovalStatusSupportedCached.HasValue)
            {
                return(_isApprovalStatusSupportedCached.Value);
            }

            GitLabVersion version = await getVersionAsync();

            if (version != null)
            {
                _isApprovalStatusSupportedCached = isApprovalStatusSupported(version);
                return(_isApprovalStatusSupportedCached.Value);
            }
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// This is a VERY simplified way of functionality checking because GitLab has complicated editions and plans.
        /// TODO: Make approval status support check better.
        /// </summary>
        private bool isApprovalStatusSupported(GitLabVersion version)
        {
            Debug.Assert(version != null);

            Match m = GitLabVersionRegex.Match(version.Version);

            if (m.Success &&
                m.Groups["major_version"].Success &&
                int.TryParse(m.Groups["major_version"].Value, out int major_version) &&
                m.Groups["minor_version"].Success &&
                int.TryParse(m.Groups["minor_version"].Value, out int minor_version))
            {
                System.Version gitLabVersion = new System.Version(major_version, minor_version);
                return(gitLabVersion >= EarliestGitLabVersionWithApprovalsSupport);
            }
            return(false);
        }