Sha256: 6323ac95cb7572784fe6bcf750b66a0fdb4b6f940d97cbc2f45c18582f6ce73c
Contents?: true
Size: 985 Bytes
Versions: 3
Compression:
Stored size: 985 Bytes
Contents
class SlackSmartBot def update_personal_settings(user_personal_settings=nil) require 'yaml' unless user_personal_settings.nil? get_personal_settings() @personal_settings.merge!(user_personal_settings) end user = Thread.current[:user].dup team_id = user.team_id team_id_user = Thread.current[:team_id_user] unless Dir.exist?("#{config.path}/personal_settings/#{team_id}") Dir.mkdir("#{config.path}/personal_settings/#{team_id}") end personal_settings_file = File.join(config.path, "personal_settings/#{team_id}", "ps_#{user.name}.yaml") File.open(personal_settings_file, 'w') {|file| file.flock(File::LOCK_EX) file.write(Utils::Encryption.encrypt(@personal_settings[team_id_user].to_yaml, config)) file.flock(File::LOCK_UN) } get_personal_settings() #to update the @personal_settings_hash @datetime_personal_settings_file[personal_settings_file] = File.mtime(personal_settings_file) end end
Version data entries
3 entries across 3 versions & 1 rubygems