-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(matrix/space): implemented space.board
events
#16
Closed
Closed
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4ad6aaf
feat(matrix/space): implemented `space.board` events
avdb13 fe33e2b
feat(core/db): initialize database on startup
avdb13 71b16ff
feat(core/events): handlers to create posts and replies from boards
avdb13 9147534
chore: fix room endpoints for Admin API
avdb13 2e27104
chore: cleanup for space events
avdb13 a40925b
chore: test deserializing for space events
avdb13 aeb63f5
refactor: make `EventsService` parameter types more strict
avdb13 29ffbb1
Merge branch 'main' into events
avdb13 cdbd29f
chore: move type validation to the service layer and provide useful e…
avdb13 ad4c374
fix: make AccessToken convertable to Secret
avdb13 2520e07
fix: complete convenience constructors and deserialization tests
avdb13 71d255a
fix: remove state events we might not need
avdb13 883fb23
feat: generic handler to retrieve room messages
avdb13 1e4c31d
feat: set access token for client requests
avdb13 c9b63ac
feat: complete events service layer
avdb13 dd15ada
feat: add event creation to the router
avdb13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use http::StatusCode; | ||
use matrix::events::{exports::ruma_common::OwnedRoomId, relation::RelationType}; | ||
use thiserror::Error; | ||
|
||
use crate::error::HttpStatusCode; | ||
|
||
#[derive(Debug, Error)] | ||
pub enum BoardErrorCode { | ||
#[error("Failed to parse BoardId")] | ||
MalformedBoardId, | ||
#[error("Failed to parse the EventId")] | ||
MalformedEventId, | ||
#[error("Failed to parse content body")] | ||
MalformedContent(#[from] serde_json::Error), | ||
#[error("You are not a member of the board")] | ||
NoMembership(OwnedRoomId), | ||
#[error("You provided an empty or incorrect relation")] | ||
WrongRelation(Option<RelationType>), | ||
} | ||
|
||
impl HttpStatusCode for BoardErrorCode { | ||
fn status_code(&self) -> StatusCode { | ||
match self { | ||
BoardErrorCode::WrongRelation(_) | ||
| BoardErrorCode::MalformedBoardId | ||
| BoardErrorCode::MalformedEventId | ||
| BoardErrorCode::MalformedContent(_) => StatusCode::BAD_REQUEST, | ||
BoardErrorCode::NoMembership(_) => StatusCode::FORBIDDEN, | ||
} | ||
} | ||
|
||
fn error_code(&self) -> &'static str { | ||
match self { | ||
BoardErrorCode::WrongRelation(_) | ||
| BoardErrorCode::MalformedBoardId | ||
| BoardErrorCode::MalformedEventId | ||
| BoardErrorCode::MalformedContent(_) => "BAD_REQUEST", | ||
BoardErrorCode::NoMembership(_) => "FORBIDDEN", | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pub mod error; | ||
pub mod service; | ||
|
||
pub use matrix::events::{ | ||
space, Raw, AnyMessageLikeEvent, StateEventContent, | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used for tests.
See: https://docs.rs/assert_matches2/latest/assert_matches2