Skip to content

Commit 9b4aaf5

Browse files
committed
Merge remote-tracking branch 'upstream/master' into fastboot-index
2 parents 380b07d + 1608869 commit 9b4aaf5

File tree

89 files changed

+38278
-10144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+38278
-10144
lines changed

Diff for: .dependabot/config.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 1
2+
update_configs:
3+
- package_manager: "javascript"
4+
directory: "/"
5+
update_schedule: "weekly"
6+
version_requirement_updates: "increase_versions"
7+
commit_message:
8+
prefix: ""

Diff for: .template-lintrc.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ module.exports = {
77

88
rules: {
99
'img-alt-attributes': false,
10-
'triple-curlies': false,
11-
'html-comments': false,
10+
'no-html-comments': false,
11+
'no-unnecessary-concat': false,
12+
quotes: false,
1213
},
1314
};

Diff for: .travis.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ language: rust
22
sudo: required
33
dist: xenial
44

5+
branches:
6+
only:
7+
- auto
8+
- try
9+
- master
10+
511
cache:
612
cargo: true
713
directories:
@@ -21,7 +27,7 @@ env:
2127
- PERCY_PROJECT=crates-io/crates.io
2228
- PGPORT=5433
2329
- PATH=$HOME/.cargo/bin:$PATH
24-
- RUSTFLAGS="-C debuginfo=0"
30+
- RUSTFLAGS="-C debuginfo=0 -D warnings"
2531

2632
install:
2733
- sudo cp /etc/postgresql/10/main/pg_hba.conf /etc/postgresql/11/main/pg_hba.conf

Diff for: Cargo.lock

+6-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ derive_deref = "1.0.0"
6060
reqwest = "0.9.1"
6161
tempdir = "0.3.7"
6262
parking_lot = "0.7.1"
63-
jemallocator = { version = "0.1.8", features = ['unprefixed_malloc_on_supported_platforms', 'profiling'] }
64-
jemalloc-ctl = "0.2.0"
63+
jemallocator = { version = "0.3", features = ['unprefixed_malloc_on_supported_platforms', 'profiling'] }
6564

6665
lettre = "0.9"
6766
lettre_email = "0.9"

