Skip to content

Commit

Permalink
Remove code to initialize the ModClub integration (#4826)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Nov 22, 2023
1 parent e7c1148 commit d439113
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 133 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 @@ -9,6 +9,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- Regenerate random number generator seed across upgrades ([#4814](https://github.com/open-chat-labs/open-chat/pull/4814))

### Removed

- Remove code to initialize the ModClub integration ([#4826](https://github.com/open-chat-labs/open-chat/pull/4826))

## [[2.0.934](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.934-user_index)] - 2023-11-15

### Added
Expand Down
114 changes: 0 additions & 114 deletions backend/canisters/user_index/impl/src/initialize_modclub.rs

This file was deleted.

1 change: 0 additions & 1 deletion backend/canisters/user_index/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use utils::env::Environment;
use utils::time::DAY_IN_MS;

mod guards;
mod initialize_modclub;
mod jobs;
mod lifecycle;
mod memory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
use crate::initialize_modclub::initialize_modclub;
use crate::lifecycle::{init_env, init_state};
use crate::memory::get_upgrades_memory;
use crate::Data;
use canister_logger::LogEntry;
use canister_tracing_macros::trace;
use ic_cdk_macros::post_upgrade;
use stable_memory::get_reader;
use std::time::Duration;
use tracing::info;
use user_index_canister::post_upgrade::Args;
use utils::cycles::init_cycles_dispenser_client;
Expand All @@ -25,12 +23,5 @@ fn post_upgrade(args: Args) {
init_cycles_dispenser_client(data.cycles_dispenser_canister_id);
init_state(env, data, args.wasm_version);

// TODO: delete this once user_index has been released
ic_cdk_timers::set_timer(Duration::ZERO, initialize_modclub_outer);

info!(version = %args.wasm_version, "Post-upgrade complete");
}

fn initialize_modclub_outer() {
ic_cdk::spawn(initialize_modclub());
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@ use types::{Chat, MessageContent, MessageId, MessageIndex, TextContent, Timestam
pub struct ReportedMessages {
messages: Vec<ReportedMessage>,
lookup: HashMap<(Chat, Option<MessageIndex>, MessageIndex), usize>,
#[serde(default)]
rules: Vec<Rule>,
}

impl ReportedMessages {
pub fn set_rules(&mut self, rules: Vec<Rule>) {
self.rules = rules;
}

pub fn add_report(&mut self, args: AddReportArgs) -> AddReportResult {
if let Some(index) = self
.lookup
Expand Down Expand Up @@ -95,10 +90,6 @@ impl ReportedMessages {
}
}

pub fn rules(&self) -> &Vec<Rule> {
&self.rules
}

fn index_from_rule_id(&self, rule_id: String) -> usize {
self.rules.iter().position(|r| r.id == rule_id).unwrap()
}
Expand Down

0 comments on commit d439113

Please sign in to comment.