Skip to content

Commit

Permalink
Some adjustments to modclub submissions (#5000)
Browse files Browse the repository at this point in the history
  • Loading branch information
megrogan authored Dec 13, 2023
1 parent 43b1356 commit f5fd359
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
4 changes: 4 additions & 0 deletions backend/canisters/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]

### Changed

- Some adjustments to modclub submissions ([#5000](https://github.com/open-chat-labs/open-chat/pull/5000))

## [[2.0.969](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.969-user_index)] - 2023-12-12

### Changed
Expand Down
21 changes: 10 additions & 11 deletions backend/canisters/user_index/impl/src/updates/c2c_report_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,23 @@ fn c2c_report_message_impl(args: Args, state: &mut RuntimeState) -> Response {
// Queue submission of the report to Modclub
state.queue_modclub_submission(PendingModclubSubmission {
report_index,
title: construct_report_title(&args.message),
html_report: construct_html_report(args.chat_id, args.thread_root_message_index, args.message, args.is_public),
level: if state.data.test_mode { Level::simple } else { Level::normal },
title: construct_report_title(args.chat_id, args.thread_root_message_index, &args.message),
html_report: construct_html_report(args.chat_id, args.thread_root_message_index, &args.message, args.is_public),
level: Level::simple,
});

Success
}

fn construct_report_title(message: &Message) -> String {
let mut title = message.content.text().unwrap_or(&message.content.message_type()).to_string();
title.truncate(80);
title
fn construct_report_title(chat_id: Chat, thread_root_message_index: Option<MessageIndex>, message: &Message) -> String {
// Use the message url as the title so we can find it from the modclub admin dashboard
deep_message_links::build_message_link(chat_id, thread_root_message_index, message.message_index)
}

fn construct_html_report(
chat_id: Chat,
thread_root_message_index: Option<MessageIndex>,
message: Message,
message: &Message,
is_public: bool,
) -> String {
let content = &message.content;
Expand Down Expand Up @@ -196,7 +195,7 @@ https://github.com/open-chat-labs/open-chat/commit/e93865ea29b5bab8a9f0b01052938
last_updated: None,
};

let report = construct_html_report(Chat::Group(chat_id), None, message, true);
let report = construct_html_report(Chat::Group(chat_id), None, &message, true);

print!("{}", report);
}
Expand Down Expand Up @@ -232,7 +231,7 @@ https://github.com/open-chat-labs/open-chat/commit/e93865ea29b5bab8a9f0b01052938
last_updated: None,
};

let report = construct_html_report(chat, None, message, true);
let report = construct_html_report(chat, None, &message, true);

print!("{}", report);
}
Expand Down Expand Up @@ -272,7 +271,7 @@ https://github.com/open-chat-labs/open-chat/commit/e93865ea29b5bab8a9f0b01052938
last_updated: None,
};

let report = construct_html_report(chat, None, message, true);
let report = construct_html_report(chat, None, &message, true);

print!("{}", report);
}
Expand Down

0 comments on commit f5fd359

Please sign in to comment.