ckanext-ytp-comments
====================
A custom CKAN extension for Data.Qld
[![Tests](https://github.com/qld-gov-au/ckanext-ytp-comments/actions/workflows/test.yml/badge.svg)](https://github.com/qld-gov-au/ckanext-ytp-comments/actions/workflows/test.yml)
[![CircleCI](https://circleci.com/gh/qld-gov-au/ckanext-ytp-comments/tree/develop.svg?style=shield)](https://circleci.com/gh/qld-gov-au/ckanext-ytp-comments/tree/develop)
## Local environment setup
- Make sure that you have latest versions of all required software installed:
- [Docker](https://www.docker.com/)
- [Pygmy](https://pygmy.readthedocs.io/)
- [Ahoy](https://github.com/ahoy-cli/ahoy)
- Make sure that all local web development services are shut down (Apache/Nginx, Mysql, MAMP etc).
- Checkout project repository (in one of the [supported Docker directories](https://docs.docker.com/docker-for-mac/osxfs/#access-control)).
- `pygmy up`
- `ahoy build`
- You may need to use sudo on linux
Building on Ubuntu (optional: behind proxy)
- composer from compose
- sudo pip install docker-compose
- sudo apt-get install composer
- ensure /etc/gemrc has the following
``http_proxy: http://localhost:3128
https_proxy: http://localhost:3128``
- if squid proxy is in use on your machine ensure that ``acl localnet src 172.17.0.0/16`` # allows your public ip for loopback
- https://docs.docker.com/network/proxy/
~/.docker/config.json
``
{
"proxies":
{
"default":
{
"httpProxy": "http://hostexternalip:3128",
"httpsProxy": "http://hostexternalip:3128",
"noProxy": ""
}
}
}
``
- https://docs.docker.com/config/daemon/systemd/
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf
``[Service]
Environment="HTTP_PROXY=http://localhost:3128/"``
sudo vi /etc/systemd/system/docker.service.d/https-proxy.conf
``[Service]
Environment="HTTPS_PROXY=http://localhost:3128/"``
sudo systemctl daemon-reload
sudo systemctl restart docker
Use `admin`/`password` to login to CKAN.
## Available `ahoy` commands
Run each command as `ahoy <command>`.
```
build Build or rebuild project.
clean Remove containers and all build files.
cli Start a shell inside CLI container or run a command.
doctor Find problems with current project setup.
down Stop Docker containers and remove container, images, volumes and networks.
flush-redis Flush Redis cache.
info Print information about this project.
install-site Install a site.
lint Lint code.
logs Show Docker logs.
pull Pull latest docker images.
reset Reset environment: remove containers, all build, manually created and Drupal-Dev files.
restart Restart all stopped and running Docker containers.
start Start existing Docker containers.
stop Stop running Docker containers.
test-bdd Run BDD tests.
test-unit Run unit tests.
up Build and start Docker containers.
```
## Coding standards
Python code linting uses [flake8](https://github.com/PyCQA/flake8) with configuration captured in `.flake8` file.
Set `ALLOW_LINT_FAIL=1` in `.env` to allow lint failures.
## Nose tests
`ahoy test-unit`
Set `ALLOW_UNIT_FAIL=1` in `.env` to allow unit test failures.
## Behavioral tests
`ahoy test-bdd`
Set `ALLOW_BDD_FAIL=1` in `.env` to allow BDD test failures.
### How it works
We are using [Behave](https://github.com/behave/behave) BDD _framework_ with additional _step definitions_ provided by [Behaving](https://github.com/ggozad/behaving) library.
Custom steps described in `test/features/steps/steps.py`.
Test scenarios located in `test/features/*.feature` files.
Test environment configuration is located in `test/features/environment.py` and is setup to connect to a remote Chrome
instance running in a separate Docker container.
During the test, Behaving passes connection information to [Splinter](https://github.com/cobrateam/splinter) which
instantiates WebDriver object and establishes connection with Chrome instance. All further communications with Chrome
are handled through this driver, but in a developer-friendly way.
For a list of supported step-definitions, see https://github.com/ggozad/behaving#behavingweb-supported-matcherssteps.
## Automated builds (Continuous Integration)
In software engineering, continuous integration (CI) is the practice of merging all developer working copies to a shared mainline several times a day.
Before feature changes can be merged into a shared mainline, a complete build must run and pass all tests on CI server.
This project uses [GitHub Actions](https://github.com/features/actions) as a CI server: it imports production backups into fully built codebase and runs code linting and tests. When tests pass, a deployment process is triggered for nominated branches (usually, `master` and `develop`).
## Follow / Mute comments
Comment notifications (via email) are managed by opt-in, i.e. without opting in to receive comment notifications at the content item or thread level,
only authors or organisation admins will receive email notifications.
This feature allows users to following or mute comments at the content item level or for a specific comment thread on the content item.
When a user follows comments on a content item or content item thread they will receive email notifications when new comments or replies are posted.
### Blacklist Words
Comments are checked using the [profanityfilter](https://github.com/areebbeigh/profanityfilter) Python module; any comments containing profanity are blocked.
'profanityfilter' has a built-in blacklist of words. Additional banned words are contained in `ckanext/ytp/comments/bad_words.txt` by default.
You can point to another word list by setting `ckan.comments.bad_words_file` in your config.
Any words from the built-in list that you do *not* wish to block are contained in `ckanext/ytp/comments/good_words.txt` by default.
You can point to another word list by setting `ckan.comments.good_words_file` in your config.
## Installation
1. Initialise the comment notification recipients database table, e.g.
cd /usr/lib/ckan/default/src/ckanext-ytp-comments # Your PATH may vary
ckan -c /etc/ckan/default/development.ini initdb # Use YOUR path and relevant CKAN .ini file
ckan -c /etc/ckan/default/development.ini updatedb # Use YOUR path and relevant CKAN .ini file
ckan -c /etc/ckan/default/development.ini init_notifications_db # Use YOUR path and relevant CKAN .ini file
This will create a new table in the CKAN database named `comment_notification_recipient` that holds the status of individual user's follow or mute preferences.
*Note:* if your deployment process does not run `python setup.py develop` after deploying code changes for extensions, you may need to run this in order for 'ckan' to recognise the `init_notifications_db` command:
python setup.py develop
2. Add the following config settings to your CKAN `.ini` file:
ckan.comments.follow_mute_enabled = True
# Optional
ckan.comments.bad_words_file = /path/to/blacklist_words.txt
ckan.comments.good_words_file = /path/to/whitelist_words.txt
# To display dataset comments on a datasets tab page instead of below the dataset additional information, set to True
ckan.comments.show_comments_tab_page = True # Defaults to False
3. Restart CKAN
Raw data
{
"_id": null,
"home_page": "https://github.com/qld-gov-au/ckanext-ytp-comments",
"name": "ckanext-ytp-comments",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "CKAN",
"author": "Digital Applications",
"author_email": "qol.development@smartservice.qld.gov.au",
"download_url": "https://files.pythonhosted.org/packages/bb/6f/cd94f64759dd57c70d0c3c18e9c76d2b836b4b70c6d7a75800de829bd070/ckanext_ytp_comments-2.5.0.tar.gz",
"platform": null,
"description": "ckanext-ytp-comments\n====================\nA custom CKAN extension for Data.Qld\n\n[![Tests](https://github.com/qld-gov-au/ckanext-ytp-comments/actions/workflows/test.yml/badge.svg)](https://github.com/qld-gov-au/ckanext-ytp-comments/actions/workflows/test.yml)\n\n[![CircleCI](https://circleci.com/gh/qld-gov-au/ckanext-ytp-comments/tree/develop.svg?style=shield)](https://circleci.com/gh/qld-gov-au/ckanext-ytp-comments/tree/develop)\n\n## Local environment setup\n- Make sure that you have latest versions of all required software installed:\n - [Docker](https://www.docker.com/)\n - [Pygmy](https://pygmy.readthedocs.io/)\n - [Ahoy](https://github.com/ahoy-cli/ahoy)\n- Make sure that all local web development services are shut down (Apache/Nginx, Mysql, MAMP etc).\n- Checkout project repository (in one of the [supported Docker directories](https://docs.docker.com/docker-for-mac/osxfs/#access-control)).\n- `pygmy up`\n- `ahoy build`\n- You may need to use sudo on linux\n\nBuilding on Ubuntu (optional: behind proxy)\n- composer from compose\n - sudo pip install docker-compose\n- sudo apt-get install composer\n- ensure /etc/gemrc has the following\n ``http_proxy: http://localhost:3128\n https_proxy: http://localhost:3128``\n- if squid proxy is in use on your machine ensure that ``acl localnet src 172.17.0.0/16`` # allows your public ip for loopback\n- https://docs.docker.com/network/proxy/\n ~/.docker/config.json\n ``\n{\n \"proxies\":\n {\n \"default\":\n {\n \"httpProxy\": \"http://hostexternalip:3128\",\n \"httpsProxy\": \"http://hostexternalip:3128\",\n \"noProxy\": \"\"\n }\n }\n}\n``\n - https://docs.docker.com/config/daemon/systemd/\n sudo mkdir -p /etc/systemd/system/docker.service.d\n sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf\n ``[Service]\n Environment=\"HTTP_PROXY=http://localhost:3128/\"``\n sudo vi /etc/systemd/system/docker.service.d/https-proxy.conf\n ``[Service]\n Environment=\"HTTPS_PROXY=http://localhost:3128/\"``\n sudo systemctl daemon-reload\n sudo systemctl restart docker\n\n\nUse `admin`/`password` to login to CKAN.\n\n## Available `ahoy` commands\nRun each command as `ahoy <command>`.\n ```\n build Build or rebuild project.\n clean Remove containers and all build files.\n cli Start a shell inside CLI container or run a command.\n doctor Find problems with current project setup.\n down Stop Docker containers and remove container, images, volumes and networks.\n flush-redis Flush Redis cache.\n info Print information about this project.\n install-site Install a site.\n lint Lint code.\n logs Show Docker logs.\n pull Pull latest docker images.\n reset Reset environment: remove containers, all build, manually created and Drupal-Dev files.\n restart Restart all stopped and running Docker containers.\n start Start existing Docker containers.\n stop Stop running Docker containers.\n test-bdd Run BDD tests.\n test-unit Run unit tests.\n up Build and start Docker containers.\n ```\n\n## Coding standards\nPython code linting uses [flake8](https://github.com/PyCQA/flake8) with configuration captured in `.flake8` file.\n\nSet `ALLOW_LINT_FAIL=1` in `.env` to allow lint failures.\n\n## Nose tests\n`ahoy test-unit`\n\nSet `ALLOW_UNIT_FAIL=1` in `.env` to allow unit test failures.\n\n## Behavioral tests\n`ahoy test-bdd`\n\nSet `ALLOW_BDD_FAIL=1` in `.env` to allow BDD test failures.\n\n### How it works\nWe are using [Behave](https://github.com/behave/behave) BDD _framework_ with additional _step definitions_ provided by [Behaving](https://github.com/ggozad/behaving) library.\n\nCustom steps described in `test/features/steps/steps.py`.\n\nTest scenarios located in `test/features/*.feature` files.\n\nTest environment configuration is located in `test/features/environment.py` and is setup to connect to a remote Chrome\ninstance running in a separate Docker container.\n\nDuring the test, Behaving passes connection information to [Splinter](https://github.com/cobrateam/splinter) which\ninstantiates WebDriver object and establishes connection with Chrome instance. All further communications with Chrome\nare handled through this driver, but in a developer-friendly way.\n\nFor a list of supported step-definitions, see https://github.com/ggozad/behaving#behavingweb-supported-matcherssteps.\n\n## Automated builds (Continuous Integration)\nIn software engineering, continuous integration (CI) is the practice of merging all developer working copies to a shared mainline several times a day.\nBefore feature changes can be merged into a shared mainline, a complete build must run and pass all tests on CI server.\n\nThis project uses [GitHub Actions](https://github.com/features/actions) as a CI server: it imports production backups into fully built codebase and runs code linting and tests. When tests pass, a deployment process is triggered for nominated branches (usually, `master` and `develop`).\n\n## Follow / Mute comments\n\nComment notifications (via email) are managed by opt-in, i.e. without opting in to receive comment notifications at the content item or thread level,\nonly authors or organisation admins will receive email notifications.\n\nThis feature allows users to following or mute comments at the content item level or for a specific comment thread on the content item.\n\nWhen a user follows comments on a content item or content item thread they will receive email notifications when new comments or replies are posted.\n\n### Blacklist Words\n\nComments are checked using the [profanityfilter](https://github.com/areebbeigh/profanityfilter) Python module; any comments containing profanity are blocked.\n\n'profanityfilter' has a built-in blacklist of words. Additional banned words are contained in `ckanext/ytp/comments/bad_words.txt` by default.\nYou can point to another word list by setting `ckan.comments.bad_words_file` in your config.\n\nAny words from the built-in list that you do *not* wish to block are contained in `ckanext/ytp/comments/good_words.txt` by default.\nYou can point to another word list by setting `ckan.comments.good_words_file` in your config.\n\n## Installation\n\n1. Initialise the comment notification recipients database table, e.g.\n\n cd /usr/lib/ckan/default/src/ckanext-ytp-comments # Your PATH may vary\n ckan -c /etc/ckan/default/development.ini initdb # Use YOUR path and relevant CKAN .ini file\n ckan -c /etc/ckan/default/development.ini updatedb # Use YOUR path and relevant CKAN .ini file\n ckan -c /etc/ckan/default/development.ini init_notifications_db # Use YOUR path and relevant CKAN .ini file\n\n This will create a new table in the CKAN database named `comment_notification_recipient` that holds the status of individual user's follow or mute preferences.\n\n *Note:* if your deployment process does not run `python setup.py develop` after deploying code changes for extensions, you may need to run this in order for 'ckan' to recognise the `init_notifications_db` command:\n\n python setup.py develop\n\n2. Add the following config settings to your CKAN `.ini` file:\n\n ckan.comments.follow_mute_enabled = True\n # Optional\n ckan.comments.bad_words_file = /path/to/blacklist_words.txt\n ckan.comments.good_words_file = /path/to/whitelist_words.txt\n # To display dataset comments on a datasets tab page instead of below the dataset additional information, set to True\n ckan.comments.show_comments_tab_page = True # Defaults to False\n\n3. Restart CKAN\n\n",
"bugtrack_url": null,
"license": "AGPL",
"summary": "Adds commenting on datasets and data requests",
"version": "2.5.0",
"project_urls": {
"Homepage": "https://github.com/qld-gov-au/ckanext-ytp-comments"
},
"split_keywords": [
"ckan"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8b6a9e202ccf83cc563daabbf2112d76e25a4ec0f7a2cbf768b65cbd6a1d1d39",
"md5": "87f6a77cc25b73eea1379d3c08fb8f19",
"sha256": "f01a5b2133eda1f12fc25282b02a3bf569e4b04d629316f9307e29f889187ec0"
},
"downloads": -1,
"filename": "ckanext_ytp_comments-2.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "87f6a77cc25b73eea1379d3c08fb8f19",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 48935,
"upload_time": "2024-11-25T05:09:02",
"upload_time_iso_8601": "2024-11-25T05:09:02.322923Z",
"url": "https://files.pythonhosted.org/packages/8b/6a/9e202ccf83cc563daabbf2112d76e25a4ec0f7a2cbf768b65cbd6a1d1d39/ckanext_ytp_comments-2.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bb6fcd94f64759dd57c70d0c3c18e9c76d2b836b4b70c6d7a75800de829bd070",
"md5": "340d82be44ba9d9cf28ce6a75ac3c0fd",
"sha256": "bfd8ca08f5ad859d38eb96afe8de7d43f2018163d77f3189bcea6cc60e2174d7"
},
"downloads": -1,
"filename": "ckanext_ytp_comments-2.5.0.tar.gz",
"has_sig": false,
"md5_digest": "340d82be44ba9d9cf28ce6a75ac3c0fd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 35842,
"upload_time": "2024-11-25T05:09:06",
"upload_time_iso_8601": "2024-11-25T05:09:06.465756Z",
"url": "https://files.pythonhosted.org/packages/bb/6f/cd94f64759dd57c70d0c3c18e9c76d2b836b4b70c6d7a75800de829bd070/ckanext_ytp_comments-2.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-25 05:09:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "qld-gov-au",
"github_project": "ckanext-ytp-comments",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "lxml",
"specs": [
[
"==",
"4.9.1"
]
]
},
{
"name": "profanityfilter",
"specs": []
}
],
"lcname": "ckanext-ytp-comments"
}