Skip to content

Commit

Permalink
Tiny copy tweaks to readme and notifications guide
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalp committed Nov 8, 2023
1 parent 7ad74fd commit b253ff7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Misago
======

[![Test Coverage](https://coveralls.io/repos/github/rafalp/Misago/badge.svg?branch=master)](https://coveralls.io/github/rafalp/Misago?branch=master) ![Works on Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg) [![Community Chat](https://img.shields.io/badge/chat-on_discord-7289da.svg)](https://discord.gg/fwvrZgB)
[![Test Coverage](https://coveralls.io/repos/github/rafalp/Misago/badge.svg?branch=master)](https://coveralls.io/github/rafalp/Misago?branch=master) ![Works on Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg) [![Community Chat](https://img.shields.io/badge/chat-on_discord-7289da.svg)](https://discord.gg/fwvrZgB)


**Development Status:** 🍌 [Bananas](https://en.wikipedia.org/wiki/Perpetual_beta) 🍌
Expand Down
2 changes: 1 addition & 1 deletion dev-docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ This directory contains reference documents for Misago developers.

Misago's notifications feature is implemented in the `misago.notifications` package.

- [Notifications guide](./notifications.md)
- [Notifications reference](./notifications.md)
18 changes: 9 additions & 9 deletions dev-docs/notifications.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Notifications guide
# Notifications reference

Misago's notifications feature is implemented in the `misago.notifications` package.

Expand Down Expand Up @@ -41,16 +41,16 @@ def notify_user(
This function performs two tasks:

- It saves new `misago.notifications.models.Notification` instance to database.
- It increases `user.unread_notifications` attribute in database.
- It increases `user.unread_notifications` counter in database.

It takes two required arguments:

- `user`: an instance of `misago.users.models.User` representing user to notify.
- `verb`: a `str` with notification's "verb", eg. `REPLIED`, `FOLLOWED`.

It optionally takes following arguments:
It takes four optional arguments:

- `actor`: an instance of `misago.users.models.User` representing user who caused the event.
- `actor`: an instance of `misago.users.models.User` representing the user who caused the event.
- `category`: an instance of `misago.categories.models.Categry` representing category in which the event has occurred.
- `thread`: an instance of `misago.threads.models.Thread` representing thread in which the event has occurred.
- `post`: an instance of `misago.threads.models.Post` representing post in which the event has occurred.
Expand All @@ -71,7 +71,7 @@ notify_user(

## Adding custom notification

Misago supports adding custom notifications for new events.
Misago supports adding custom notifications for new events by plugins.


### Notification verb
Expand Down Expand Up @@ -115,13 +115,13 @@ import html
from misago.notifications.registry import Notification, registry


# `message` works as decorator
# `message` works as a decorator
@registry.message("CUSTOM")
def get_custom_notification_message(notification: Notification) -> str:
return html.escape(f"Custom notification in {notification.thread_title}")


# And as setter
# `message` can also be used as a setter
def get_custom_notification_message(notification: Notification) -> str:
return html.escape(f"Custom notification in {notification.thread_title}")

Expand Down Expand Up @@ -156,7 +156,7 @@ from django.urls import reverse
from misago.notifications.registry import Notification, registry


# `redirect` works as decorator
# `redirect` works as a decorator
@registry.redirect("CUSTOM")
def get_custom_notification_redirect_url(
request: HttpRequest, notification: Notification
Expand All @@ -170,7 +170,7 @@ def get_custom_notification_redirect_url(
)


# And as setter
# `redirect` can also be used as a setter
def get_custom_notification_redirect_url(
request: HttpRequest, notification: Notification
) -> str:
Expand Down

0 comments on commit b253ff7

Please sign in to comment.