forked from chatwoot/chatwoot
-
Notifications
You must be signed in to change notification settings - Fork 136
feat: add per-inbox signature management #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gabrieljablonski
merged 3 commits into
main
from
gabrieljablonski/feat-signature-per-inbox
Feb 26, 2026
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
app/controllers/api/v1/profile/inbox_signatures_controller.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| class Api::V1::Profile::InboxSignaturesController < Api::BaseController | ||
| before_action :set_user | ||
| before_action :set_inbox_signature, only: %i[show update destroy] | ||
|
|
||
| def index | ||
| @inbox_signatures = if params[:account_id].present? | ||
| account_inbox_ids = Account.find(params[:account_id]).inbox_ids | ||
| @user.inbox_signatures.where(inbox_id: account_inbox_ids) | ||
| else | ||
| @user.inbox_signatures | ||
| end | ||
| end | ||
gabrieljablonski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| def show | ||
| head :not_found and return unless @inbox_signature | ||
| end | ||
|
|
||
| def update | ||
| if @inbox_signature | ||
| @inbox_signature.update!(inbox_signature_params) | ||
| else | ||
| @inbox_signature = @user.inbox_signatures.create!( | ||
| inbox_signature_params.merge(inbox_id: params[:inbox_id]) | ||
| ) | ||
| end | ||
| end | ||
gabrieljablonski marked this conversation as resolved.
Show resolved
Hide resolved
gabrieljablonski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| def destroy | ||
| @inbox_signature&.destroy! | ||
| head :no_content | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def set_user | ||
| @user = current_user | ||
| end | ||
|
|
||
| def set_inbox_signature | ||
| @inbox_signature = @user.inbox_signatures.find_by(inbox_id: params[:inbox_id]) | ||
| end | ||
|
|
||
| def inbox_signature_params | ||
| params.require(:inbox_signature).permit(:message_signature, :signature_position, :signature_separator) | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* global axios */ | ||
|
|
||
| const API_BASE = '/api/v1/profile/inbox_signatures'; | ||
|
|
||
| export default { | ||
| getAll(accountId) { | ||
| return axios.get(API_BASE, { | ||
| params: { account_id: accountId }, | ||
| }); | ||
| }, | ||
|
|
||
| get(inboxId) { | ||
| return axios.get(`${API_BASE}/${inboxId}`); | ||
| }, | ||
|
|
||
| upsert(inboxId, params) { | ||
| return axios.put(`${API_BASE}/${inboxId}`, { | ||
| inbox_signature: params, | ||
| }); | ||
| }, | ||
|
|
||
| delete(inboxId) { | ||
| return axios.delete(`${API_BASE}/${inboxId}`); | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.