mirror of
https://github.com/rickbarrette/redmine_auto_assign.git
synced 2026-04-02 09:41:58 -04:00
Initial Commit
This commit is contained in:
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2026 Rick Barrette
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
41
README.md
Normal file
41
README.md
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Redmine Auto Assign Plugin
|
||||||
|
|
||||||
|
Automatically assigns an issue to the first user who logs time against it.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The **Redmine Auto Assign Plugin** improves workflow efficiency by ensuring issues are assigned when work begins.
|
||||||
|
|
||||||
|
When a user logs time on an issue:
|
||||||
|
|
||||||
|
- If the issue is **unassigned**, it is assigned to that user
|
||||||
|
- If the issue status is **"New"**, it is changed to **"In Progress"**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Auto-assigns issue on first time entry
|
||||||
|
- Updates issue status from *New → In Progress*
|
||||||
|
- Lightweight and non-intrusive
|
||||||
|
- No UI changes required
|
||||||
|
- Works with standard Redmine time tracking
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Redmine 6.x
|
||||||
|
- Compatible Ruby version (per your Redmine install)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
1. Copy the plugin into your Redmine plugins directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /path/to/redmine/plugins
|
||||||
|
git clone https://github.com/rickbarrette/redmine_auto_assign.git
|
||||||
23
init.rb
Normal file
23
init.rb
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#The MIT License (MIT)
|
||||||
|
#
|
||||||
|
#Copyright (c) 2026 rick barrette
|
||||||
|
#
|
||||||
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
require_relative 'lib/auto_assign'
|
||||||
|
require_relative 'lib/auto_assign/patches/time_entry_patch'
|
||||||
|
|
||||||
|
Redmine::Plugin.register :redmine_auto_assign do
|
||||||
|
name 'Redmine Auto Assign plugin'
|
||||||
|
author 'Rick Barrette'
|
||||||
|
description 'Automatically assigns an issue to the first user who logs time against it.'
|
||||||
|
version '2026.3.0'
|
||||||
|
url 'https://github.com/rickbarrette/redmine_auto_assign'
|
||||||
|
author_url 'https://barrettefabrication.com'
|
||||||
|
end
|
||||||
|
|
||||||
|
AutoAssign.setup
|
||||||
16
lib/auto_assign.rb
Normal file
16
lib/auto_assign.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#The MIT License (MIT)
|
||||||
|
#
|
||||||
|
#Copyright (c) 2026 rick barrette
|
||||||
|
#
|
||||||
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
module AutoAssign
|
||||||
|
def self.setup
|
||||||
|
Rails.logger.info ">>> AutoAssign.setup CALLED"
|
||||||
|
TimeEntry.prepend AutoAssign::Patches::TimeEntryPatch
|
||||||
|
end
|
||||||
|
end
|
||||||
54
lib/auto_assign/patches/time_entry_patch.rb
Normal file
54
lib/auto_assign/patches/time_entry_patch.rb
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#The MIT License (MIT)
|
||||||
|
#
|
||||||
|
#Copyright (c) 2026 rick barrette
|
||||||
|
#
|
||||||
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
module AutoAssign
|
||||||
|
module Patches
|
||||||
|
module TimeEntryPatch
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
prepended do
|
||||||
|
after_create :assign_issue
|
||||||
|
end
|
||||||
|
|
||||||
|
def assign_issue
|
||||||
|
return unless issue
|
||||||
|
|
||||||
|
log "assign_issue triggered for TimeEntry ##{id}"
|
||||||
|
|
||||||
|
# Only assign if nobody is assigned yet
|
||||||
|
if issue.assigned_to.blank?
|
||||||
|
issue.assigned_to = user
|
||||||
|
log "Assigned Issue ##{issue.id} to #{user.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Only move status if still "New"
|
||||||
|
if issue.status&.name == "New"
|
||||||
|
in_progress = IssueStatus.find_by(name: "In Progress")
|
||||||
|
if in_progress
|
||||||
|
issue.status = in_progress
|
||||||
|
log "Moved Issue ##{issue.id} to In Progress"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if issue.changed?
|
||||||
|
issue.save!
|
||||||
|
else
|
||||||
|
log "No changes needed for Issue ##{issue.id}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def log(msg)
|
||||||
|
Rails.logger.info "[AutoAssign] #{msg}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user