lib/slack/smart-bot/utils/update_vacations.rb in slack-smart-bot-1.12.9 vs lib/slack/smart-bot/utils/update_vacations.rb in slack-smart-bot-1.13.0
- old
+ new
@@ -3,14 +3,16 @@
require 'yaml'
unless vacation.nil?
get_vacations()
@vacations.merge!(vacation)
end
- vacations_file = config.file_path.gsub(".rb", "_vacations.yaml")
+ user = Thread.current[:user]
+ vacations_file = File.join(config.path, "vacations", "v_#{user.name}.yaml")
+
File.open(vacations_file, 'w') {|file|
file.flock(File::LOCK_EX)
- file.write(@vacations.to_yaml)
+ file.write(encrypt(@vacations[user.name].to_yaml))
file.flock(File::LOCK_UN)
}
- @datetime_vacations_file = File.mtime(vacations_file)
+ @datetime_vacations_file[vacations_file] = File.mtime(vacations_file)
end
end