~edwargix/git.sr.ht

25981d544e891a27a1f491a1deea9dd80dbaab33 — Drew DeVault 8 years ago e038661
Fix a couple of bugs
3 files changed, 23 insertions(+), 17 deletions(-)

M gitsrht/blueprints/manage.py
M gitsrht/blueprints/public.py
M gitsrht/templates/user.html
M gitsrht/blueprints/manage.py => gitsrht/blueprints/manage.py +2 -3
@@ 51,12 51,11 @@ def create():
    repo.description = description
    repo.owner_id = current_user.id
    repo.visibility = RepoVisibility[visibility]
    repo.path = os.path.join(repos_path, "~" + current_user.username)
    repo.path = os.path.join(repos_path, "~" + current_user.username, repo.name)
    db.session.add(repo)

    subprocess.run(["mkdir", "-p", repo.path])
    subprocess.run(["git", "init", "--bare", repo_name], cwd=repo.path)
    subprocess.run(["ln", "-s", repo_name, repo_name + ".git"], cwd=repo.path)
    subprocess.run(["git", "init", "--bare"], cwd=repo.path)

    db.session.commit()


M gitsrht/blueprints/public.py => gitsrht/blueprints/public.py +1 -1
@@ 44,7 44,7 @@ def user_index(username):
    page = request.args.get("page")
    repos = Repository.query\
            .filter(Repository.owner_id == user.id)
    if current_user.id != user.id:
    if not current_user or current_user.id != user.id:
        # TODO: ACLs
        repos = repos.filter(Repository.visibility == RepoVisibility.public)
    if search:

M gitsrht/templates/user.html => gitsrht/templates/user.html +20 -13
@@ 21,7 21,7 @@
      <p>{{profile["bio"]}}</p>
      {% endif %}
      {% endif %}
      {% if current_user %}
      {% if current_user and current_user.id == user.id %}
        <a href="{{cfg("network", "meta")}}/profile">Edit your profile »</a>
      {% endif %}
    </section>


@@ 42,6 42,11 @@
          <a href="/~{{current_user.username}}/{{repo.name}}">
            ~{{current_user.username}}/{{repo.name}}
          </a>
          {% if repo.visibility.value != 'public' %}
          <small class="text-muted">
            <em>{{ repo.visibility.value }}</em>
          </small>
          {% endif %}
        </h4>
        {% if repo.description %}
        <p>{{ repo.description }}</p>


@@ 52,18 57,20 @@
      {% endfor %}
      {% endif %}
      {% if total_pages > 1 %}
      {% if page != 1 %}
      <a href="?page={{ page - 1 }}{{ '&search=' + search if search else '' }}" class="pull-left">[previous]</a>
      {% else %}
      <span class="pull-left" style="color: transparent">[previous]</span>
      {% endif %}
      {% if page != total_pages %}
      <a href="?page={{ page + 1 }}{{ '&search=' + search if search else '' }}" class="pull-right">[next]</a>
      {% else %}
      <span class="pull-right" style="color: transparent">[previous]</span>
      {% endif %}
      <div class="text-centered">
        [ {{ page }} / {{ total_pages }} ]
      <div class="row">
        <div class="col-md-4">
        {% if page != 1 %}
          <a href="?page={{ page - 1 }}{{ '&search=' + search if search else '' }}">[previous]</a>
        {% endif %}
        </div>
        <div class="col-md-4 text-centered">
          [ {{ page }} / {{ total_pages }} ]
        </div>
        <div class="col-md-4 text-right">
        {% if page != total_pages %}
          <a href="?page={{ page + 1 }}{{ '&search=' + search if search else '' }}">[next]</a>
        {% endif %}
        </div>
      </div>
      {% endif %}
    </section>