* MM-40093: adds remote action to sync threads
Syncing threads fetches all unread threads if there are no threads in
the DB.
If there are threads in the DB it fetches all threads newest than the
newest one we have stored.
Fetching happens in batches of 60 threads at a time.
* Fixes querying for all threads list
* Syncs threads on WS reconnection
* Addresses review comments
* Addresses review comments
* Sets values on my_channel according to CRT
* Team counts with regard to CRT
* Fixes myChannel.is_unread with regard to CRT
* Include DM/GMs for thread counts on demand
* Incorporate thread mention counts in server/channel
* Channel updates in regard to CRT
* Fix add DM screen and some other database related issues
* Minor style fixes
* Handle create DM/GM websocket by using the teammate ids
* Address feedback
* upgrade to RN 68 (old arch)
* remove test setup unused & commented mock
* Android target set to 30
* Fix theme when opening app from push notification
* upgrade common mark
* started with the diagrams
* removed redundant tables
next step:
1. reconstruct id ( local id vs server id )
2. annotate fields with examples
3. recreate relationship
* work in progress
* work in progress
* fix association
* update postsInChannel
* removed SlashCommands from the Server database schema
* added missing associations in the models and updated docs/database
* exported server database
* update test
* code corrections following review
* update relationship
* update docs
* removed cyclic relationship
* Revert "removed cyclic relationship"
This reverts commit 4d784efb81.
* removed isOptional from Draft
* linked myChannelSettings to myChannel instead of Channel
* update diagrams
* store null instead of empty string
* update thread association
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
* Fix Search users in Create Direct Message
* Fix UserListRow style for onPress
* Prevent create direct message & browse channels from being dismissed with a swipe
* Only display Edit header option when tapping in the channel intro
* Fix localization for ThreadFollowButton
* Prevent New channel screen from being dismiss with a swipe
* [Gekidou HOTFIX] fixes saving threads in the DB
`loadedInGlobalThreads` cannot be a property of the thread, the DB will
fail with unknown column upon saving.
This commit makes it an argument of handleThreads and
handleThreadInTeam.
Fixes wrong foreignKey in THREAD table associations.
* Fixes errors
* Fixes error
* Fix search bar style
* MM-42983 Align mention badge on channel list item
* MM-42985 polish channel intro UI
* MM-42984 update fonts on 'Show' bottom sheet
* MM-42982 Increase tap area of back button on channel view
* Set StatusBar style based on theme sidebarBg
* Reconnect other WS after 20 seconds insted of 5
* Only fetch missing profiles for DM/GMs
* Database prepare records optimization
* Do not use fallbackUsername for storing GM/DM in the database
* fix filter for fetching missing dm/gm
* remove use of indexOf inside another loop
* remove use of includes inside another loop
* remove use of find inside another loop
* Add missing translations
* disable Flipper on iOS
* Remove Flipper code from AppDelegate
* feedback review
* trim DM display name to make sure is not empty
* fixing missing direct channels display name
* UI/UX feedback
* fix WS channel viewed and mark as unread
* Remove duplicate emojis from reaction bar
* wip checkin
* wip checkin because my system is messed up again
* correct the add user and remove user from channel functions. THe user and channel ids sometimes come from the broudcast field, not the data object
* remove old comments
* remove old comments
* remove old comments
* add back in unarchive handler. handleChannelUpdateEvent will also update the deleteAt value for a channel, but does not get called when unarchive from the channel view, only through the system console.
* nit remove empty line
* wip
* wip
* remove handleChannelConvertedEvent
* remove handleChannelDirectAddedEvent
* wip
* wip
* wip
* Fix websockets events
* Address feedback
* Ensure categories and some refactoring
* Self review fixes
* Fix category creation bug
* Address feedback and minor improvements
* Address feedback
* Fix lint
Co-authored-by: Daniel Espino García <larkox@gmail.com>
* WS Events, Actions, Queries, Thread Follow, Post Query
* i18n changes
* Misc
* Only unread threads are marked as read
* Mark threads from WS even as visible in Global threads
* Merge fixes
* Update thread_post_list.tsx
* Merge fix
* Feedback fix
* Make teamId in handleThreads optional for unfollowed threads
* Removed unwated type and return
* Review changes
* Removing unused model
* Merge fix
* Misc fixes
* Following button query change
* Add performance and code improvements around post_list
* Fix test
* Move observers from utils to queries
* remove Flipper on iOS to fix CI build
* Fix observePermissionForChannel for DM/GM
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
* Refactors thread and threads_in_team tables
The convention is that only threads being in the ThreadsInTeam will be shown in a thread list,
and that only threads marked as loaded_in_global_threads are being shown
in the All threads tab in the list.
So when a thread arrives through different means, whether it's a WS event,
or just fetching a (*new) thread by opening it in a channel, etc...
we'll need to check if it's newer than any of the existing threads in the all threads list.
If it is it will be added in the ThreadsInTeam and will be marked as loaded_in_global_threads: true.
If it's not newer but it is an unread thread it will still be added in the ThreadsInTeam
but marked as loaded_in_global_threads: false.
This commit refactors `loaded_in_global_threads` field from the Thread table
to the ThreadsInTeam table so that the above is possible.
* Update tests
* Addresses review comments
* copy directly from v1. will get working and then convert class to functional components
* screen showing up correctly. Need to convert lifestyle methods
* create channel button working
* save before refactor in prep for bringing in edit_channel functionality
* change function naming
* clean up lint
* clean up for PR review
* clean up for PR review
* remove hoardcoded styles
* add edit_channel screen
* add handlePatchChannel
* add custom useFormInput hook. use edit screen for both create and edit screens. edit or create screen mode determined by channel prop passed in as a channel or null
* rename edit_channel to create_or_edit_channel
* displayname, header, and purpose are now an object with value and onChange props, created from the useFormInput hook. Now only need to pass this new FormInput Prop to the edit_channel_info component and deconstruct there to get the onChange and value
* fix some lint errors
* fix some lint errors
* remove empty line
* pass intl into utils validate functions because they are not Hooks. add validation for displayName including translations.
* Move useFormInput hook to its own hooks file and import
* simplify
* remove editing prop. Was used to determine if the right button was enabled. It was always true for edit_channel screen and always false for create channel screen. The enableRightButton prop call back is was also used for the same reason.
* remove channeUrl editing references. This was not implemented on v1
* pass editing prop back into component and add back logic. When editing one field must change. when creating, just need to check that name is provided
* lint fixes
* fix typing issue for channel types
* scrolling ref should be fixed. Linting should pass now
* Linting should pass now
* require id field in partial Channel. fixes tsc
* remove everything related to renaming the channel URL. This has never been requred for mobile
* manage state with useReducer so that all actions/state in one location. This also removes the number of onXXX functions and reduces the number of functions in the component
* reorganize code. useEffects are at top. Move type and interfaces outside of function component
* Fix lint
* nit: invert if statement checking a negative
* use cneterChannelColor. in figma this is center channel text, but I verified theme color by comparing to SSO login text color
* Simple snapshot tests as a start
* Add more tests
* update snapshot
* add snapshot tests. Add tests for button enabling and disabling
* simplify test with destructuring.
* PR feedback. formatting changes. get user and teamid from one call
* remove FormInput hook and use value/setvalue convention for controlled components
* no need to setChannelDisplayName after creating/updating channel
* Just pass the setXXX function. Don't need to create as separate callback
* modify floatingTextInput component to allow placeholder text
* remove InteractionManager. PR nits
* mv EditChannelComponent into create_or_edit screen. Rename component from EditChannelInfo to ChannelInfoForm
* correct import path
* add IntlShape Type to function input. Wrap screen with withServerDatabase, not withIntl
* remove state setting function calls from inside the reducer. move close function outside of the component. remove setRightButton and rightButton and place rightbutton in initial appState
* move editing const after useX oneliners and before useCallback, useEffect, and useReducers
* rightButton
- useMemo to memoize an object with dependencies
- move out of the appState
emitCanSaveChannel
- wrap with useCallback
onCreateChannel
- wrap with useCallback
onUpdateChannel
- wrap with useCallback
useEffect Navigation
- use the callbacks as dependencies in stead of the depencies of those
callbacks.
* wrap all formatted message with useMemo()
wrap all onXXXChangeText with useCallback and add deps
move all oneliner derived constants directly after useState useMemo
* remove useMemo from formatted text
* switchToCHannel is still not working. failing at
const channel: ChannelModel = await member.channel.fetch();
* use prepareMyChannelsForTeam to update db tables for new channel
* add placeholder text color
* Attach open edit channel screen to `Set Header` button in channel intro view
port SectionItem from V1 and us to add a Switch for setting private/public channel
hook up the plus icon in the channel list header to create a channel (temporary fix to allow debugging)
add new queryChannelsInfoById and queryCurrentChannelInfo query functions
update text for create screen text inputs
* Fix styles and fix actions
* Add autocomplete, fix patch, and address design feedback
* Address feedback
* Add margin between icon and label on Make Private
* Address feedback
* Address feedback
* Address feedback and fix channel list not updating when the channel gets created
* Address feedback and directly add the channel to the default category
* Render at-mentions as Members if no channelId is set
* Display autocomplete on iOS
Co-authored-by: Jason Frerich <jason.frerich@mattermost.com>
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
* added remote_id to user table schema
* update user model to accomodate for remote_id field
* transform - reaction - split into its own file
* update user transformer
* update isShared function
* Fix typescript
* make remote_id field optional
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
* Adds threads in team database table and handlers
DM/GM channels have no team ID. This makes it troublesome to paginate
threads in a team. The issue is that whenever a DM/GM thread is fetched
from pagination it will be added in all teams in that server,
potentially creating gaps in between threads for those teams.
This PR inserts a new table in the DB ThreadsInTeam which will hold
references of threads loaded in which server.
Thread lists then would have to rely on that table to show threads.
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
Co-authored-by: Avinash Lingaloo <avinashlng1080@gmail.com>