Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
107e5f7c
Commit
107e5f7c
authored
Jul 16, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide chat menu items on broadcast channels when user has no post privileges
parent
f41aa467
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
23 deletions
+29
-23
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+5
-1
Menu.kt
app/src/main/java/chat/rocket/android/chatroom/ui/Menu.kt
+24
-22
No files found.
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
107e5f7c
...
@@ -148,6 +148,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -148,6 +148,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
private
lateinit
var
actionSnackbar
:
ActionSnackbar
private
lateinit
var
actionSnackbar
:
ActionSnackbar
internal
var
citation
:
String
?
=
null
internal
var
citation
:
String
?
=
null
private
var
editingMessageId
:
String
?
=
null
private
var
editingMessageId
:
String
?
=
null
internal
var
disableMenu
:
Boolean
=
false
private
val
compositeDisposable
=
CompositeDisposable
()
private
val
compositeDisposable
=
CompositeDisposable
()
private
var
playComposeMessageButtonsAnimation
=
true
private
var
playComposeMessageButtonsAnimation
=
true
...
@@ -355,7 +356,10 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -355,7 +356,10 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
ui
{
ui
{
setupMessageComposer
(
userCanPost
)
setupMessageComposer
(
userCanPost
)
isBroadcastChannel
=
channelIsBroadcast
isBroadcastChannel
=
channelIsBroadcast
if
(
isBroadcastChannel
&&
!
userCanMod
)
activity
?.
invalidateOptionsMenu
()
if
(
isBroadcastChannel
&&
!
userCanMod
)
{
disableMenu
=
true
activity
?.
invalidateOptionsMenu
()
}
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/Menu.kt
View file @
107e5f7c
...
@@ -14,7 +14,21 @@ internal fun ChatRoomFragment.setupMenu(menu: Menu) {
...
@@ -14,7 +14,21 @@ internal fun ChatRoomFragment.setupMenu(menu: Menu) {
setupSearchMessageMenuItem
(
menu
,
requireContext
())
setupSearchMessageMenuItem
(
menu
,
requireContext
())
setupFavoriteMenuItem
(
menu
)
setupFavoriteMenuItem
(
menu
)
if
(
chatRoomType
!=
RoomType
.
DIRECT_MESSAGE
)
{
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_PINNED_MESSAGES
,
Menu
.
NONE
,
R
.
string
.
title_pinned_messages
)
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_FAVORITE_MESSAGES
,
Menu
.
NONE
,
R
.
string
.
title_favorite_messages
)
if
(
chatRoomType
!=
RoomType
.
DIRECT_MESSAGE
&&
!
disableMenu
)
{
menu
.
add
(
menu
.
add
(
Menu
.
NONE
,
Menu
.
NONE
,
MENU_ACTION_MEMBER
,
MENU_ACTION_MEMBER
,
...
@@ -30,26 +44,14 @@ internal fun ChatRoomFragment.setupMenu(menu: Menu) {
...
@@ -30,26 +44,14 @@ internal fun ChatRoomFragment.setupMenu(menu: Menu) {
)
)
}
}
menu
.
add
(
if
(!
disableMenu
)
{
Menu
.
NONE
,
menu
.
add
(
MENU_ACTION_PINNED_MESSAGES
,
Menu
.
NONE
,
Menu
.
NONE
,
MENU_ACTION_FILES
,
R
.
string
.
title_pinned_messages
Menu
.
NONE
,
)
R
.
string
.
title_files
)
menu
.
add
(
}
Menu
.
NONE
,
MENU_ACTION_FAVORITE_MESSAGES
,
Menu
.
NONE
,
R
.
string
.
title_favorite_messages
)
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_FILES
,
Menu
.
NONE
,
R
.
string
.
title_files
)
}
}
internal
fun
ChatRoomFragment
.
setOnMenuItemClickListener
(
item
:
MenuItem
)
{
internal
fun
ChatRoomFragment
.
setOnMenuItemClickListener
(
item
:
MenuItem
)
{
...
@@ -101,7 +103,7 @@ private fun ChatRoomFragment.setupSearchViewTextListener(searchView: SearchView)
...
@@ -101,7 +103,7 @@ private fun ChatRoomFragment.setupSearchViewTextListener(searchView: SearchView)
// TODO: We use isSearchTermQueried to avoid querying when the search view is expanded but the user doesn't start typing. Check for a native solution.
// TODO: We use isSearchTermQueried to avoid querying when the search view is expanded but the user doesn't start typing. Check for a native solution.
if
(
it
.
isEmpty
()
&&
isSearchTermQueried
)
{
if
(
it
.
isEmpty
()
&&
isSearchTermQueried
)
{
presenter
.
loadMessages
(
chatRoomId
,
chatRoomType
,
clearDataSet
=
true
)
presenter
.
loadMessages
(
chatRoomId
,
chatRoomType
,
clearDataSet
=
true
)
}
else
if
(
it
.
isNotEmpty
()){
}
else
if
(
it
.
isNotEmpty
())
{
presenter
.
searchMessages
(
chatRoomId
,
it
)
presenter
.
searchMessages
(
chatRoomId
,
it
)
isSearchTermQueried
=
true
isSearchTermQueried
=
true
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment