Unverified Commit d1aa1b36 authored by Rafael Kellermann Streit's avatar Rafael Kellermann Streit Committed by GitHub

Merge pull request #1873 from RocketChat/feat-report-message

[NEW] Report message
parents 461beeae c16a1d36
......@@ -251,6 +251,9 @@ class ChatRoomAdapter(
R.id.action_message_permalink -> {
actionSelectListener?.copyPermalink(id)
}
R.id.action_message_report -> {
actionSelectListener?.reportMessage(id)
}
else -> {
TODO("Not implemented")
}
......@@ -260,16 +263,29 @@ class ChatRoomAdapter(
}
interface OnActionSelected {
fun showMessageInfo(id: String)
fun citeMessage(roomName: String, roomType: String, messageId: String, mentionAuthor: Boolean)
fun copyMessage(id: String)
fun editMessage(roomId: String, messageId: String, text: String)
fun toogleStar(id: String, star: Boolean)
fun tooglePin(id: String, pin: Boolean)
fun deleteMessage(roomId: String, id: String)
fun showReactions(id: String)
fun openDirectMessage(roomName: String, message: String)
fun sendMessage(chatRoomId: String, text: String)
fun copyPermalink(id: String)
fun reportMessage(id: String)
}
}
......@@ -60,6 +60,7 @@ import chat.rocket.core.internal.rest.joinChat
import chat.rocket.core.internal.rest.markAsRead
import chat.rocket.core.internal.rest.messages
import chat.rocket.core.internal.rest.pinMessage
import chat.rocket.core.internal.rest.reportMessage
import chat.rocket.core.internal.rest.runCommand
import chat.rocket.core.internal.rest.searchMessages
import chat.rocket.core.internal.rest.sendMessage
......@@ -373,6 +374,19 @@ class ChatRoomPresenter @Inject constructor(
}
}
fun reportMessage(messageId: String, description: String) {
launchUI(strategy) {
try {
retryIO("reportMessage($messageId, $description)") {
client.reportMessage(messageId = messageId, description = description)
}
view.showMessage(R.string.report_sent)
} catch (ex: RocketChatException) {
Timber.e(ex)
}
}
}
fun selectFile() {
view.showFileSelection(settings.uploadMimeTypeFilter())
}
......
......@@ -1167,4 +1167,9 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override fun sendMessage(chatRoomId: String, text: String) {
presenter.sendMessage(chatRoomId, text, null)
}
override fun reportMessage(id: String) {
presenter.reportMessage(messageId = id,
description = "This message was reported by a user from the Android app")
}
}
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:fillColor="@color/actionMenuColor"
android:pathData="M10.11,16.546h-0.183c-4.329,0 -7.47,-2.753 -7.47,-6.546 0,-3.61 2.942,-6.547 6.56,-6.547 3.616,0 6.56,2.937 6.56,6.547 0,0.59 -0.276,1.18 -0.567,1.803 -0.1,0.218 -0.2,0.433 -0.278,0.618 -0.756,1.626 0.731,2.41 1.364,2.743 0.098,0.051 0.224,0.117 0.326,0.178 -0.416,0.478 -1.814,1.22 -6.312,1.204m6.666,-2.667c-0.895,-0.473 -0.852,-0.567 -0.71,-0.875 0.081,-0.193 0.172,-0.389 0.264,-0.587 0.33,-0.705 0.703,-1.505 0.703,-2.417 0,-4.412 -3.597,-8 -8.017,-8S1,5.588 1,10c0,4.635 3.755,8 8.927,8h0.382c2.857,0 6.632,-0.256 7.565,-2.237 0.493,-1.046 -0.58,-1.612 -1.098,-1.884" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<!--<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--xmlns:app="http://schemas.android.com/apk/res-auto"-->
<!--xmlns:tools="http://schemas.android.com/tools"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:fillViewport="true">-->
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="16dp">
<!--<com.google.android.material.appbar.AppBarLayout-->
<!--android:id="@+id/appBarLayout"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:background="@color/colorPrimary"-->
<!--android:theme="@style/Theme.AppCompat.Light.NoActionBar">-->
<!--<androidx.appcompat.widget.Toolbar-->
<!--android:id="@+id/toolbar"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="?attr/actionBarSize"-->
<!--app:layout_scrollFlags="scroll|enterAlways"-->
<!--app:navigationIcon="?android:attr/homeAsUpIndicator"-->
<!--app:popupTheme="@style/ThemeOverlay.AppCompat.Light"-->
<!--app:theme="@style/ActionModeStyle">-->
<!--<RelativeLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content">-->
<!--<TextView-->
<!--android:id="@+id/text_change_password"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_alignParentStart="true"-->
<!--android:ellipsize="end"-->
<!--android:maxLines="1"-->
<!--android:text="@string/action_msg_report"-->
<!--android:textColor="@color/colorWhite"-->
<!--android:textSize="18sp"-->
<!--android:textStyle="bold" />-->
<!--</RelativeLayout>-->
<!--</androidx.appcompat.widget.Toolbar>-->
<!--</com.google.android.material.appbar.AppBarLayout>-->
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="24dp" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="24dp" />
<!--<TextView-->
<!--android:id="@+id/text_view_report_label"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="Description"-->
<!--android:textColor="@color/darkGray"-->
<!--app:layout_constraintStart_toStartOf="@+id/guideline_start"-->
<!--app:layout_constraintTop_toTopOf="parent" />-->
<!--<TextView-->
<!--android:id="@+id/text_view_required"-->
<!--android:layout_width="0dp"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginStart="8dp"-->
<!--android:text="(required)"-->
<!--android:textColor="@color/darkGray"-->
<!--android:textSize="14sp"-->
<!--app:layout_constraintEnd_toEndOf="@+id/guideline_end"-->
<!--app:layout_constraintStart_toEndOf="@id/text_view_report_label"-->
<!--app:layout_constraintTop_toTopOf="parent" />-->
<EditText
android:id="@+id/edit_text_description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:inputType="textCapSentences|textMultiLine"
android:maxLines="4"
android:overScrollMode="always"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="@+id/guideline_end"
app:layout_constraintStart_toStartOf="@+id/guideline_start"
app:layout_constraintTop_toTopOf="parent"
tools:text="Jot something untoward..." />
<TextView
android:id="@+id/text_view_error"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/required"
android:textColor="@color/colorRed"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="@+id/guideline_end"
app:layout_constraintStart_toStartOf="@+id/guideline_start"
app:layout_constraintTop_toBottomOf="@+id/edit_text_description"
tools:visibility="visible" />
<Button
android:id="@+id/button_send_report"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:background="@drawable/rounded_color_accent"
android:fontFamily="sans-serif-medium"
android:text="@string/submit"
android:textColor="@android:color/white"
app:layout_constraintEnd_toEndOf="@+id/guideline_end"
app:layout_constraintStart_toStartOf="@+id/guideline_start"
app:layout_constraintTop_toBottomOf="@id/text_view_error" />1
</androidx.constraintlayout.widget.ConstraintLayout>
<!--</androidx.core.widget.NestedScrollView>-->
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_message_info"
android:icon="@drawable/ic_action_message_info_outline_24dp"
android:title="@string/action_msg_info" />
<item
android:id="@+id/action_message_reply"
android:icon="@drawable/ic_action_message_reply_24dp"
android:title="@string/action_msg_reply" />
<item
android:id="@+id/action_message_edit"
android:icon="@drawable/ic_action_message_edit_24dp"
android:title="@string/action_msg_edit" />
<item
android:id="@+id/action_menu_msg_react"
android:icon="@drawable/ic_add_reaction"
android:title="@string/action_msg_add_reaction" />
<item
android:id="@+id/action_message_permalink"
......@@ -27,11 +34,6 @@
android:icon="@drawable/ic_action_message_copy_24dp"
android:title="@string/action_msg_copy" />
<item
android:id="@+id/action_menu_msg_react"
android:icon="@drawable/ic_add_reaction"
android:title="@string/action_msg_add_reaction" />
<!--<item-->
<!--android:id="@+id/action_menu_msg_share"-->
<!--andrtextIconicon="@drawable/ic_share_black_24px"-->
......@@ -48,9 +50,9 @@
android:title="@string/action_msg_pin" />
<item
android:id="@+id/action_message_edit"
android:icon="@drawable/ic_action_message_edit_24dp"
android:title="@string/action_msg_edit" />
android:id="@+id/action_message_report"
android:icon="@drawable/ic_action_message_report_24dp"
android:title="@string/action_msg_report" />
<item
android:id="@+id/action_message_delete"
......
......@@ -225,6 +225,8 @@
<string name="action_msg_add_reaction">Reaktion hinzufügen</string>
<!-- TODO - Add proper translation -->
<string name="action_msg_copy_permalink">Copy permalink</string>
<!-- TODO - Add proper translation -->
<string name="action_msg_report">Report</string>
<!-- Permission messages -->
<string name="permission_editing_not_allowed">Bearbeiten nicht erlaubt</string>
......@@ -334,4 +336,9 @@
<!-- User Details -->
<string name="message">Message</string> <!--TODO - Add proper translation-->
<string name="timezone">Timezone</string> <!--TODO - Add proper translation-->
<!-- Report -->
<string name="submit">Submit</string> <!--TODO - Add proper translation-->
<string name="required">*required</string> <!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string> <!--TODO - Add proper translation-->
</resources>
......@@ -220,6 +220,8 @@
<string name="action_title_editing">Edición de mensaje</string>
<string name="action_msg_add_reaction">Añadir una reacción</string>
<string name="action_msg_copy_permalink">Copiar permalink</string>
<!-- TODO - Add proper translation -->
<string name="action_msg_report">Report</string>
<!-- Permission messages -->
<string name="permission_editing_not_allowed">La edición no és permitida</string>
......@@ -335,4 +337,8 @@
<!-- User Details -->
<string name="message">Message</string> <!-- TODO - Add proper translation -->
<string name="timezone">Timezone</string> <!-- TODO - Add proper translation -->
<!-- Report -->
<string name="submit">Submit</string> <!--TODO - Add proper translation-->
<string name="required">*required</string> <!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string> <!--TODO - Add proper translation-->
</resources>
......@@ -226,6 +226,8 @@
<string name="action_msg_add_reaction">Ajouter une réaction</string>
<!-- TODO - Add proper translation -->
<string name="action_msg_copy_permalink">Copy permalink</string>
<!-- TODO - Add proper translation -->
<string name="action_msg_report">Report</string>
<!-- Permission messages -->
<string name="permission_editing_not_allowed">L\'édition n\'est pas autorisée</string>
......@@ -340,4 +342,11 @@
<string name="message">Message</string>
<!-- TODO - Add proper translation -->
<string name="timezone">Timezone</string>
</resources>
\ No newline at end of file
<!-- Report -->
<!--TODO - Add proper translation-->
<string name="submit">Submit</string>
<!--TODO - Add proper translation-->
<string name="required">*required</string>
<!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string>
</resources>
......@@ -227,6 +227,8 @@
<string name="action_title_editing">संपादन संदेश</string>
<string name="action_msg_add_reaction">प्रतिक्रिया जोड़ें</string>
<string name="action_msg_copy_permalink">परमालिंक कॉपी करें</string>
<!-- TODO - Add proper translation -->
<string name="action_msg_report">Report</string>
<!-- Permission messages -->
<string name="permission_editing_not_allowed">संपादन की अनुमति नहीं है</string>
......@@ -339,4 +341,12 @@
<string name="message">Message</string>
<!-- TODO - Add proper translation -->
<string name="timezone">Timezone</string>
<!-- Report -->
<!--TODO - Add proper translation-->
<string name="submit">Submit</string>
<!--TODO - Add proper translation-->
<string name="required">*required</string>
<!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string>
</resources>
......@@ -222,7 +222,9 @@
<string name="action_msg_share">Condividi</string>
<string name="action_title_editing">Modifica messaggio</string>
<string name="action_msg_add_reaction">Aggiungi reazione</string>
<string name="action_msg_copy_permalink">Copia permalink</string>3
<string name="action_msg_copy_permalink">Copia permalink</string>
<!-- TODO - Add proper translation -->
<string name="action_msg_report">Report</string>
<!-- Permission messages -->
<string name="permission_editing_not_allowed">La modifica non è consentita</string>
......@@ -334,4 +336,12 @@
<string name="message">Message</string>
<!-- TODO - Add proper translation -->
<string name="timezone">Timezone</string>
<!-- Report -->
<!--TODO - Add proper translation-->
<string name="submit">Submit</string>
<!--TODO - Add proper translation-->
<string name="required">*required</string>
<!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string>
</resources>
......@@ -228,6 +228,8 @@
<string name="action_title_editing">メッセージの編集</string>
<string name="action_msg_add_reaction">リアクションする</string>
<string name="action_msg_copy_permalink">パーマリンクのコピー</string>
<!-- TODO - Add proper translation -->
<string name="action_msg_report">Report</string>
<!-- Permission messages -->
<string name="permission_editing_not_allowed">編集は許可されていません</string>
......@@ -341,4 +343,12 @@
<string name="message">Message</string>
<!-- TODO - Add proper translation -->
<string name="timezone">Timezone</string>
</resources>
\ No newline at end of file
<!-- Report -->
<!--TODO - Add proper translation-->
<string name="submit">Submit</string>
<!--TODO - Add proper translation-->
<string name="required">*required</string>
<!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string>
</resources>
......@@ -225,6 +225,8 @@
<string name="action_title_editing">Editando mensagem</string>
<string name="action_msg_add_reaction">Adicionar reação</string>
<string name="action_msg_copy_permalink">Copiar permalink</string>
<!-- TODO - Add proper translation -->
<string name="action_msg_report">Reportar</string>
<!-- Permission messages -->
<string name="permission_editing_not_allowed">Edição não permitida</string>
......@@ -338,4 +340,9 @@
<string name="message">Mensagem</string>
<!-- TODO - Add proper translation -->
<string name="timezone">Fuso horário</string>
<!-- Report -->
<string name="submit">Enviar</string>
<string name="required">*obrigatório</string>
<string name="report_sent">A mensagem foi reportada!</string>
</resources>
......@@ -224,6 +224,8 @@
<string name="action_title_editing">Редактирование сообщения</string>
<string name="action_msg_add_reaction">Отреагировать</string>
<string name="action_msg_copy_permalink">Копировать ссылку</string>
<!-- TODO - Add proper translation -->
<string name="action_msg_report">Report</string>
<!-- Permission messages -->
<string name="permission_editing_not_allowed">Редактирование запрещено</string>
......@@ -336,4 +338,12 @@
<string name="message">Message</string>
<!-- TODO - Add proper translation -->
<string name="timezone">Timezone</string>
<!-- Report -->
<!--TODO - Add proper translation-->
<string name="submit">Submit</string>
<!--TODO - Add proper translation-->
<string name="required">*required</string>
<!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string>
</resources>
......@@ -228,6 +228,8 @@
<string name="action_msg_add_reaction">Tepki Ekle</string>
<!-- TODO - Add proper translation -->
<string name="action_msg_copy_permalink">Copy permalink</string>
<!-- TODO - Add proper translation -->
<string name="action_msg_report">Report</string>
<!-- Permission messages -->
<string name="permission_editing_not_allowed">Düzenlemeye izin verilmiyor</string>
......@@ -337,4 +339,9 @@
<!-- User Details -->
<string name="message">Message</string> <!--TODO - Add proper translation-->
<string name="timezone">Timezone</string> <!--TODO - Add proper translation-->
<!-- Report -->
<string name="submit">Submit</string> <!--TODO - Add proper translation-->
<string name="required">*required</string> <!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string> <!--TODO - Add proper translation-->
</resources>
......@@ -224,6 +224,8 @@
<string name="action_msg_add_reaction">Відреагувати</string>
<!-- TODO - Add proper translation -->
<string name="action_msg_copy_permalink">Copy permalink</string>
<!-- TODO - Add proper translation -->
<string name="action_msg_report">Report</string>
<!-- Permission messages -->
<string name="permission_editing_not_allowed">Редагування заборонено</string>
......@@ -338,4 +340,12 @@
<string name="message">Message</string>
<!-- TODO - Add proper translation -->
<string name="timezone">Timezone</string>
<!-- Report -->
<!--TODO - Add proper translation-->
<string name="submit">Submit</string>
<!--TODO - Add proper translation-->
<string name="required">*required</string>
<!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string>
</resources>
......@@ -240,6 +240,7 @@ https://github.com/RocketChat/java-code-styles/blob/master/CODING_STYLE.md#strin
<string name="action_title_editing">Editing Message</string>
<string name="action_msg_add_reaction">Add reaction</string>
<string name="action_msg_copy_permalink">Copy permalink</string>
<string name="action_msg_report">Report</string>
<!-- Permission messages -->
<string name="permission_editing_not_allowed">Editing is not allowed</string>
......@@ -352,4 +353,9 @@ https://github.com/RocketChat/java-code-styles/blob/master/CODING_STYLE.md#strin
<string name="message">Message</string>
<string name="timezone">Timezone</string>
<string name="status" translatable="false">Status</string>
</resources>
\ No newline at end of file
<!-- Report -->
<string name="submit">Submit</string>
<string name="required">*required</string>
<string name="report_sent">Your report has been sent!</string>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment