Skip to content

Commit

Permalink
chore(ui): display branch in footer if present
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcooke committed Mar 20, 2024
1 parent bee5098 commit 1823617
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
7 changes: 7 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,11 @@ def endpoint_options_for_select(server, selected_value = nil, options = {})
end.html_safe
end

def postal_version_string
string = Postal.version
string += " (#{Postal.branch})" if Postal.branch &&
Postal.branch != "main"
string
end

end
4 changes: 3 additions & 1 deletion app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
%footer.siteContent__footer
%ul.footer__links
%li.footer__name
Powered by #{link_to "Postal", "https://postalserver.io", target: '_blank'} #{Postal.version}.
Powered by
#{link_to "Postal", "https://postalserver.io", target: '_blank'}
#{postal_version_string}
%li= link_to "Documentation", "https://docs.postalserver.io", target: '_blank'
%li= link_to "Ask for help", "https://discussions.postalserver.io", target: '_blank'
12 changes: 12 additions & 0 deletions lib/postal/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ def change_database_connection_pool_size(new_size)
ActiveRecord::Base.establish_connection(config.merge(pool: new_size))
end

# Return the branch name which created this release
#
# @return [String, nil]
def branch
return @branch if instance_variable_defined?("@branch")

@branch = begin
path = Rails.root.join("BRANCH")
File.read(path).strip if File.exist?(path)
end
end

end

Config = initialize_config
Expand Down

0 comments on commit 1823617

Please sign in to comment.