Skip to content

Commit

Permalink
Merge pull request #2902 from travis-ci/release_240918
Browse files Browse the repository at this point in the history
Release 2024 09 18
  • Loading branch information
DominikAlberski committed Sep 18, 2024
2 parents 6a1100e + a67609c commit 7dcd29d
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 18 deletions.
4 changes: 4 additions & 0 deletions app/components/billing/summary-v2.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ export default Component.extend({
return !this.showPlansSelector && !this.showAddonsSelector; return !this.showPlansSelector && !this.showAddonsSelector;
}), }),
showUserManagementModal: false, showUserManagementModal: false,

subscriptionExpiredPrefix: computed('subscription.validTo', function () {
return Date.now() > Date.parse(this.subscription.validTo) ? 'Expired' : 'Expires';
}),
}); });
4 changes: 4 additions & 0 deletions app/components/billing/summary.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ export default Component.extend({
return []; return [];
} }
}), }),

subscriptionExpiredPrefix: computed('subscription.validTo', function () {
return Date.now() > Date.parse(this.subscription.validTo) ? 'Expired' : 'Expires';
}),
}); });
4 changes: 2 additions & 2 deletions app/templates/components/billing/summary-v2.hbs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
{{else if this.isIncomplete}} {{else if this.isIncomplete}}
Incomplete Incomplete
{{else if (and this.isComplete this.isCanceled)}} {{else if (and this.isComplete this.isCanceled)}}
Expires {{moment-from-now this.subscription.validTo}} on {{moment-format this.subscription.validTo "MMMM DD"}} {{this.subscriptionExpiredPrefix}} on {{moment-format this.subscription.validTo "MMMM D, YYYY"}}
{{else if (and this.isComplete this.isExpired)}} {{else if (and this.isComplete this.isExpired)}}
Expired {{moment-format this.subscription.validTo "MMMM D, YYYY"}} {{this.subscriptionExpiredPrefix}} on {{moment-format this.subscription.validTo "MMMM D, YYYY"}}
{{/if}} {{/if}}
</span> </span>


