MDL-77356 communication: Update avatar filename and avatar synced

This commit is contained in:
David Woloszyn
2023-06-30 10:38:40 +10:00
parent 8dbb6183ff
commit 162c9fdd66
6 changed files with 78 additions and 4 deletions
+41
View File
@@ -96,6 +96,7 @@ class processor {
'roomname' => $roomname,
'avatarfilename' => null,
'active' => self::PROVIDER_ACTIVE,
'avatarsynced' => 0,
];
$record->id = $DB->insert_record('communication', $record);
@@ -586,6 +587,46 @@ class processor {
return $file ? $file : null;
}
/**
* Set the avatar file name.
*
* @param string|null $filename
*/
public function set_avatar_filename(?string $filename): void {
global $DB;
$DB->update_record('communication', ['id' => $this->instancedata->id, 'avatarfilename' => $filename]);
}
/**
* Get the avatar file name.
*
* @return string|null
*/
public function get_avatar_filename(): ?string {
return $this->instancedata->avatarfilename;
}
/**
* Check if the avatar has been synced with the provider.
*
* @return bool
*/
public function is_avatar_synced(): bool {
return (bool)$this->instancedata->avatarsynced;
}
/**
* Indicate if the avatar has been synced with the provider.
*
* @param boolean $synced True if avatar has been synced.
*/
public function set_avatar_synced_flag(bool $synced): void {
global $DB;
$DB->update_record('communication', ['id' => $this->instancedata->id, 'avatarsynced' => (int)$synced]);
$this->instancedata->avatarsynced = (int)$synced;
}
/**
* Get a room url.
*