Switch to unified view

a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
...
...
204
    project_id = ForeignIdProperty('Project', if_missing=lambda:c.project._id)
204
    project_id = ForeignIdProperty('Project', if_missing=lambda:c.project._id)
205
    app_config_id = ForeignIdProperty('AppConfig', if_missing=lambda:c.app.config._id)
205
    app_config_id = ForeignIdProperty('AppConfig', if_missing=lambda:c.app.config._id)
206
206
207
    # Subscription filters
207
    # Subscription filters
208
    artifact_title = FieldProperty(str)
208
    artifact_title = FieldProperty(str)
209
    artifact_url = FieldProperty(str)
209
    artifact_index_id = FieldProperty(str)
210
    artifact_index_id = FieldProperty(str)
210
    topic = FieldProperty(str)
211
    topic = FieldProperty(str)
211
212
212
    # Subscription type
213
    # Subscription type
213
    is_flash = FieldProperty(bool, if_missing=False)
214
    is_flash = FieldProperty(bool, if_missing=False)
...
...
232
        if user_id is None: user_id = c.user._id
233
        if user_id is None: user_id = c.user._id
233
        if project_id is None: project_id = c.project._id
234
        if project_id is None: project_id = c.project._id
234
        if app_config_id is None: app_config_id = c.app.config._id
235
        if app_config_id is None: app_config_id = c.app.config._id
235
        if artifact is None:
236
        if artifact is None:
236
            artifact_title = 'All artifacts'
237
            artifact_title = 'All artifacts'
238
            artifact_url = None
237
            artifact_index_id = None
239
            artifact_index_id = None
238
        else:
240
        else:
239
            i = artifact.index()
241
            i = artifact.index()
240
            artifact_title = i['title_s']
242
            artifact_title = i['title_s']
243
            artifact_url = artifact.url()
241
            artifact_index_id = i['id']
244
            artifact_index_id = i['id']
242
        d = dict(user_id=user_id, project_id=project_id, app_config_id=app_config_id,
245
        d = dict(user_id=user_id, project_id=project_id, app_config_id=app_config_id,
243
                 artifact_index_id=artifact_index_id, topic=topic)
246
                 artifact_index_id=artifact_index_id, topic=topic)
244
        sess = session(cls)
247
        sess = session(cls)
245
        try:
248
        try:
246
            mbox = cls(
249
            mbox = cls(
247
                type=type, frequency=dict(n=n, unit=unit),
250
                type=type, frequency=dict(n=n, unit=unit),
248
                artifact_title=artifact_title,
251
                artifact_title=artifact_title,
252
                artifact_url=artifact_url,
249
                **d)
253
                **d)
250
            sess.flush(mbox)
254
            sess.flush(mbox)
251
        except pymongo.errors.DuplicateKeyError:
255
        except pymongo.errors.DuplicateKeyError:
252
            sess.expunge(mbox)
256
            sess.expunge(mbox)
253
            mbox = cls.query.get(**d)
257
            mbox = cls.query.get(**d)
254
            mbox.artifact_title = artifact_title
258
            mbox.artifact_title = artifact_title
259
            mbox.artifact_url = artifact_url
255
            mbox.type = type
260
            mbox.type = type
256
            mbox.frequency.n = n
261
            mbox.frequency.n = n
257
            mbox.frequency.unit = unit
262
            mbox.frequency.unit = unit
258
263
259
    @classmethod
264
    @classmethod