Skip to content

Commit 606b3b6

Browse files
committed
fix: "kept" message templates reapplying with empty variables
1 parent 60b449b commit 606b3b6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src-tauri/src/api/user.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ impl VrcMrdUser {
172172
for advisory in active_advisories.iter() {
173173
let relevant_group_id: RefCell<Option<String>> = RefCell::new(None);
174174
let templates = RefCell::new(HashMap::new());
175+
let keep = RefCell::new(Vec::new());
175176
templates
176177
.borrow_mut()
177178
.insert("username", self.username.clone());
@@ -189,6 +190,7 @@ impl VrcMrdUser {
189190
if self.groups.is_empty() && advisories.iter().any(|a| a.id == advisory.id) {
190191
// if the advisory is already active and groups are not available, assume the user is
191192
// still in the group.
193+
keep.borrow_mut().push(advisory.id.clone());
192194
return true;
193195
}
194196
for group in self.groups.iter() {
@@ -257,6 +259,7 @@ impl VrcMrdUser {
257259
if self.groups.is_empty() && advisories.iter().any(|a| a.id == advisory.id) {
258260
// if the advisory is already active and groups are not available, assume the user is
259261
// still in the group.
262+
keep.borrow_mut().push(advisory.id.clone());
260263
return true;
261264
}
262265
let group = self.groups.iter().find(|g| g.name.to_lowercase().contains(&needle.to_lowercase()));
@@ -278,7 +281,7 @@ impl VrcMrdUser {
278281
if advisories.iter().any(|a| a.id == advisory.id) {
279282
// Update the existing advisory, especially if the advisory settings changed
280283
for existing in advisories.iter_mut() {
281-
if existing.id == advisory.id {
284+
if existing.id == advisory.id && !keep.borrow().contains(&advisory.id) {
282285
existing.message = apply_templating(
283286
advisory.message_template.clone().as_str(),
284287
&templates.borrow(),

0 commit comments

Comments
 (0)