-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixes for system account * updated fetch_session spec
- Loading branch information
Showing
3 changed files
with
38 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -38,17 +38,17 @@ def build_payload(params) | |
|
||
def append_account_details(headers) | ||
output = FetchSession.new.call | ||
return output unless output.success? | ||
|
||
session, current_user, system_account = output.value! | ||
account = {} | ||
|
||
if output.success? | ||
session, current_user = output.value! | ||
if session.present? && current_user.present? | ||
account[:session] = session&.symbolize_keys | ||
account[:id] = current_user&.id&.to_s | ||
else | ||
# Create system account user <[email protected]> when session is not available | ||
current_user = system_account if defined?(system_account) | ||
account[:id] = system_account&.id&.to_s | ||
end | ||
|
||
account[:id] = current_user&.id&.to_s | ||
headers[:account] = account | ||
|
||
Success(headers) | ||
|
This file contains 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 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