mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
missing link to restore conversation (fixes philomena-dev/philomena#42)
This commit is contained in:
parent
4cf02da8e6
commit
c30c8e3136
2 changed files with 13 additions and 1 deletions
|
@ -16,7 +16,10 @@ h1 = @conversation.title
|
|||
=> @messages.total_entries
|
||||
= pluralize("message", "messages", @messages.total_entries)
|
||||
= pagination
|
||||
= link "Remove conversation", to: Routes.conversation_hide_path(@conn, :create, @conversation), data: [method: "post", confirm: "Are you really, really sure?"]
|
||||
= if hidden_by?(@current_user, @conversation) do
|
||||
= link "Restore conversation", to: Routes.conversation_hide_path(@conn, :delete, @conversation), data: [method: "delete"]
|
||||
- else
|
||||
= link "Remove conversation", to: Routes.conversation_hide_path(@conn, :create, @conversation), data: [method: "post", confirm: "Are you really, really sure?"]
|
||||
= link "Report conversation", to: Routes.conversation_report_path(@conn, :new, @conversation)
|
||||
= link "Mark as unread", to: Routes.conversation_read_path(@conn, :delete, @conversation), data: [method: "delete"]
|
||||
|
||||
|
|
|
@ -16,6 +16,15 @@ defmodule PhilomenaWeb.ConversationView do
|
|||
def read_by?(_user, _conversation),
|
||||
do: false
|
||||
|
||||
def hidden_by?(%{id: user_id}, %{to_id: user_id} = conversation),
|
||||
do: conversation.to_hidden
|
||||
|
||||
def hidden_by?(%{id: user_id}, %{from_id: user_id} = conversation),
|
||||
do: conversation.from_hidden
|
||||
|
||||
def hidden_by?(_user, _conversation),
|
||||
do: false
|
||||
|
||||
def conversation_class(user, conversation) do
|
||||
case read_by?(user, conversation) do
|
||||
false -> "warning"
|
||||
|
|
Loading…
Reference in a new issue