Skip to content
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

Remove include of zotonic_version.hrl from zotonic.hrl. #1844

Merged
merged 1 commit into from
Nov 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions apps/zotonic_core/include/zotonic.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.

%% The release information
-include("zotonic_release.hrl").

%% @doc The request context, session information and other
-record(context, {
%% Cowboy request data (only set when this context is used because of a request)
Expand Down
2 changes: 1 addition & 1 deletion apps/zotonic_core/src/smtp/z_email_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ date(Context) ->
iolist_to_binary(z_datetime:format("r", z_context:set_language(en, Context))).

x_mailer() ->
iolist_to_binary(["Zotonic ", ?ZOTONIC_VERSION, " (http://zotonic.com)"]).
<<"Zotonic (http://zotonic.com)">>.

add_cc(#email{cc = undefined}, Headers) -> Headers;
add_cc(#email{cc = []}, Headers) -> Headers;
Expand Down
1 change: 1 addition & 0 deletions apps/zotonic_core/src/support/z_site_startup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
-export([start_link/1]).

-include_lib("zotonic.hrl").
-include("zotonic_release.hrl").

-record(state, { site :: atom() }).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
trace_block/4
]).

-include("zotonic.hrl").
-include_lib("zotonic_core/include/zotonic.hrl").
-include_lib("zotonic_core/include/zotonic_release.hrl").
-include_lib("template_compiler/include/template_compiler.hrl").


Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{% if id.name_first or id.name_surname %}{{ id.name_first }}{% if id.name_surname_prefix %} {{ id.name_surname_prefix }}{% endif %}{% if id.name_surname %} {{ id.name_surname }}{% endif %}{% else %}{{ id.title }}{% endif %}
{% if id.name_first or id.name_surname %}{{ id.name_first }}{% if id.name_surname_prefix %} {{ id.name_surname_prefix }}{% endif %}{% if id.name_surname %} {{ id.name_surname }}{% endif %}{% else %}{{ id.title }}{% endif %}
49 changes: 30 additions & 19 deletions apps/zotonic_mod_base/src/services/service_base_info.erl
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
%% @author Arjan Scherpenisse <arjan@scherpenisse.net>
%% @copyright 2009 Arjan Scherpenisse
%% Date: 2009-10-03
%% @copyright 2009-2017 Arjan Scherpenisse
%% @doc Get information about the system.

%% Copyright 2009 Arjan Scherpenisse
%% Copyright 2009-2017 Arjan Scherpenisse
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
Expand All @@ -21,26 +20,38 @@
-author("Arjan Scherpenisse <arjan@scherpenisse.net>").

-svc_title("Basic information about the system.").
-svc_needauth(true).
-svc_needauth(false).

-export([process_get/1]).

-include_lib("zotonic_core/include/zotonic.hrl").
-include_lib("zotonic_core/include/zotonic_release.hrl").


process_get(Context) ->
Result = case z_auth:is_auth(Context) of
true ->
z_convert:to_list(z_trans:lookup_fallback(m_rsc:p(Context#context.user_id, title, Context), Context));
false ->
"Anonymous"
end,
{struct, [{"user", {struct, [{"user_name", z_convert:to_atom(Result)},
{"user_id", Context#context.user_id}]}},
{"site", {struct, [{"zotonic_version", ?ZOTONIC_VERSION},
{"language", cfg(i18n, language, Context)}]}}
]
}.

cfg(Key, Value, Context) ->
z_convert:to_atom(m_config:get_value(Key, Value, Context)).
{struct, [
{"user", {struct, user_info(z_acl:user(Context), Context)} },
{"site", {struct, site_info(z_acl:is_admin(Context), Context)} }
]}.

user_info(UserId, Context) when is_integer(UserId) ->
{Name, _Context} = z_template:render_to_iolist("_name.tpl", [{id, UserId}], Context),
[
{"user_name", iolist_to_binary(Name)},
{"user_id", UserId}
];
user_info(undefined, _Context) ->
[
{"user_name", null},
{"user_id", null}
].

site_info(true, Context) ->
[
{"zotonic_version", ?ZOTONIC_VERSION},
{"language", z_language:default_language(Context)}
];
site_info(false, Context) ->
[
{"language", z_language:default_language(Context)}
].