Diff for: app/components/api-token-row.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ export default Component.extend({
77
serverError: null,
88

99
didInsertElement() {
10-
if (this.get('api_token.isNew')) {
11-
this.$('input').focus();
10+
let input = this.element.querySelector('input');
11+
if (input && input.focus) {
12+
input.focus();
1213
}
1314
},
1415

Diff for: app/components/badge-bitbucket-pipelines.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { computed } from '@ember/object';
2+
import { alias } from '@ember/object/computed';
3+
import Component from '@ember/component';
4+
5+
export default Component.extend({
6+
tagName: 'span',
7+
classNames: ['badge'],
8+
repository: alias('badge.attributes.repository'),
9+
branch: computed('badge.attributes.branch', function() {
10+
return encodeURIComponent(this.get('badge.attributes.branch'));
11+
}),
12+
text: computed('badge.attributes.branch', function() {
13+
const branch = this.get('badge.attributes.branch');
14+
return `Bitbucket Pipelines build status for the ${branch} branch`;
15+
}),
16+
});

Diff for: app/components/owned-crate-row.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import Component from '@ember/component';
2+
import { computed } from '@ember/object';
3+
import { alias } from '@ember/object/computed';
4+
5+
export default Component.extend({
6+
tagName: 'li',
7+
8+
name: alias('ownedCrate.name'),
9+
controlId: computed('ownedCrate.id', function() {
10+
return `${this.ownedCrate.id}-email-notifications`;
11+
}),
12+
emailNotifications: alias('ownedCrate.email_notifications'),
13+
14+
actions: {
15+
toggleEmailNotifications() {
16+
this.set('emailNotifications', !this.get('emailNotifications'));
17+
},
18+
},
19+
});

Diff for: app/controllers/crate/version.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,19 @@ export default Controller.extend({
7070
}
7171

7272
return PromiseArray.create({
73-
promise: deps.then(deps => {
74-
return deps.filter(dep => dep.get('kind') !== 'dev').uniqBy('crate_id');
75-
}),
73+
promise: deps.then(deps => deps.filterBy('kind', 'normal').uniqBy('crate_id')),
74+
});
75+
}),
76+
77+
currentBuildDependencies: computed('currentVersion.dependencies', function() {
78+
let deps = this.get('currentVersion.dependencies');
79+
80+
if (deps === null) {
81+
return [];
82+
}
83+
84+
return PromiseArray.create({
85+
promise: deps.then(deps => deps.filterBy('kind', 'build').uniqBy('crate_id')),
7686
});
7787
}),
7888

@@ -82,9 +92,7 @@ export default Controller.extend({
8292
return [];
8393
}
8494
return PromiseArray.create({
85-
promise: deps.then(deps => {
86-
return deps.filterBy('kind', 'dev');
87-
}),
95+
promise: deps.then(deps => deps.filterBy('kind', 'dev').uniqBy('crate_id')),
8896
});
8997
}),
9098

Diff for: app/controllers/me/index.js

+42-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Controller from '@ember/controller';
2-
import { sort, filterBy, notEmpty } from '@ember/object/computed';
2+
import { alias, sort, filterBy, notEmpty } from '@ember/object/computed';
33
import { inject as service } from '@ember/service';
4+
import ajax from 'ember-fetch/ajax';
45

56
export default Controller.extend({
67
// eslint-disable-next-line ember/avoid-leaking-state-in-ember-objects
@@ -12,10 +13,50 @@ export default Controller.extend({
1213

1314
isResetting: false,
1415

16+
ownedCrates: alias('model.ownedCrates'),
17+
1518
newTokens: filterBy('model.api_tokens', 'isNew', true),
1619
disableCreate: notEmpty('newTokens'),
1720

21+
emailNotificationsError: false,
22+
emailNotificationsSuccess: false,
23+
24+
setAllEmailNotifications(value) {
25+
this.get('ownedCrates').forEach(c => {
26+
c.set('email_notifications', value);
27+
});
28+
},
29+
1830
actions: {
31+
async saveEmailNotifications() {
32+
try {
33+
await ajax(`/api/v1/me/email_notifications`, {
34+
method: 'PUT',
35+
body: JSON.stringify(
36+
this.get('ownedCrates').map(c => ({
37+
id: parseInt(c.id, 10),
38+
email_notifications: c.email_notifications,
39+
})),
40+
),
41+
});
42+
this.setProperties({
43+
emailNotificationsError: false,
44+
emailNotificationsSuccess: true,
45+
});
46+
} catch (err) {
47+
console.error(err);
48+
this.setProperties({
49+
emailNotificationsError: true,
50+
emailNotificationsSuccess: false,
51+
});
52+
}
53+
},
54+
emailNotificationsSelectAll() {
55+
this.setAllEmailNotifications(true);
56+
},
57+
emailNotificationsSelectNone() {
58+
this.setAllEmailNotifications(false);
59+
},
1960
startNewToken() {
2061
this.store.createRecord('api-token', {
2162
created_at: new Date(Date.now() + 2000),

Diff for: app/models/owned-crate.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import DS from 'ember-data';
2+
3+
export default DS.Model.extend({
4+
name: DS.attr('string'),
5+
email_notifications: DS.attr('boolean'),
6+
});

Diff for: app/routes/crate/version.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { observer } from '@ember/object';
22
import Route from '@ember/routing/route';
33
import { inject as service } from '@ember/service';
4-
import semver from 'semver';
4+
import { prerelease } from 'semver';
55

66
import fetch from 'fetch';
77
import ajax from 'ember-fetch/ajax';
@@ -21,7 +21,7 @@ export default Route.extend({
2121
const controller = this.controllerFor(this.routeName);
2222
const maxVersion = crate.get('max_version');
2323

24-
const isUnstableVersion = version => !!semver.prerelease(version);
24+
const isUnstableVersion = version => !!prerelease(version);
2525

2626
const fetchCrateDocumentation = () => {
2727
if (!crate.get('documentation') || crate.get('documentation').substr(0, 16) === 'https://docs.rs/') {

Diff for: app/routes/me/index.js

+11
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,20 @@ import Route from '@ember/routing/route';
33
import AuthenticatedRoute from '../../mixins/authenticated-route';
44

55
export default Route.extend(AuthenticatedRoute, {
6+
actions: {
7+
willTransition: function() {
8+
this.controller
9+
.setProperties({
10+
emailNotificationsSuccess: false,
11+
emailNotificationsError: false,
12+
})
13+
.clear();
14+
},
15+
},
616
model() {
717
return {
818
user: this.get('session.currentUser'),
19+
ownedCrates: this.get('session.ownedCrates'),
920
api_tokens: this.store.findAll('api-token'),
1021
};
1122
},

Diff for: app/services/session.js

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { A } from '@ember/array';
12
import Service, { inject as service } from '@ember/service';
23
import ajax from 'ember-fetch/ajax';
34

@@ -7,6 +8,7 @@ export default Service.extend({
78
isLoggedIn: false,
89
currentUser: null,
910
currentUserDetected: false,
11+
ownedCrates: A(),
1012

1113
store: service(),
1214
router: service(),
@@ -66,6 +68,9 @@ export default Service.extend({
6668
fetchUser() {
6769
return ajax('/api/v1/me').then(response => {
6870
this.set('currentUser', this.store.push(this.store.normalize('user', response.user)));
71+
this.ownedCrates.pushObjects(
72+
response.owned_crates.map(c => this.store.push(this.store.normalize('owned-crate', c))),
73+
);
6974
});
7075
},
7176

0 commit comments

Comments
 (0)