Skip to content

Commit

Permalink
Remove report_message superseded by report_message_v2 (#4524)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Oct 8, 2023
1 parent 8c45f3d commit 3f70b8c
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 117 deletions.
4 changes: 4 additions & 0 deletions backend/canisters/local_user_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

### Removed

- Remove `report_message` which has been superseded by `report_message_v2` ([#4524](https://github.com/open-chat-labs/open-chat/pull/4524))

### Fixed

- Fix 'Report message' functionality ([#4523](https://github.com/open-chat-labs/open-chat/pull/4523))
Expand Down
9 changes: 0 additions & 9 deletions backend/canisters/local_user_index/api/can.did
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,6 @@ type RegisterUserResponse = variant {
ReferralCodeExpired;
};

type ReportMessageArgs = record {
chat_id : ChatId;
thread_root_message_index : opt MessageIndex;
event_index : EventIndex;
reason_code : nat32;
notes : opt text;
};

type ReportMessageV2Args = record {
chat_id : MultiUserChat;
thread_root_message_index : opt MessageIndex;
Expand All @@ -179,5 +171,4 @@ service : {
invite_users_to_group : (InviteUsersToGroupArgs) -> (InviteUsersToGroupResponse);
register_user : (RegisterUserArgs) -> (RegisterUserResponse);
report_message_v2 : (ReportMessageV2Args) -> (ReportMessageResponse);
report_message : (ReportMessageArgs) -> (ReportMessageResponse);
};
1 change: 0 additions & 1 deletion backend/canisters/local_user_index/api/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ fn main() {
generate_candid_method!(local_user_index, join_group, update);
generate_candid_method!(local_user_index, register_user, update);
generate_candid_method!(local_user_index, report_message_v2, update);
generate_candid_method!(local_user_index, report_message, update);

candid::export_service!();
std::print!("{}", __export_service());
Expand Down
1 change: 0 additions & 1 deletion backend/canisters/local_user_index/api/src/updates/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ pub mod join_channel;
pub mod join_community;
pub mod join_group;
pub mod register_user;
pub mod report_message;
pub mod report_message_v2;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ fn accept_if_valid(state: &RuntimeState) {
| "join_channel"
| "join_community"
| "join_group"
| "report_message"
| "report_message_v2" => state.is_caller_openchat_user(),
"register_user" => true,
_ => false,
Expand Down
1 change: 0 additions & 1 deletion backend/canisters/local_user_index/impl/src/updates/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ pub mod join_channel;
pub mod join_community;
pub mod join_group;
pub mod register_user;
pub mod report_message;
pub mod report_message_v2;

This file was deleted.

2 changes: 1 addition & 1 deletion backend/integration_tests/src/client/local_user_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ generate_update_call!(join_channel);
generate_update_call!(join_community);
generate_update_call!(join_group);
generate_update_call!(register_user);
generate_update_call!(report_message);
generate_update_call!(report_message_v2);

pub mod happy_path {
use crate::rng::random_user_principal;
Expand Down
8 changes: 4 additions & 4 deletions backend/integration_tests/src/platform_moderator_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{client, CanisterIds, TestEnv, User};
use candid::Principal;
use ic_test_state_machine_client::StateMachine;
use std::ops::Deref;
use types::{Chat, ChatEvent, ChatId, MessageContent};
use types::{Chat, ChatEvent, ChatId, MessageContent, MultiUserChat};

#[test]
fn new_platform_moderators_added_to_moderators_group() {
Expand Down Expand Up @@ -59,12 +59,12 @@ fn report_message_succeeds() {

let group_id = client::user::happy_path::create_group(env, &user2, &random_string(), true, true);

client::local_user_index::report_message(
client::local_user_index::report_message_v2(
env,
user2.principal,
canister_ids.local_user_index,
&local_user_index_canister::report_message::Args {
chat_id: group_id,
&local_user_index_canister::report_message_v2::Args {
chat_id: MultiUserChat::Group(group_id),
thread_root_message_index: None,
event_index: 10.into(),
reason_code: 1,
Expand Down
20 changes: 4 additions & 16 deletions frontend/openchat-agent/src/services/localUserIndex/candid/idl.js
Original file line number Diff line number Diff line change
Expand Up @@ -689,17 +689,6 @@ export const idlFactory = ({ IDL }) => {
'ReferralCodeInvalid' : IDL.Null,
'CyclesBalanceTooLow' : IDL.Null,
});
const ReportMessageArgs = IDL.Record({
'notes' : IDL.Opt(IDL.Text),
'chat_id' : ChatId,
'reason_code' : IDL.Nat32,
'event_index' : EventIndex,
'thread_root_message_index' : IDL.Opt(MessageIndex),
});
const ReportMessageResponse = IDL.Variant({
'Success' : IDL.Null,
'InternalError' : IDL.Text,
});
const MultiUserChat = IDL.Variant({
'Group' : ChatId,
'Channel' : IDL.Tuple(CommunityId, ChannelId),
Expand All @@ -711,6 +700,10 @@ export const idlFactory = ({ IDL }) => {
'event_index' : EventIndex,
'thread_root_message_index' : IDL.Opt(MessageIndex),
});
const ReportMessageResponse = IDL.Variant({
'Success' : IDL.Null,
'InternalError' : IDL.Text,
});
return IDL.Service({
'invite_users_to_channel' : IDL.Func(
[InviteUsersToChannelArgs],
Expand All @@ -735,11 +728,6 @@ export const idlFactory = ({ IDL }) => {
),
'join_group' : IDL.Func([JoinGroupArgs], [JoinGroupResponse], []),
'register_user' : IDL.Func([RegisterUserArgs], [RegisterUserResponse], []),
'report_message' : IDL.Func(
[ReportMessageArgs],
[ReportMessageResponse],
[],
),
'report_message_v2' : IDL.Func(
[ReportMessageV2Args],
[ReportMessageResponse],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1202,13 +1202,6 @@ export interface ReplyContext {
'chat_if_other' : [] | [[Chat, [] | [MessageIndex]]],
'event_index' : EventIndex,
}
export interface ReportMessageArgs {
'notes' : [] | [string],
'chat_id' : ChatId,
'reason_code' : number,
'event_index' : EventIndex,
'thread_root_message_index' : [] | [MessageIndex],
}
export type ReportMessageResponse = { 'Success' : null } |
{ 'InternalError' : string };
export interface ReportMessageV2Args {
Expand Down Expand Up @@ -1377,7 +1370,6 @@ export interface _SERVICE {
'join_community' : ActorMethod<[JoinCommunityArgs], JoinCommunityResponse>,
'join_group' : ActorMethod<[JoinGroupArgs], JoinGroupResponse>,
'register_user' : ActorMethod<[RegisterUserArgs], RegisterUserResponse>,
'report_message' : ActorMethod<[ReportMessageArgs], ReportMessageResponse>,
'report_message_v2' : ActorMethod<
[ReportMessageV2Args],
ReportMessageResponse
Expand Down

0 comments on commit 3f70b8c

Please sign in to comment.