ini file: clarify that beaker.session.key should be unique
When several instances of Kallithea are running on the same machine, the same browser cannot be logged into both instances at the same time without conflicts. The login session are saved into the same cookie; logging into one instance closes the session on the second instance and vice-versa.
This is caused because the cookie name is simply 'kallithea', combined with the fact that the cookie specification (RFC6265) states that there is no isolation of cookies based on port. This means that the browser sends all cookies from a given domain with all services (Kallithea instances) running on that domain, irrespective of port.
The services thus need to handle any such issue themselves, for example by using unique cookie names and only interacting with one's own cookie.
Making the key unique when creating the configuration file proved difficult: - it does not seem possible to hook into 'paster make-config' - since Beaker directly interprets the beaker.session.key, changing it on the fly from SessionMiddleware will not work correctly.
There is a kallithea-config script that is an alternative to 'paster make-config' which would be the ideal place to make such changes. However, it seems this method is not advocated over 'paster make-config' (yet?).
Instead, simply add a comment in the config file and let the user take care of it.
The existing docs were far from how we wanted it to be. There was so much to do and it is not feasible to do that cleanup it in clean patches.
Instead, I took a sweep through the docs and changed what I thought could benefit from a change: structure, examples, advices, language, markup, content, etc.
pullrequest overview: remove custom handling of 'my pullrequests'
Re-use the same displaying code for the 'my pullrequests' overview as for the repository pullrequests overview. Remove the now unused CSS styling as well.
This removes the 'delete' button on the author's pullrequests. One could argue whether the pullrequest overview is the right place for this button, while it does not appear on the pull request page itself.
pullrequest overview: add delete button to own pull requests
In anticipation of the re-use of the pullrequest overview to display 'my pullrequests', add a delete button to all pullrequests owned by the currently logged-in user. An explicit width is added to the column because the column is otherwise unnecessarily large.
style: add class 'normal-indent' instead of repeated explicit margins
Add a new CSS class for the standard indentation inside the main box, instead of repeating 'style="..."' statements on the relevant elements.
Ideally, this class should not exist as the necessary padding would be added to the main box itself, but reworking this is a bigger exercise (to be done later).
pullrequest overview: display in table to improve readability
Instead of showing all info in the pullrequest overview right after each other on the same line, use a table to improve readability.
Additionally, add following information: - author - destination repository
The latter is always the same when viewing the list of pullrequests of a certain repository, but this change already anticipates re-use of this block in the 'my pullrequests' overview.
The table is still static, non-sortable, since YUI is deprecated and no new alternative has been decided upon yet. This improvement can be done later.
date representation: use ISO8601 rather than a specific locale
Dates, in particular in technical systems like Kallithea, are better shown in a clear concise format like ISO8601 (YYYY-MM-DD) than in a verbose format like 'Thu, Feb 26 2015'.
This commit changes all dates to ISO8601.
--- If desired, we could create two functions: one that returns ISO format and another for the locale format. Depending on the usage, one or the other is shown. I'm not very fond of that though, it looks inconsistent.
my pullrequests: line up controller/template handling with repo pullrequests
Currently, the data for 'my pullrequests' is loaded dynamically through ajax, unlike the way 'repository pullrequests' are loaded (statically).
As there is no good reason to have both treated differently, and as dynamic loading of 'my pullrequests' is not really needed, rework the handling of the 'my pullrequests' page with the 'repository pullrequests' page.
This includes lining up the 'show closed pull requests' checkbox/link.
This also fixes issue #102 ('my pull requests' when not logged in: incorrect handling of login).
controllers: don't pass rendered templates in context variables
Some controllers used the followifng pattern: - render a data template into a context variable - for partial (ajax) requests, return the contents of this variable - for full-page requests, render the full page, which expands the value of the context variable
Instead, avoid context variables let the controller simply render the full or partial page, and let the full page template include the partial page.
Remove this context variable for templating and use render exclusively. From templates, use %include instead of context variables.
pullrequests on different repos: default to same destination/source branch
When a pull request is initiated between two different repositories, instead of using the current tip as destination branch, use the same branch as on the source repository.
repository summary: avoid table bleed on long commit messages
For commit messages with the first line being very long, the 'latest changes' table on the repository overview page can 'bleed', so that the commit number overlaps with the commit status.
Commit 15cb8156b10d732cf39b37a88c656894621c0f54 changed the initial truncate on 50 characters to a chop at the first newline characters, causing this issue to pop up more frequently.
Instead of using floating divs for the commit status and number of comments, use dedicated table columns, as compact as possible. Additionally, move these new columns to the very left of the table, instead of cramming them in between the revision and commit message.
The comments-container class gets a new attribute 'white-space: nowrap' to avoid the comment icon to wrap from the number of comments, when the table does wrap on a small screen. Note that the icon currently does not display as it should be renamed from icon-comment-alt/colored to icon-comment. This will be fixed by Sean Farley.
changelog: fix display artifacts in expanded multi-line commit messages
When a multi-line commit message is expanded in a changelog, and the last line of the commit message has some characters that go below the baseline, like an underscore, g, j, y, ... the bottom part of these characters would not be shown.
This is caused by the 'overflow: hidden' property set on the unexpanded message. Reset that property by adding 'overflow: initial' on the expanded class.
Additionally, slightly enlarge the margin of the expanded message box.
The inline 'style' attribute was modified to remove the color but nothing else, as was discussed with other Kallithea devs, since it makes more sense to leave the spacing until another pass of css refactoring.
A quick search revealed that some old css code was never used, so it was removed.
repository 'latest changes': only show first line of commit message
Instead of truncating the commit message at a fixed number of characters, behave like standard version control commands (e.g. hg log) and only show the first line of the commit message in an overview.
pull requests commit overview: respect newlines and indentation (Issue #79)
Before this commit, commit messages in the pull request commit overview would be handled like any other text in HTML, with newlines and multiple whitespace being irrelevant.
Remove an overrule in the CSS so that the 'white-space' property remains at 'pre-wrap', causing newlines and indentation in commit messages are properly respected in this overview. As a positive effect, only the first line of the commit message is shown by default, just like in standard version control commands like 'hg log'.
ec39e73be935 introduced a regression in the cases where templates contained (javascript) snippets outside defined areas. Before, they were included anyway. After, they were not.
Fixing by moving the chunks I could find inside the main def.
remotes: add support to clone from Mercurial repositories over ssh
This commit adds support to clone a remote Mercurial repository over ssh.
Interactive password authentication is not implemented, nor is support for pbulic key authentication with passphrases; the repository should be accessible using bare ssh key authentication. For this reason, the ssh options -oBatchMode=yes and -oIdentitiesOnly=yes are added to the ui.ssh setting of Mercurial.
comment handling: extend next/previous links to global comments (issue #91)
Until now, only inline comments were linked to each other with next/previous links.
This commit extends this mechanism to global comments, such that the last inline comment has a next link to the first global comment, which has a next link to the next global comment (and the other way around for previous links).
In order to work well, instead of hiding inline comments that have been moved, they actually have to be deleted.