def edit_labels
old_labels = @thread.labels
reserved_labels = old_labels.select { |l| LabelManager::RESERVED_LABELS.include? l }
new_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", @thread.labels
return unless new_labels
@thread.labels = Set.new(reserved_labels) + new_labels
new_labels.each { |l| LabelManager << l }
update
UpdateManager.relay self, :labeled, @thread.first
Index.save_thread @thread
UndoManager.register "labeling thread" do
@thread.labels = old_labels
Index.save_thread @thread
UpdateManager.relay self, :labeled, @thread.first
end
end