Files @ b293ec74ef98
Branch filter:

Location: kallithea/.coveragerc

Thomas De Schampheleire
files: restore 'Show Authors' functionality

Commit d66201a7ce6e ("files: change "callbacks" function to the more
descriptive name "post_load_state" and let it take an actual state data
object") broke the 'Show Authors' button when visiting a file
in the files browser. The button normally shows a count of authors and their
avatars, but after the aforementioned commit it did nothing.

Following patch would have fixed the problems in commit d66201a7ce6e:

diff --git a/kallithea/templates/files/files_source.html b/kallithea/templates/files/files_source.html
--- a/kallithea/templates/files/files_source.html
+++ b/kallithea/templates/files/files_source.html
@@ -81,11 +81,13 @@
<script>
$(document).ready(function(){
var state = {
+ data: {
node_list_url: node_list_url.replace('__REV__',${h.js(c.changeset.raw_id)}).replace('__FPATH__', ${h.js(h.safe_unicode(c.file.path))}),
url_base: url_base.replace('__REV__',${h.js(c.changeset.raw_id)}),
rev: ${h.js(c.changeset.raw_id)},
f_path: ${h.js(h.safe_unicode(c.file.path))}
+ }
}
- post_load_state(State.data); // defined in files.html
+ post_load_state(state.data); // defined in files.html
});
</script>


But, later the code got refactored more, and commit 006d68c4d7b9 ("files:
use the web browsers built-in js history instead of native.history.js")
broke the feature further: the click handler for the button no longer got
installed on the 'document-ready' event, but only when a new 'state' is
loaded. And it seems there is never a situation where a new state preserves
the button, so it makes no sense installing the click handler at that
moment.

Instead, move the click handler back to the 'document-ready' event.
[run]
omit =
    # the bin scripts are not part of the Kallithea web app
    kallithea/bin/*
    # we ship with no active extensions
    kallithea/config/rcextensions/*
    # dbmigrate is not a part of the Kallithea web app
    kallithea/lib/dbmigrate/*
    # the tests themselves should not be part of the coverage report
    kallithea/tests/*
    # the scm hooks are not run in the kallithea process
    kallithea/config/post_receive_tmpl.py
    kallithea/config/pre_receive_tmpl.py

# same omit lines should be present in sections 'run' and 'report'
[report]
omit =
    # the bin scripts are not part of the Kallithea web app
    kallithea/bin/*
    # we ship with no active extensions
    kallithea/config/rcextensions/*
    # dbmigrate is not a part of the Kallithea web app
    kallithea/lib/dbmigrate/*
    # the tests themselves should not be part of the coverage report
    kallithea/tests/*
    # the scm hooks are not run in the kallithea process
    kallithea/config/post_receive_tmpl.py
    kallithea/config/pre_receive_tmpl.py

[paths]
source =
    kallithea/
    **/workspace/*/kallithea