Skip to content

Commit

Permalink
Fix config rename
Browse files Browse the repository at this point in the history
  • Loading branch information
BaeoMaltinsky committed Sep 16, 2019
1 parent ec7ea96 commit 7c57ebd
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion heraldqt/SideBar/popups/ConfigPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Window {
Button {
text: "Submit"
onClicked: {
JS.submit(config, cfgUid, cfgUname)
JS.submit(config, heraldState.configInit, cfgUid, cfgUname)
close()
}
}
Expand Down
2 changes: 1 addition & 1 deletion heraldqt/SideBar/popups/ConfigPopupSubmission.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function submit(config, configInit, useridField, usernameField) {
if (configInit) {
if (!configInit) {
config.configId = useridField.text.trim();
}
config.name = usernameField.text.trim();
Expand Down
2 changes: 1 addition & 1 deletion heraldqt/SideBar/popups/ConfigPopupSubmission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export function submit(
useridField: TextField,
usernameField: TextField
): void {
if (configInit) {
if (!configInit) {
config.configId = useridField.text.trim();
}
config.name = usernameField.text.trim();
Expand Down
3 changes: 1 addition & 2 deletions libherald/heraldcore/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ impl Config {

/// Updates user's display name
pub fn set_name(&mut self, name: Option<String>) -> Result<(), HErr> {
self.db
.execute(include_str!("sql/config/update_name.sql"), params![name])?;
crate::contact::set_name(&self.db, &self.id, name.as_ref().map(|s| s.as_str()))?;

self.name = name;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion libherald/heraldcore/src/contact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn name(db: &Database, id: UserIdRef) -> Result<Option<String>, HErr> {
}

/// Change name of contact by their `id`
fn set_name(db: &Database, id: UserIdRef, name: Option<&str>) -> Result<(), HErr> {
pub(crate) fn set_name(db: &Database, id: UserIdRef, name: Option<&str>) -> Result<(), HErr> {
let mut stmt = db.prepare(include_str!("sql/contact/update_name.sql"))?;

stmt.execute(params![name, id])?;
Expand Down

0 comments on commit 7c57ebd

Please sign in to comment.