Expand Down
6 changes: 3 additions & 3 deletions app/templates/components/billing/summary.hbs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
{{#if this.isGithubSubscription}} {{#if this.isGithubSubscription}}
Cancelled on {{moment-format this.subscription.validTo "MMMM D, YYYY"}} Cancelled on {{moment-format this.subscription.validTo "MMMM D, YYYY"}}
{{else}} {{else}}
Expires {{moment-from-now this.subscription.validTo}} on {{moment-format this.subscription.validTo "MMMM DD"}} {{this.subscriptionExpiredPrefix}} on {{moment-format this.subscription.validTo "MMMM D, YYYY"}}
{{/if}} {{/if}}
{{else if (and this.isComplete this.subscription.cancellationRequested)}} {{else if (and this.isComplete this.subscription.cancellationRequested)}}
Expires {{moment-from-now this.subscription.validTo}} on {{moment-format this.subscription.validTo "MMMM DD"}}, cancellation requested Expires {{moment-from-now this.subscription.validTo}} on {{moment-format this.subscription.validTo "MMMM D"}}, cancellation requested
{{else if (and this.isComplete this.isExpired)}} {{else if (and this.isComplete this.isExpired)}}
Expired {{moment-format this.subscription.validTo "MMMM D, YYYY"}} {{this.subscriptionExpiredPrefix}} on {{moment-format this.subscription.validTo "MMMM D, YYYY"}}
{{/if}} {{/if}}
</span> </span>
{{/if}} {{/if}}
Expand Down
20 changes: 14 additions & 6 deletions tests/acceptance/profile/billing-test.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { module, skip, test } from 'qunit';
import { setupApplicationTest } from 'travis/tests/helpers/setup-application-test'; import { setupApplicationTest } from 'travis/tests/helpers/setup-application-test';
import profilePage from 'travis/tests/pages/profile'; import profilePage from 'travis/tests/pages/profile';
import topPage from 'travis/tests/pages/top'; import topPage from 'travis/tests/pages/top';
import moment from 'moment';
import signInUser from 'travis/tests/helpers/sign-in-user'; import signInUser from 'travis/tests/helpers/sign-in-user';
import { selectChoose } from 'ember-power-select/test-support'; import { selectChoose } from 'ember-power-select/test-support';
import Service from '@ember/service'; import Service from '@ember/service';
Expand Down Expand Up @@ -417,15 +416,14 @@ module('Acceptance | profile/billing', function (hooks) {


test('view billing on a canceled stripe plan', async function (assert) { test('view billing on a canceled stripe plan', async function (assert) {
this.subscription.status = 'canceled'; this.subscription.status = 'canceled';
const momentFromNow = moment(this.subscription.valid_to.getTime()).fromNow();


await profilePage.visit(); await profilePage.visit();
await profilePage.billing.visit(); await profilePage.billing.visit();


assert.equal(profilePage.billing.plan.name, 'Small Business1 plan canceled'); assert.equal(profilePage.billing.plan.name, 'Small Business1 plan canceled');
assert.equal(profilePage.billing.planMessage.text, `Expires ${momentFromNow} on June 19`); assert.equal(profilePage.billing.planMessage.text, 'Expired on June 19, 2018');


assert.dom(profilePage.billing.planMessage.scope).hasText(`Expires ${momentFromNow} on June 19`); assert.dom(profilePage.billing.planMessage.scope).hasText('Expired on June 19, 2018');


assert.equal(profilePage.billing.price.text, '$69'); assert.equal(profilePage.billing.price.text, '$69');
assert.equal(profilePage.billing.period.text, '/month'); assert.equal(profilePage.billing.period.text, '/month');
Expand Down Expand Up @@ -455,10 +453,20 @@ module('Acceptance | profile/billing', function (hooks) {
await profilePage.billing.visit(); await profilePage.billing.visit();


assert.equal(profilePage.billing.plan.name, 'Small Business1 plan expired manual subscription'); assert.equal(profilePage.billing.plan.name, 'Small Business1 plan expired manual subscription');
assert.equal(profilePage.billing.planMessage.text, 'Expired July 16, 2018'); assert.equal(profilePage.billing.planMessage.text, 'Expired on July 16, 2018');
assert.equal(profilePage.billing.price.text, '$69'); assert.equal(profilePage.billing.price.text, '$69');
}); });


test('view billing on an expired manual plan with future expiration date', async function (assert) {
this.subscription.status = 'canceled';
this.subscription.valid_to = new Date(2028, 6, 16).toISOString();

await profilePage.visit();
await profilePage.billing.visit();

assert.equal(profilePage.billing.planMessage.text, 'Expires on July 16, 2028');
});

test('view billing on a marketplace plan', async function (assert) { test('view billing on a marketplace plan', async function (assert) {
this.trial.destroy(); this.trial.destroy();
this.subscription.source = 'github'; this.subscription.source = 'github';
Expand Down Expand Up @@ -626,7 +634,7 @@ module('Acceptance | profile/billing', function (hooks) {
assert.ok(profilePage.billing.annualInvitation.isHidden); assert.ok(profilePage.billing.annualInvitation.isHidden);


assert.equal(profilePage.billing.plan.name, 'Small Business1 plan expired github marketplace subscription'); assert.equal(profilePage.billing.plan.name, 'Small Business1 plan expired github marketplace subscription');
assert.equal(profilePage.billing.planMessage.text, 'Expired June 19, 2018'); assert.equal(profilePage.billing.planMessage.text, 'Expired on June 19, 2018');
}); });


test('view billing on an annual plan', async function (assert) { test('view billing on an annual plan', async function (assert) {
Expand Down
10 changes: 4 additions & 6 deletions tests/integration/components/billing/summary-test.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ module('Integration | Component | billing-summary', function (hooks) {
}); });


test('it renders canceled subscription', async function (assert) { test('it renders canceled subscription', async function (assert) {
const momentFromNow = moment(this.subscription.validTo.getTime()).fromNow();

this.set('subscription', { this.set('subscription', {
...this.subscription, ...this.subscription,
status: 'canceled', status: 'canceled',
Expand All @@ -84,8 +82,8 @@ module('Integration | Component | billing-summary', function (hooks) {


assert.dom('h3').hasText('Plan information'); assert.dom('h3').hasText('Plan information');
assert.equal(profilePage.billing.plan.name, 'A plan canceled'); assert.equal(profilePage.billing.plan.name, 'A plan canceled');
assert.dom(profilePage.billing.plan.concurrency.scope).hasTextContaining(`5 concurrent jobs Expires ${momentFromNow} on June 19`); assert.dom(profilePage.billing.plan.concurrency.scope).hasTextContaining('5 concurrent jobs Expired on June 19, 2018');
assert.equal(profilePage.billing.planMessage.text, `Expires ${momentFromNow} on June 19`); assert.equal(profilePage.billing.planMessage.text, 'Expired on June 19, 2018');
assert.equal(profilePage.billing.price.text, '$129'); assert.equal(profilePage.billing.price.text, '$129');
assert.equal(profilePage.billing.period.text, '/month'); assert.equal(profilePage.billing.period.text, '/month');
}); });
Expand All @@ -109,8 +107,8 @@ module('Integration | Component | billing-summary', function (hooks) {


assert.dom('h3').hasText('Plan information'); assert.dom('h3').hasText('Plan information');
assert.equal(profilePage.billing.plan.name, 'A plan expired'); assert.equal(profilePage.billing.plan.name, 'A plan expired');
assert.dom(profilePage.billing.plan.concurrency.scope).hasTextContaining(`5 concurrent jobs Expired ${date}`); assert.dom(profilePage.billing.plan.concurrency.scope).hasTextContaining(`5 concurrent jobs Expired on ${date}`);
assert.equal(profilePage.billing.planMessage.text, `Expired ${date}`); assert.equal(profilePage.billing.planMessage.text, `Expired on ${date}`);
assert.equal(profilePage.billing.price.text, '$129'); assert.equal(profilePage.billing.price.text, '$129');
assert.equal(profilePage.billing.period.text, '/month'); assert.equal(profilePage.billing.period.text, '/month');
}); });
Expand Down
5 changes: 4 additions & 1 deletion waiter/config.ru
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ run Travis::Web::App.build(
enable_feature_flags: ENV['ENABLE_FEATURE_FLAGS'], enable_feature_flags: ENV['ENABLE_FEATURE_FLAGS'],
stripe_publishable_key: ENV['STRIPE_PUBLISHABLE_KEY'], stripe_publishable_key: ENV['STRIPE_PUBLISHABLE_KEY'],
default_provider: ENV['DEFAULT_PROVIDER'], default_provider: ENV['DEFAULT_PROVIDER'],
log_limit: ENV['LOG_LIMIT'] log_limit: ENV['LOG_LIMIT'],
auth_endpoint: ENV['AUTH_ENDPOINT'],
api_trace_endpoint: ENV['API_TRACE_ENDPOINT'],
intercom_app_id: ENV['INTERCOM_APP_ID']
) )
end end
46 changes: 46 additions & 0 deletions waiter/lib/travis/web/app.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit
config['featureFlags']['enterprise-version'] = true config['featureFlags']['enterprise-version'] = true
end end


if ENV['REDIRECT']
config['featureFlags']['redirect'] = true
end

if options[:github_apps_app_name] if options[:github_apps_app_name]
config['githubApps'] ||= {} config['githubApps'] ||= {}
config['githubApps']['appName'] = options[:github_apps_app_name] config['githubApps']['appName'] = options[:github_apps_app_name]
Expand All @@ -222,6 +226,8 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit


config['defaultTitle'] = title config['defaultTitle'] = title
config['apiEndpoint'] = options[:api_endpoint] if options[:api_endpoint] config['apiEndpoint'] = options[:api_endpoint] if options[:api_endpoint]
config['authEndpoint'] = options[:auth_endpoint] if options[:auth_endpoint]
config['apiTraceEndpoint'] = options[:api_trace_endpoint] if options[:api_trace_endpoint]
config['githubAppsEndpoint'] = options[:github_apps_endpoint] config['githubAppsEndpoint'] = options[:github_apps_endpoint]
source_endpoint = options[:source_endpoint] source_endpoint = options[:source_endpoint]
if source_endpoint if source_endpoint
Expand Down Expand Up @@ -262,6 +268,10 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit
config['providers'][provider]['isDefault'] = true config['providers'][provider]['isDefault'] = true
end end


config['intercom'] ||= {}
config['intercom']['appid']= options[:intercom_app_id] || 'placeholder'
config['intercom']['enabled'] = !!options[:intercom_app_id]

if ENV['ENDPOINT_PORTFOLIO'] if ENV['ENDPOINT_PORTFOLIO']
config['providers'] ||= {} config['providers'] ||= {}
config['providers']['assembla'] ||= {} config['providers']['assembla'] ||= {}
Expand All @@ -282,10 +292,46 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit
config['aida'] = aida config['aida'] = aida
end end


config['metricsAdapters'] = []
if ENV['GOOGLE_ANALYTICS_ID']
config['metricsAdapters'].push( {
name: 'GoogleAnalytics',
environments: ['development', 'production'],
config: {
id: ENV['GOOGLE_ANALYTICS_ID'],
debug: @options[:environment] === 'development',
trace: @options[:environment] === 'development',
sendHitTask: @options[:environment] != 'development',
}
})
end

if ENV['GOOGLE_TAGS_CONTAINER_ID']
config['metricsAdapters'].push( {
name: 'GoogleTagManager',
config: ENV['GOOGLE_TAGS_CONTAINER_ID'],
envParams: ENV['GOOGLE_TAGS_PARAMS']
})
end

config['gReCaptcha'] ||= {}
if ENV['GOOGLE_RECAPTCHA_SITE_KEY']
config['gReCaptcha']['siteKey'] = ENV['GOOGLE_RECAPTCHA_SITE_KEY']
end


if ENV['TRIAL_DAYS'] if ENV['TRIAL_DAYS']
config['trialDays'] = ENV['TRIAL_DAYS'] config['trialDays'] = ENV['TRIAL_DAYS']
end end


if ENV['DISABLE_SENTRY']
config['sentry']['development'] = true
end

config['tempBanner'] ||= {}
config['tempBanner']['tempBannerEnabled'] = ENV['TEMPORARY_ANNOUNCEMENT_BANNER_ENABLED'] || false
config['tempBanner']['tempBannerMessage'] = ENV['TEMPORARY_ANNOUNCEMENT_MESSAGE'] || ''

regexp = %r{<meta name="travis/config/environment"\s+content="([^"]+)"} regexp = %r{<meta name="travis/config/environment"\s+content="([^"]+)"}
string.gsub!(regexp) do string.gsub!(regexp) do
ember_config = JSON.parse(CGI.unescape(::Regexp.last_match(1))) ember_config = JSON.parse(CGI.unescape(::Regexp.last_match(1)))
Expand Down

0 comments on commit 7dcd29d

Please sign in to comment.