* decoupled notifiers from event
* stub
* publishers working
* fixed format CLI
* fixed unit tests
* renamed abstractnotifier
* added another excluded character
Configuration files are checked in this order:
1. CLI argument
2. `$MOBILIZION_RESHARE_SETTINGS_FILE` environment variable;
3. User configuration directory. On Linux that's `$XDG_CONFIG_HOME/mobilizon_reshare/<mobilizon-reshare-version>`;
4. System configuration directory. On Linux that's the first element in `$XDG_CONFIG_DIRS` + `/mobilizon_reshare/<mobilizon-reshare-version>`.
5. The default configuration distributed with the package.
The first available configuration file will be loaded. Secrets can be set either
via environment variables (such as `export MOBILIZON_RESHARE_PUBLISHER_TELEGRAM_TOKEN="my-telegram-token"` )
or by setting the `$SECRETS_FOR_DYNACONF` environment variable to a `secrets.(toml|yaml|ini|json)` file.
Co-authored-by: Giacomo Leidi <goodoldpaul@autistici.org>
* Fix PublisherCoordinatorReport generation.
Without this patch we are given *either* the failed or the successful
publication reports. We actually need both, this patch implements the
merge.
* Reformat
Co-authored-by: Giacomo Leidi <goodoldpaul@autistici.org>
* publishers: coordinator: Change `PublisherReport` to `PublicationReport`.
* publishers: AbstractNotifier: Add `AbstractNotifier.get_name`.
* models: Publication: Add `reason`.
* storage: query: Add `get_mobilizon_event_publications`.
* tests: query: Refactor models generation.
* storage: query: Add `save_publication_report`.
* Track publication ids during the publishing process.
This patch changes the PublisherCoordinator to keep track
of the different Publications it's performing. This also
enables multiple publications for the same publisher.
* tests: storage: Add some tests.
Co-authored-by: Giacomo Leidi <goodoldpaul@autistici.org>
* mobilizon_bots: query: Add create_publisher.
* Move PublicationStatus to models.publication.
* Move NotificationStatus to models.notification.
* storage: query: Add events_with_status.
* storage: query: Add get_unpublished_events.
* storage: query: Add create_unpublished events.
This function takes care of looking into the database
to store only the events whose is not
already present.
* event: event: Support multiple publications.
This patch changes the public interface of `MobilizonEvent` to
support multiple publications. This mainly entails two changes:
- When instancing a `MobilizonEvent` from an `Event` model
the `publication_status` will be computed by looking at
the statuses of all the related publications.
- Now the `publication_time` is a `dict[str, Arrow]`. This
enables tracking multiple social platforms publication time.
* Update main.
* Minor fixes
* Better definition of MobilizonEvent.publication_status.
Co-authored-by: Giacomo Leidi <goodoldpaul@autistici.org>
* Fixed typo
* Added proper exceptions for publishers
* Updated publishers logics: using messengers to allow publications without events
* Added new exception 'InvalidSettings'
* Updated notifiers and publishers: retrieve credentials and destination from config, use only message/event in constructors, lesser refactoring
* Updated publishers' tests
* Updated notifiers and publishers config for Telegram service, updated settings.toml file
* Updated 'post()' method and removed useless config checks for Telegram bot
* Added jinja2 template management for message formatting methods
* Manage message validation in publishers' run() method
* Better config management for notifiers and publishers
* Lesser update to logging and error-raising management (#23)
* added get events stub
* added event parsing
* removed datetime
* added config and tests
* fixed response format in test
* more tests
* added error handling for request
* improved dummy data
* added get_unpublished_events
* added test
* removed last_accessed
* mobilizon_url moved to fixture
* added config comments
* moved mobilizon group to config