diff --git a/app/pos-modules.json b/app/pos-modules.json index ffc3e58..1b69f3d 100644 --- a/app/pos-modules.json +++ b/app/pos-modules.json @@ -1,6 +1,6 @@ { "modules": { - "profile": "1.0.11", + "profile": "1.1.0", "user": "3.0.7" } } \ No newline at end of file diff --git a/app/pos-modules.lock.json b/app/pos-modules.lock.json index 9cc9065..c8cc72c 100644 --- a/app/pos-modules.lock.json +++ b/app/pos-modules.lock.json @@ -1,6 +1,6 @@ { "modules": { - "profile": "1.0.11", + "profile": "1.1.0", "user": "3.0.7", "components": "1.1.3", "core": "1.5.5" diff --git a/app/views/layouts/application.liquid b/app/views/layouts/application.liquid index 8311b46..c586f80 100644 --- a/app/views/layouts/application.liquid +++ b/app/views/layouts/application.liquid @@ -1,7 +1,5 @@ -{% liquid - - function current_profile = 'modules/profile/queries/profiles/find', user_id: context.current_user.id, id: null, uuid: null, first_name: null, last_name: null - +{% liquid + assign current_profile = context.exports.current_profile %} @@ -23,7 +21,6 @@ - {% comment %} custom js specific for this app {% endcomment %} @@ -40,7 +37,7 @@ font-display: swap; src: url('{{ 'font/SourceCodePro-VariableFont_wght.ttf' | asset_url }}') format('truetype'); } - + @font-face { font-family: 'Source Code Pro'; font-style: italic; @@ -48,7 +45,7 @@ font-display: swap; src: url('{{ 'SourceCodePro-Italic-VariableFont_wght.woff2' | asset_url }}') format('woff2'); } - + @@ -57,8 +54,8 @@ {% if current_profile.id %} {% render 'header', current_profile: current_profile %} {% endif %} - + {{ content_for_layout }} - \ No newline at end of file + diff --git a/modules/chat/public/views/pages/api/messages/show.json.liquid b/modules/chat/public/views/pages/api/messages/show.json.liquid index fe49f02..fb907a7 100644 --- a/modules/chat/public/views/pages/api/messages/show.json.liquid +++ b/modules/chat/public/views/pages/api/messages/show.json.liquid @@ -13,14 +13,12 @@ method: get {% endcomment %} {% liquid - function current_user = 'modules/user/queries/user/current' + function current_profile = 'modules/profile/helpers/current_profile' # platformos-check-disable ConvertIncludeToRenderl, UnreachableCode - include 'modules/user/helpers/can_do_or_unauthorized', requester: current_user, do: 'chat.inbox', return_url: '/' + include 'modules/user/helpers/can_do_or_unauthorized', requester: current_profile, do: 'chat.inbox', return_url: '/' # platformos-check-enable ConvertIncludeToRender, UnreachableCode - function current_profile = 'modules/profile/queries/profiles/find', user_id: current_user.id, id: null, uuid: null, first_name: null, last_name: null - assign conversation_id = context.params.conversation_id assign page = context.params.page | plus: 0 | default: 1 assign limit = context.params.per_page | plus: 0 | default: 30 diff --git a/modules/chat/public/views/pages/inbox.html.liquid b/modules/chat/public/views/pages/inbox.html.liquid index fd2f833..863c605 100644 --- a/modules/chat/public/views/pages/inbox.html.liquid +++ b/modules/chat/public/views/pages/inbox.html.liquid @@ -1,16 +1,13 @@ --- slug: inbox --- - {% liquid - function current_user = 'modules/user/queries/user/current' + function current_profile = 'modules/profile/helpers/current_profile' # platformos-check-disable ConvertIncludeToRenderl, UnreachableCode - include 'modules/user/helpers/can_do_or_unauthorized', requester: current_user, do: 'chat.inbox', return_url: '/' + include 'modules/user/helpers/can_do_or_unauthorized', requester: current_profile, do: 'chat.inbox', return_url: '/' # platformos-check-enable ConvertIncludeToRender, UnreachableCode - function current_profile = 'modules/profile/queries/profiles/find', user_id: current_user.id, id: null, uuid: null, first_name: null, last_name: null - function record = 'modules/chat/lib/queries/records/find_by_uuid', uuid: context.params['to_uuid'] assign object = null | hash_merge: to_id: record.id, conversation_id: context.params['conversation_id'] diff --git a/modules/chat/public/views/partials/channels/conversate/receive.liquid b/modules/chat/public/views/partials/channels/conversate/receive.liquid index 0b623c9..49fb02f 100644 --- a/modules/chat/public/views/partials/channels/conversate/receive.liquid +++ b/modules/chat/public/views/partials/channels/conversate/receive.liquid @@ -14,7 +14,8 @@ {% endcomment %} {% liquid - function current_profile = 'modules/profile/queries/profiles/find', user_id: context.current_user.id, id: null, uuid: null, first_name: null, last_name: null + function current_profile = 'modules/profile/helpers/current_profile' + assign room_id = context.params.room_id function conversation = 'modules/chat/lib/queries/conversations/find_by_participant', id: room_id, participant_id: current_profile.id, include_messages: null diff --git a/modules/chat/public/views/partials/channels/conversate/subscribed.liquid b/modules/chat/public/views/partials/channels/conversate/subscribed.liquid index 796ab26..69166f1 100644 --- a/modules/chat/public/views/partials/channels/conversate/subscribed.liquid +++ b/modules/chat/public/views/partials/channels/conversate/subscribed.liquid @@ -1,5 +1,6 @@ {% liquid - function current_profile = 'modules/profile/queries/profiles/find', user_id: context.current_user.id, id: null, uuid: null, first_name: null, last_name: null + function current_profile = 'modules/profile/helpers/current_profile' + assign room_id = context.params.room_id function conversation = 'modules/chat/lib/queries/conversations/find_by_participant', id: room_id, participant_id: current_profile.id, include_messages: null diff --git a/modules/chat/public/views/partials/lib/queries/conversations/find.liquid b/modules/chat/public/views/partials/lib/queries/conversations/find.liquid index 16dc450..6641148 100644 --- a/modules/chat/public/views/partials/lib/queries/conversations/find.liquid +++ b/modules/chat/public/views/partials/lib/queries/conversations/find.liquid @@ -11,7 +11,7 @@ assign participants = '[]' | parse_json for participant_id in conversation.participant_ids - function profile = 'modules/profile/queries/profiles/find_proxy', id: participant_id + function profile = 'modules/profile/queries/profiles/find', id: participant_id assign participants = participants | add_to_array: profile endfor diff --git a/modules/chat/public/views/partials/lib/queries/conversations/find_by_participant.liquid b/modules/chat/public/views/partials/lib/queries/conversations/find_by_participant.liquid index 593a3c1..7e00b5a 100644 --- a/modules/chat/public/views/partials/lib/queries/conversations/find_by_participant.liquid +++ b/modules/chat/public/views/partials/lib/queries/conversations/find_by_participant.liquid @@ -18,7 +18,7 @@ assign participants = '[]' | parse_json for participant_id in conversation.participant_ids - function profile = 'modules/profile/queries/profiles/find_proxy', id: participant_id + function profile = 'modules/profile/queries/profiles/find', id: participant_id assign participants = participants | add_to_array: profile endfor diff --git a/modules/chat/public/views/partials/lib/queries/conversations/find_by_participants.liquid b/modules/chat/public/views/partials/lib/queries/conversations/find_by_participants.liquid index 5fd0bf3..2e68976 100644 --- a/modules/chat/public/views/partials/lib/queries/conversations/find_by_participants.liquid +++ b/modules/chat/public/views/partials/lib/queries/conversations/find_by_participants.liquid @@ -12,7 +12,7 @@ assign participants = '[]' | parse_json for participant_id in conversation.participant_ids - function profile = 'modules/profile/queries/profiles/find_proxy', id: participant_id + function profile = 'modules/profile/queries/profiles/find', id: participant_id, user_id: null, uuid: null, first_name: null, last_name: null assign participants = participants | add_to_array: profile endfor diff --git a/modules/chat/public/views/partials/lib/queries/conversations/search.liquid b/modules/chat/public/views/partials/lib/queries/conversations/search.liquid index 715a774..9deb872 100644 --- a/modules/chat/public/views/partials/lib/queries/conversations/search.liquid +++ b/modules/chat/public/views/partials/lib/queries/conversations/search.liquid @@ -9,7 +9,7 @@ assign participants = '[]' | parse_json for participant_id in conversation.participant_ids - function profile = 'modules/profile/queries/profiles/find_proxy', id: participant_id + function profile = 'modules/profile/queries/profiles/find', id: participant_id assign participants = participants | add_to_array: profile endfor diff --git a/modules/chat/public/views/partials/lib/queries/conversations/search_by_participant.liquid b/modules/chat/public/views/partials/lib/queries/conversations/search_by_participant.liquid index 8d92640..d375bb4 100644 --- a/modules/chat/public/views/partials/lib/queries/conversations/search_by_participant.liquid +++ b/modules/chat/public/views/partials/lib/queries/conversations/search_by_participant.liquid @@ -15,7 +15,7 @@ assign participants = '[]' | parse_json for participant_id in conversation.participant_ids - function profile = 'modules/profile/queries/profiles/find_proxy', id: participant_id + function profile = 'modules/profile/queries/profiles/find', id: participant_id, user_id: null, uuid: null, filters: null assign participants = participants | add_to_array: profile endfor diff --git a/modules/chat/template-values.json b/modules/chat/template-values.json index fe51735..6c4f167 100644 --- a/modules/chat/template-values.json +++ b/modules/chat/template-values.json @@ -6,8 +6,8 @@ "dependencies": { "components": "^1.1.3", "core": "^1.0.0", - "profile": "^1.0.0", - "user": "^1.0.0", + "profile": "^1.1.0", + "user": "^1.0.0" "common-styling": "0.0.3" } } diff --git a/modules/profile/public/lib/helpers/current_profile.liquid b/modules/profile/public/lib/helpers/current_profile.liquid new file mode 100644 index 0000000..7ef1730 --- /dev/null +++ b/modules/profile/public/lib/helpers/current_profile.liquid @@ -0,0 +1,11 @@ +{% liquid + function user = 'modules/user/queries/user/current' + if user.id + function current_profile = 'modules/profile/queries/profiles/find', user_id: user.id, id: null, uuid: null, first_name: null, last_name: null + endif + + assign current_profile = current_profile | hash_merge: roles: user.roles, permissions: user.permissions, user: user + + export current_profile + return current_profile +%} diff --git a/modules/profile/public/lib/helpers/profiles/slugs/build.liquid b/modules/profile/public/lib/helpers/profiles/slugs/build.liquid index c7dbfb4..58033ea 100644 --- a/modules/profile/public/lib/helpers/profiles/slugs/build.liquid +++ b/modules/profile/public/lib/helpers/profiles/slugs/build.liquid @@ -1,6 +1,8 @@ -{%liquid -assign first_name = current_profile.properties.first_name -assign last_name = current_profile.properties.last_name -assign slug = first_name | append: '-' | append: last_name | append: '-' | append: current_profile.id | slugify -return slug -%} \ No newline at end of file +{% liquid + assign profile = profile | default: current_profile + assign first_name = profile.first_name | default: current_profile.properties.first_name + assign last_name = profile.last_name | default: current_profile.properties.last_name + assign slug = first_name | append: '-' | append: last_name | append: '-' | append: profile.id | slugify + + return slug +%} diff --git a/modules/profile/template-values.json b/modules/profile/template-values.json index cecd933..f79ef44 100644 --- a/modules/profile/template-values.json +++ b/modules/profile/template-values.json @@ -2,8 +2,9 @@ "name": "Profile", "machine_name": "profile", "type": "module", - "version": "1.0.11", + "version": "1.1.0", "dependencies": { - "core": "^1.0.0" + "core": "^1.0.0", + "user": "^3.0.0" } }