mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-01-29 08:01:45 -05:00
* Show average scroll time * Track fetching and scrolling performance, MyObs * Limit default mode fields * Update fields * Make sure pagination and loading wheel work * Limit the API requests we're making to what advanced users need * Tweaks to add fetching metrics * Remove one more field and console log * Minimize unnecessary changes * Keep debug mode scheme * Use mapping and more succinct filtering and sorting on obs list/grid * Mapping for comments and ids * Fixes for ids, comments, and belongs to user * Make sure data is updated at end of list * Make sure to update refs * Make sure list updates when switching into advanced mode * Remove log * Fix test and crash * Improve performance of mapping to improve fetching (load data onscreen) times * Fix merge conflicts
46 lines
945 B
JavaScript
46 lines
945 B
JavaScript
import { Realm } from "@realm/react";
|
|
|
|
import Flag from "./Flag";
|
|
import User from "./User";
|
|
|
|
class Comment extends Realm.Object {
|
|
static COMMENT_FIELDS = {
|
|
uuid: true,
|
|
body: true,
|
|
created_at: true,
|
|
hidden: true,
|
|
flags: Flag.FLAG_FIELDS,
|
|
id: true,
|
|
user: User && User.FIELDS
|
|
};
|
|
|
|
static mapCommentForMyObsAdvancedMode( comment ) {
|
|
return {
|
|
uuid: comment.uuid
|
|
};
|
|
}
|
|
|
|
static schema = {
|
|
name: "Comment",
|
|
embedded: true,
|
|
properties: {
|
|
uuid: "string",
|
|
body: "string?",
|
|
created_at: "string?",
|
|
flags: "Flag[]",
|
|
hidden: "bool?",
|
|
id: "int?",
|
|
user: "User?",
|
|
// this creates an inverse relationship so comments
|
|
// automatically keep track of which Observation they are assigned to
|
|
assignee: {
|
|
type: "linkingObjects",
|
|
objectType: "Observation",
|
|
property: "comments"
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
export default Comment;
|