Skip to content

Commit

Permalink
Return success from deleted_message even if message not deleted (#5145
Browse files Browse the repository at this point in the history
)
  • Loading branch information
hpeebles authored Jan 8, 2024
1 parent 6daa661 commit 9747f46
Show file tree
Hide file tree
Showing 13 changed files with 4 additions and 11 deletions.
1 change: 1 addition & 0 deletions backend/canisters/community/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add `subtype` to channel search results ([#5084](https://github.com/open-chat-labs/open-chat/pull/5084))
- Don't mark messages as edited if only link removed ([#5119](https://github.com/open-chat-labs/open-chat/pull/5119))
- Increase max message length to 10k characters ([#5140](https://github.com/open-chat-labs/open-chat/pull/5140))
- Return success from `deleted_message` even if message not deleted ([#5145](https://github.com/open-chat-labs/open-chat/pull/5145))

### Fixed

Expand Down
1 change: 0 additions & 1 deletion backend/canisters/community/api/can.did
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ type DeletedMessageResponse = variant {
UserNotInChannel;
NotAuthorized;
MessageNotFound;
MessageNotDeleted;
MessageHardDeleted;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub enum Response {
UserNotInChannel,
NotAuthorized,
MessageNotFound,
MessageNotDeleted,
MessageHardDeleted,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ fn deleted_message_impl(args: Args, state: &RuntimeState) -> Response {
DeletedMessageResult::UserNotInGroup => UserNotInChannel,
DeletedMessageResult::NotAuthorized => NotAuthorized,
DeletedMessageResult::MessageNotFound => MessageNotFound,
DeletedMessageResult::MessageNotDeleted => MessageNotDeleted,
DeletedMessageResult::MessageHardDeleted => MessageHardDeleted,
}
} else {
Expand Down
1 change: 1 addition & 0 deletions backend/canisters/group/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- Don't mark messages as edited if only link removed ([#5119](https://github.com/open-chat-labs/open-chat/pull/5119))
- Increase max message length to 10k characters ([#5140](https://github.com/open-chat-labs/open-chat/pull/5140))
- Return success from `deleted_message` even if message not deleted ([#5145](https://github.com/open-chat-labs/open-chat/pull/5145))

### Fixed

Expand Down
1 change: 0 additions & 1 deletion backend/canisters/group/api/can.did
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ type DeletedMessageResponse = variant {
CallerNotInGroup;
NotAuthorized;
MessageNotFound;
MessageNotDeleted;
MessageHardDeleted;
};

Expand Down
1 change: 0 additions & 1 deletion backend/canisters/group/api/src/queries/deleted_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ pub enum Response {
CallerNotInGroup,
NotAuthorized,
MessageNotFound,
MessageNotDeleted,
MessageHardDeleted,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ fn deleted_message_impl(args: Args, state: &RuntimeState) -> Response {
DeletedMessageResult::UserNotInGroup => CallerNotInGroup,
DeletedMessageResult::NotAuthorized => NotAuthorized,
DeletedMessageResult::MessageNotFound => MessageNotFound,
DeletedMessageResult::MessageNotDeleted => MessageNotDeleted,
DeletedMessageResult::MessageHardDeleted => MessageHardDeleted,
}
} else {
Expand Down
1 change: 1 addition & 0 deletions backend/canisters/user/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add `local_user_index_canister_id` to `initial_state` response ([#5083](https://github.com/open-chat-labs/open-chat/pull/5083))
- Don't mark messages as edited if only link removed ([#5119](https://github.com/open-chat-labs/open-chat/pull/5119))
- Increase max message length to 10k characters ([#5140](https://github.com/open-chat-labs/open-chat/pull/5140))
- Return success from `deleted_message` even if message not deleted ([#5145](https://github.com/open-chat-labs/open-chat/pull/5145))

### Removed

Expand Down
1 change: 0 additions & 1 deletion backend/canisters/user/api/can.did
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,6 @@ type DeletedMessageResponse = variant {
ChatNotFound;
NotAuthorized;
MessageNotFound;
MessageNotDeleted;
MessageHardDeleted;
};

Expand Down
1 change: 0 additions & 1 deletion backend/canisters/user/api/src/queries/deleted_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ pub enum Response {
ChatNotFound,
NotAuthorized,
MessageNotFound,
MessageNotDeleted,
MessageHardDeleted,
}

Expand Down
1 change: 0 additions & 1 deletion backend/canisters/user/impl/src/queries/deleted_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ fn deleted_message_impl(args: Args, state: &RuntimeState) -> Response {
let deleted_by = message.deleted_by.as_ref().map(|d| d.deleted_by);

match deleted_by {
None => MessageNotDeleted,
Some(u) if u != my_user_id => NotAuthorized,
_ => {
if matches!(message.content, MessageContentInternal::Deleted(_)) {
Expand Down
3 changes: 1 addition & 2 deletions backend/libraries/group_chat_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ impl GroupChatCore {
NotAuthorized
}
} else {
MessageNotDeleted
Success(Box::new(message.content.hydrate(Some(user_id))))
};
}
}
Expand Down Expand Up @@ -1893,7 +1893,6 @@ pub enum DeletedMessageResult {
UserNotInGroup,
NotAuthorized,
MessageNotFound,
MessageNotDeleted,
MessageHardDeleted,
}

Expand Down

0 comments on commit 9747f46

Please sign in to comment.