Skip to content
This repository was archived by the owner on Jan 29, 2026. It is now read-only.
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .platformos-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ignore:
- node_modules/*
- modules/common-styling/*
- modules/core/*
- modules/user/*

UnusedPartial:
ignore:
- modules/chat/public/views/partials/channels/*
- modules/chat/public/lib/events/*
- modules/chat/public/lib/consumers/*
- modules/chat/public/views/partials/lib/queries/*
- app/modules/*
- modules/chat/public/views/partials/theme/simple/message_button.liquid
4 changes: 2 additions & 2 deletions app/views/layouts/application.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{% comment %} custom js specific for this app {% endcomment %}
<script defer src="{{ 'js/app.js' | asset_url }}"></script>
<script defer src="{{ 'js/popup.js' | asset_url }}"></script>

<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=yes">

<style>
Expand Down Expand Up @@ -58,7 +58,7 @@
if context.location.pathname != flash.from or flash.force_clear
function _ = 'modules/core/commands/session/clear', key: 'sflash'
endif
theme_render_rc 'modules/common-styling/toasts', params: flash
render 'modules/common-styling/toasts', params: flash
%}

</body>
Expand Down
10 changes: 4 additions & 6 deletions app/views/partials/header.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,14 @@
<form action="/sessions" method="post">
<input type="hidden" name="authenticity_token" value="{{ context.authenticity_token }}">
<input type="hidden" name="_method" value="delete">
<button type="submit">
{{ 'modules/user/users.logout' | t }}
</button>
<button type="submit">Log Out</button>
</form>
</li>
</ul>

</div>

</nav>


</header>

</header>
9 changes: 8 additions & 1 deletion modules/chat/public/views/pages/inbox.html.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,21 @@ slug: inbox
function _res = 'modules/chat/lib/commands/conversations/mark_read', conversation: current_conversation, participant_id: current_profile.id
if current_conversation.created
for participant_id in current_conversation.participant_ids
# platformos-check-disable GraphqlInForLoop
function _res = 'modules/chat/lib/commands/conversations/mark_read', conversation: current_conversation, participant_id: participant_id
# platformos-check-enable GraphqlInForLoop
endfor
endif
endif
function conversations = 'modules/chat/lib/queries/conversations/search_by_participant', participant_id: current_profile.id, limit: 20, page: 1

if conversations.total_entries > 0
theme_render_rc 'inbox', current_conversation: current_conversation, conversations: conversations, current_profile: current_profile
if current_conversation and current_conversation.participants == blank
graphql participants = 'modules/user/profiles/search', ids: current_conversation.participant_ids
hash_assign current_conversation['participants'] = participants.records.results
endif

render 'modules/chat/inbox', current_conversation: current_conversation, conversations: conversations, current_profile: current_profile
else
render 'modules/chat/blank'
endif
Expand Down
4 changes: 2 additions & 2 deletions modules/chat/public/views/partials/conversation.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<div class="pos-chat-conversationCard-lastMessage">
{% if last_message %}
<small>{{ last_message }}</small>
<time datetime="{{ created_at }}">
{{ created_at | strftime: "%b %d", timezone }}
<time datetime="{{ last_message.created_at }}">
{{ last_message.created_at | strftime: "%b %d", timezone }}
</time>
{% endif %}
</div>
Expand Down
57 changes: 23 additions & 34 deletions modules/chat/public/views/partials/inbox.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,12 @@
<script type="module" defer src="{{ 'modules/chat/js/pos-chat.js' | asset_url }}"></script>

<!-- message templates -->
{% assign dummy_message = '{ "message": "", "created_at": null }' | parse_json %}
<template id="pos-chat-template-message-received">
{% liquid
render 'modules/chat/message', message: '', authored: false, created_at: created_at, timezone: null
%}
{% render 'modules/chat/message', message: dummy_message, authored: false, timezone: null %}
</template>
<template id="pos-chat-template-message-sent">
{% liquid
render 'modules/chat/message', message: '', authored: true, created_at: created_at, timezone: null
%}
{% render 'modules/chat/message', message: dummy_message, authored: true, timezone: null %}
</template>
<!-- end message templates -->

Expand All @@ -68,32 +65,19 @@
assign other_participants = participants | subtract_array: current_participants
assign from_profile = other_participants | first

if conversation.id != current_conversation.id
assign current = false
else
if conversation.id == current_conversation.id
assign current = true
endif

if conversation.participant_read_ids contains current_profile.id
assign unread = false
else
assign unread = true
assign current = false
endif

assign name = from_profile.first_name | append: ' ' | append: from_profile.last_name | default: from_profile.name
assign imageSrc = from_profile.avatar.photo.versions.sm
assign last_message = conversation.last_message.message
assign created_at = conversation.last_message.created_at

if conversation.id == current_conversation.id
assign other_participant = from_profile
endif
%}
{% if conversation.last_message %}
<li>
{% liquid
theme_render_rc 'conversation', id: conversation.id, current: current, unread: unread, name: name, imageSrc: imageSrc, last_message: last_message, created_at: created_at, timezone: current_profile.timezone
%}
{% render 'modules/chat/conversation', id: conversation.id, current: current, name: name, imageSrc: imageSrc, last_message: last_message, timezone: current_profile.timezone %}
</li>
{% endif %}
{% endfor %}
Expand All @@ -107,14 +91,19 @@
</a>
{% liquid
if other_participant
if other_participant.first_name
assign name = other_participant.first_name | append: ' ' | append: other_participant.last_name
else
assign name = other_participant.name
assign participants = current_conversation.participants
if participants
assign current_participants = participants | select: id: current_profile.id
assign other_participants = participants | subtract_array: current_participants
assign from_profile = other_participants | first
if from_profile
if from_profile.first_name
assign name = from_profile.first_name | append: ' ' | append: from_profile.last_name
else
assign name = from_profile.name
endif
render 'modules/common-styling/user/avatar', size: 's', name: name, imageSrc: from_profile.avatar.photo.versions.sm
endif

render 'modules/common-styling/user/avatar', size: 's', name: name, imageSrc: other_participant.avatar.photo.versions.sm
endif
%}
{{ name }}
Expand All @@ -129,11 +118,11 @@
{% liquid
assign list = current_conversation.messages | reverse
for message in list
if message.autor_id != current_profile.id
render 'modules/chat/message', message: message.message, created_at: message.created_at, authored: false, timezone: current_profile.timezone
else
render 'modules/chat/message', message: message.message, created_at: message.created_at, authored: true, timezone: current_profile.timezone
if message.autor_id == current_profile.id
assign authored = true
endif

render 'modules/chat/message', message: message, authored: authored, timezone: current_profile.timezone
endfor
%}
</ul>
Expand All @@ -153,4 +142,4 @@
{{ 'modules/chat/pick_conversation' | t }}
</div>
{% endif %}
</div>
</div>
10 changes: 5 additions & 5 deletions modules/chat/public/views/partials/message.liquid
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{% liquid
assign message = message | markdown: '{ "elements": [ "br" ] }'
assign msg = message.message | markdown: '{ "elements": [ "br" ] }'
%}

<li class="pos-chat-message {% if authored %} pos-chat-message-authored {% endif %}">

<time datetime="{{ created_at }}">
{% if created_at %}
{{ created_at | l: 'long', timezone }}
<time datetime="{{ message.created_at }}">
{% if message.created_at %}
{{ message.created_at | l: 'long', timezone }}
{% endif %}
</time>

<div class="pos-chat-message-content">
{{ message }}
{{ msg }}
</div>

</li>