Skip to content

Commit

Permalink
fix: add/remove missing https:// from repo
Browse files Browse the repository at this point in the history
* fix(ember): repo hrefs missing https://

* fix(api): remove unnecessary unique on repo field

* chore(api/tests): remove https:// from repos
  • Loading branch information
c0rydoras authored Oct 24, 2023
1 parent 5779667 commit 0c1fb13
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 12 deletions.
7 changes: 2 additions & 5 deletions api/outdated/outdated/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.1.9 on 2023-09-18 08:51
# Generated by Django 4.2.6 on 2023-10-24 14:19

from django.db import migrations, models
import django.db.models.deletion
Expand Down Expand Up @@ -120,10 +120,7 @@ class Migration(migrations.Migration):
),
),
("name", models.CharField(db_index=True, max_length=100)),
(
"repo",
outdated.models.RepositoryURLField(max_length=100, unique=True),
),
("repo", outdated.models.RepositoryURLField(max_length=100)),
(
"versioned_dependencies",
models.ManyToManyField(blank=True, to="outdated.version"),
Expand Down
2 changes: 1 addition & 1 deletion api/outdated/outdated/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Project(UUIDModel):
name = models.CharField(max_length=100, db_index=True)

versioned_dependencies = models.ManyToManyField(Version, blank=True)
repo = RepositoryURLField(max_length=100, unique=True)
repo = RepositoryURLField(max_length=100)

class Meta:
ordering = ["name", "id"]
Expand Down
4 changes: 2 additions & 2 deletions api/outdated/outdated/tests/test_syncproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def test_syncproject(project_factory):
call_command("syncproject", "foo")

project = project_factory.create(repo="https://github.com/projectcaluma/caluma")
project = project_factory.create(repo="github.com/projectcaluma/caluma")

call_command("syncproject", project.name)
assert project.versioned_dependencies.count() > 0
Expand All @@ -17,7 +17,7 @@ def test_syncproject(project_factory):
@pytest.mark.django_db(transaction=True)
def test_syncprojects(project_factory):
projects = [
project_factory(repo=f"https://github.com/adfinis/{project}")
project_factory(repo=f"github.com/adfinis/{project}")
for project in ["outdated", "mysagw"]
]

Expand Down
2 changes: 1 addition & 1 deletion ember/app/components/project-detailed/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{@project.name}}
</h1>

<a href="{{@project.repo}}" target="blank_" data-test-repo-link>
<a href="{{@project.repoURL}}" target="blank_" data-test-repo-link>
<UkIcon @icon="github" @ratio={{3}} />
</a>

Expand Down
4 changes: 4 additions & 0 deletions ember/app/models/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ export default class ProjectModel extends Model {

@tracked users;
@tracked primaryMaintainer;

get repoURL() {
return `https://${this.repo}`;
}
}
2 changes: 1 addition & 1 deletion ember/mirage/factories/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default Factory.extend({
status: () => 'UNDEFINED',

repo() {
return `https://github.com/${faker.internet.domainWord()}/${faker.helpers.slugify(
return `github.com/${faker.internet.domainWord()}/${faker.helpers.slugify(
this.name,
)}`;
},
Expand Down
4 changes: 3 additions & 1 deletion ember/tests/acceptance/projects-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ module('Acceptance | projects', function (hooks) {

assert.strictEqual(currentURL(), `/projects/${project.id}`);

assert.dom('[data-test-repo-link]').hasProperty('href', project.repo);
assert
.dom('[data-test-repo-link]')
.hasProperty('href', `https://${project.repo}`);

assert
.dom('tbody>tr')
Expand Down
4 changes: 3 additions & 1 deletion ember/tests/integration/components/project-detailed-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ module('Integration | Component | project-detailed', function (hooks) {
await render(hbs`<ProjectDetailed @project={{this.project}} />`);

assert.dom('[data-test-project-name]').hasText(this.project.name);
assert.dom('[data-test-repo-link]').hasProperty('href', this.project.repo);
assert
.dom('[data-test-repo-link]')
.hasProperty('href', this.project.repoURL);

assert
.dom('tbody>tr')
Expand Down

0 comments on commit 0c1fb13

Please sign in to comment.